#define ShadowRoot_h
#include "core/dom/ContainerNode.h"
-#include "core/dom/Document.h"
#include "core/dom/DocumentFragment.h"
#include "core/dom/Element.h"
#include "core/dom/TreeScope.h"
#include "wtf/DoublyLinkedList.h"
-namespace WebCore {
+namespace blink {
+class Document;
class ElementShadow;
class ExceptionState;
class HTMLShadowElement;
class InsertionPoint;
class ShadowRootRareData;
+class StyleSheetList;
-class ShadowRoot FINAL : public DocumentFragment, public TreeScope, public DoublyLinkedListNode<ShadowRoot> {
+class ShadowRoot final : public DocumentFragment, public TreeScope, public DoublyLinkedListNode<ShadowRoot> {
+ DEFINE_WRAPPERTYPEINFO();
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ShadowRoot);
friend class WTF::DoublyLinkedListNode<ShadowRoot>;
public:
// FIXME: We will support multiple shadow subtrees, however current implementation does not work well
AuthorShadowRoot
};
- static PassRefPtr<ShadowRoot> create(Document& document, ShadowRootType type)
+ static PassRefPtrWillBeRawPtr<ShadowRoot> create(Document& document, ShadowRootType type)
{
- return adoptRef(new ShadowRoot(document, type));
+ return adoptRefWillBeNoop(new ShadowRoot(document, type));
}
void recalcStyle(StyleRecalcChange);
// Disambiguate between Node and TreeScope hierarchies; TreeScope's implementation is simpler.
using TreeScope::document;
+ using TreeScope::getElementById;
Element* host() const { return toElement(parentOrShadowHostNode()); }
ElementShadow* owner() const { return host() ? host()->shadow() : 0; }
bool isOldest() const { return !olderShadowRoot(); }
bool isOldestAuthorShadowRoot() const;
- virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
+ virtual void attach(const AttachContext& = AttachContext()) override;
- virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
- virtual void removedFrom(ContainerNode*) OVERRIDE;
+ virtual InsertionNotificationRequest insertedInto(ContainerNode*) override;
+ virtual void removedFrom(ContainerNode*) override;
- virtual void registerScopedHTMLStyleChild() OVERRIDE;
- virtual void unregisterScopedHTMLStyleChild() OVERRIDE;
+ void registerScopedHTMLStyleChild();
+ void unregisterScopedHTMLStyleChild();
bool containsShadowElements() const;
bool containsContentElements() const;
// For Internals, don't use this.
unsigned childShadowRootCount() const;
+ unsigned numberOfStyles() const { return m_numberOfStyles; }
HTMLShadowElement* shadowInsertionPointOfYoungerShadowRoot() const;
- void setShadowInsertionPointOfYoungerShadowRoot(PassRefPtr<HTMLShadowElement>);
+ void setShadowInsertionPointOfYoungerShadowRoot(PassRefPtrWillBeRawPtr<HTMLShadowElement>);
void didAddInsertionPoint(InsertionPoint*);
void didRemoveInsertionPoint(InsertionPoint*);
- const Vector<RefPtr<InsertionPoint> >& descendantInsertionPoints();
+ const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint> >& descendantInsertionPoints();
ShadowRootType type() const { return static_cast<ShadowRootType>(m_type); }
public:
Element* activeElement() const;
- bool applyAuthorStyles() const { return m_applyAuthorStyles; }
- void setApplyAuthorStyles(bool);
-
- bool resetStyleInheritance() const { return m_resetStyleInheritance; }
- void setResetStyleInheritance(bool);
-
ShadowRoot* olderShadowRoot() const { return next(); }
String innerHTML() const;
void setInnerHTML(const String&, ExceptionState&);
- PassRefPtr<Node> cloneNode(bool, ExceptionState&);
- PassRefPtr<Node> cloneNode(ExceptionState& exceptionState) { return cloneNode(true, exceptionState); }
+ PassRefPtrWillBeRawPtr<Node> cloneNode(bool, ExceptionState&);
+ PassRefPtrWillBeRawPtr<Node> cloneNode(ExceptionState& exceptionState) { return cloneNode(true, exceptionState); }
StyleSheetList* styleSheets();
- bool isActiveForStyling() const;
+
+ virtual void trace(Visitor*) override;
private:
ShadowRoot(Document&, ShadowRootType);
virtual ~ShadowRoot();
- virtual void dispose() OVERRIDE;
- virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) OVERRIDE;
+#if !ENABLE(OILPAN)
+ virtual void dispose() override;
+#endif
+
+ virtual void childrenChanged(const ChildrenChange&) override;
ShadowRootRareData* ensureShadowRootRareData();
void invalidateDescendantInsertionPoints();
// ShadowRoots should never be cloned.
- virtual PassRefPtr<Node> cloneNode(bool) OVERRIDE { return 0; }
+ virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool) override { return nullptr; }
// FIXME: This shouldn't happen. https://bugs.webkit.org/show_bug.cgi?id=88834
bool isOrphan() const { return !host(); }
- ShadowRoot* m_prev;
- ShadowRoot* m_next;
- OwnPtr<ShadowRootRareData> m_shadowRootRareData;
+ RawPtrWillBeMember<ShadowRoot> m_prev;
+ RawPtrWillBeMember<ShadowRoot> m_next;
+ OwnPtrWillBeMember<ShadowRootRareData> m_shadowRootRareData;
unsigned m_numberOfStyles : 27;
- unsigned m_applyAuthorStyles : 1;
- unsigned m_resetStyleInheritance : 1;
unsigned m_type : 1;
unsigned m_registeredWithParentShadowRoot : 1;
unsigned m_descendantInsertionPointsIsValid : 1;
DEFINE_NODE_TYPE_CASTS(ShadowRoot, isShadowRoot());
DEFINE_TYPE_CASTS(ShadowRoot, TreeScope, treeScope, treeScope->rootNode().isShadowRoot(), treeScope.rootNode().isShadowRoot());
+DEFINE_TYPE_CASTS(TreeScope, ShadowRoot, shadowRoot, true, true);
-} // namespace
+} // namespace blink
-#endif
+#endif // ShadowRoot_h