Title: [150010] trunk/Source
Revision
150010
Author
[email protected]
Date
2013-05-13 07:26:27 -0700 (Mon, 13 May 2013)

Log Message

Remove unneeded counters from ScopeContentDistribution.
https://bugs.webkit.org/show_bug.cgi?id=116028

Reviewed by Andreas Kling.

They don't do much.

* WebCore.exp.in:
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::ShadowRoot):
* dom/ShadowRoot.h:
        
    No need for registration code anymore.

* html/shadow/ContentDistributor.cpp:
(WebCore::ScopeContentDistribution::ScopeContentDistribution):
        
    Default m_insertionPointListIsValid to true to avoid crawling when there are no InsertionPoints.

(WebCore::ScopeContentDistribution::ensureInsertionPointList):
(WebCore::ScopeContentDistribution::registerInsertionPoint):
(WebCore::ScopeContentDistribution::unregisterInsertionPoint):
* html/shadow/ContentDistributor.h:
        
    Remove distributeNodeChildrenTo, it was only used by the older/younger shadow root code.

* testing/Internals.cpp:
* testing/Internals.h:
* testing/Internals.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150009 => 150010)


--- trunk/Source/WebCore/ChangeLog	2013-05-13 14:03:57 UTC (rev 150009)
+++ trunk/Source/WebCore/ChangeLog	2013-05-13 14:26:27 UTC (rev 150010)
@@ -1,3 +1,35 @@
+2013-05-13  Antti Koivisto  <[email protected]>
+
+        Remove unneeded counters from ScopeContentDistribution.
+        https://bugs.webkit.org/show_bug.cgi?id=116028
+
+        Reviewed by Andreas Kling.
+
+        They don't do much.
+
+        * WebCore.exp.in:
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::ShadowRoot):
+        * dom/ShadowRoot.h:
+        
+            No need for registration code anymore.
+
+        * html/shadow/ContentDistributor.cpp:
+        (WebCore::ScopeContentDistribution::ScopeContentDistribution):
+        
+            Default m_insertionPointListIsValid to true to avoid crawling when there are no InsertionPoints.
+
+        (WebCore::ScopeContentDistribution::ensureInsertionPointList):
+        (WebCore::ScopeContentDistribution::registerInsertionPoint):
+        (WebCore::ScopeContentDistribution::unregisterInsertionPoint):
+        * html/shadow/ContentDistributor.h:
+        
+            Remove distributeNodeChildrenTo, it was only used by the older/younger shadow root code.
+
+        * testing/Internals.cpp:
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2013-05-13  Seokju Kwon  <[email protected]>
 
         Web Inspector: Remove unused references from projects in Visual Studio

Modified: trunk/Source/WebCore/WebCore.exp.in (150009 => 150010)


--- trunk/Source/WebCore/WebCore.exp.in	2013-05-13 14:03:57 UTC (rev 150009)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-05-13 14:26:27 UTC (rev 150010)
@@ -769,8 +769,6 @@
 __ZN7WebCore24FrameDestructionObserver14willDetachPageEv
 __ZN7WebCore24FrameDestructionObserverC2EPNS_5FrameE
 __ZN7WebCore24FrameDestructionObserverD2Ev
-__ZN7WebCore24ScopeContentDistribution17hasContentElementEPKNS_10ShadowRootE
-__ZN7WebCore24ScopeContentDistribution18countElementShadowEPKNS_10ShadowRootE
 __ZN7WebCore24createFragmentFromMarkupEPNS_8DocumentERKN3WTF6StringES5_NS_19ParserContentPolicyE
 __ZN7WebCore24decodeURLEscapeSequencesERKN3WTF6StringE
 __ZN7WebCore24deleteCookiesForHostnameERKNS_21NetworkStorageSessionERKN3WTF6StringE

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (150009 => 150010)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2013-05-13 14:03:57 UTC (rev 150009)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2013-05-13 14:26:27 UTC (rev 150010)
@@ -58,7 +58,6 @@
     , m_applyAuthorStyles(false)
     , m_resetStyleInheritance(false)
     , m_type(type)
-    , m_registeredWithParentShadowRoot(false)
 {
     ASSERT(document);
 }
@@ -175,42 +174,6 @@
     styleResolver->popParentShadowRoot(this);
 }
 
-Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* insertionPoint)
-{
-    DocumentFragment::insertedInto(insertionPoint);
-
-    if (!insertionPoint->inDocument())
-        return InsertionDone;
-
-    // FIXME: When parsing <video controls>, insertedInto() is called many times without invoking removedFrom.
-    // For now, we check m_registeredWithParentShadowroot. We would like to ASSERT(!m_registeredShadowRoot) here.
-    // https://bugs.webkit.org/show_bug.cig?id=101316
-    if (m_registeredWithParentShadowRoot)
-        return InsertionDone;
-
-    if (ShadowRoot* root = host()->containingShadowRoot()) {
-        root->ensureScopeDistribution()->registerElementShadow();
-        m_registeredWithParentShadowRoot = true;
-    }
-
-    return InsertionDone;
-}
-
-void ShadowRoot::removedFrom(ContainerNode* insertionPoint)
-{
-    if (insertionPoint->inDocument() && m_registeredWithParentShadowRoot) {
-        ShadowRoot* root = host()->containingShadowRoot();
-        if (!root)
-            root = insertionPoint->containingShadowRoot();
-
-        if (root && root->scopeDistribution())
-            root->scopeDistribution()->unregisterElementShadow();
-        m_registeredWithParentShadowRoot = false;
-    }
-
-    DocumentFragment::removedFrom(insertionPoint);
-}
-
 void ShadowRoot::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
     if (isOrphan())

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (150009 => 150010)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2013-05-13 14:03:57 UTC (rev 150009)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2013-05-13 14:26:27 UTC (rev 150010)
@@ -74,9 +74,6 @@
 
     virtual void attach();
 
-    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
-    virtual void removedFrom(ContainerNode*) OVERRIDE;
-
     virtual void registerScopedHTMLStyleChild() OVERRIDE;
     virtual void unregisterScopedHTMLStyleChild() OVERRIDE;
 
@@ -106,7 +103,6 @@
     unsigned m_applyAuthorStyles : 1;
     unsigned m_resetStyleInheritance : 1;
     unsigned m_type : 1;
-    unsigned m_registeredWithParentShadowRoot : 1;
 };
 
 inline Element* ShadowRoot::activeElement() const

Modified: trunk/Source/WebCore/html/shadow/ContentDistributor.cpp (150009 => 150010)


--- trunk/Source/WebCore/html/shadow/ContentDistributor.cpp	2013-05-13 14:03:57 UTC (rev 150009)
+++ trunk/Source/WebCore/html/shadow/ContentDistributor.cpp	2013-05-13 14:26:27 UTC (rev 150010)
@@ -75,9 +75,7 @@
 
 
 ScopeContentDistribution::ScopeContentDistribution()
-    : m_numberOfContentElementChildren(0)
-    , m_numberOfElementShadowChildren(0)
-    , m_insertionPointListIsValid(false)
+    : m_insertionPointListIsValid(true)
 {
 }
 
@@ -95,9 +93,6 @@
     m_insertionPointListIsValid = true;
     ASSERT(m_insertionPointList.isEmpty());
 
-    if (!hasInsertionPoint(shadowRoot))
-        return m_insertionPointList;
-
     for (Element* element = ElementTraversal::firstWithin(shadowRoot); element; element = ElementTraversal::next(element, shadowRoot)) {
         if (element->isInsertionPoint())
             m_insertionPointList.append(toInsertionPoint(element));
@@ -106,50 +101,16 @@
     return m_insertionPointList;
 }
 
-void ScopeContentDistribution::registerInsertionPoint(InsertionPoint* point)
+void ScopeContentDistribution::registerInsertionPoint(InsertionPoint*)
 {
-    switch (point->insertionPointType()) {
-    case InsertionPoint::ContentInsertionPoint:
-        ++m_numberOfContentElementChildren;
-        break;
-    }
-
     invalidateInsertionPointList();
 }
 
-void ScopeContentDistribution::unregisterInsertionPoint(InsertionPoint* point)
+void ScopeContentDistribution::unregisterInsertionPoint(InsertionPoint*)
 {
-    switch (point->insertionPointType()) {
-    case InsertionPoint::ContentInsertionPoint:
-        ASSERT(m_numberOfContentElementChildren > 0);
-        --m_numberOfContentElementChildren;
-        break;
-    }
-
     invalidateInsertionPointList();
 }
 
-bool ScopeContentDistribution::hasContentElement(const ShadowRoot* holder)
-{
-    if (!holder->scopeDistribution())
-        return false;
-
-    return holder->scopeDistribution()->hasContentElementChildren();
-}
-
-unsigned ScopeContentDistribution::countElementShadow(const ShadowRoot* holder)
-{
-    if (!holder->scopeDistribution())
-        return 0;
-
-    return holder->scopeDistribution()->numberOfElementShadowChildren();
-}
-
-bool ScopeContentDistribution::hasInsertionPoint(const ShadowRoot* holder)
-{
-    return hasContentElement(holder);
-}
-
 ContentDistributor::ContentDistributor()
     : m_validity(Undetermined)
 {
@@ -261,34 +222,6 @@
     insertionPoint->setDistribution(distribution);
 }
 
-void ContentDistributor::distributeNodeChildrenTo(InsertionPoint* insertionPoint, ContainerNode* containerNode)
-{
-    ContentDistribution distribution;
-    for (Node* node = containerNode->firstChild(); node; node = node->nextSibling()) {
-        if (isActiveInsertionPoint(node)) {
-            InsertionPoint* innerInsertionPoint = toInsertionPoint(node);
-            if (innerInsertionPoint->hasDistribution()) {
-                for (size_t i = 0; i < innerInsertionPoint->size(); ++i) {
-                    distribution.append(innerInsertionPoint->at(i));
-                    if (!m_nodeToInsertionPoint.contains(innerInsertionPoint->at(i)))
-                        m_nodeToInsertionPoint.add(innerInsertionPoint->at(i), insertionPoint);
-                }
-            } else {
-                for (Node* child = innerInsertionPoint->firstChild(); child; child = child->nextSibling()) {
-                    distribution.append(child);
-                    m_nodeToInsertionPoint.add(child, insertionPoint);
-                }
-            }
-        } else {
-            distribution.append(node);
-            if (!m_nodeToInsertionPoint.contains(node))
-                m_nodeToInsertionPoint.add(node, insertionPoint);
-        }
-    }
-
-    insertionPoint->setDistribution(distribution);
-}
-
 void ContentDistributor::ensureDistribution(ShadowRoot* shadowRoot)
 {
     ASSERT(shadowRoot);

Modified: trunk/Source/WebCore/html/shadow/ContentDistributor.h (150009 => 150010)


--- trunk/Source/WebCore/html/shadow/ContentDistributor.h	2013-05-13 14:03:57 UTC (rev 150009)
+++ trunk/Source/WebCore/html/shadow/ContentDistributor.h	2013-05-13 14:26:27 UTC (rev 150010)
@@ -76,26 +76,11 @@
 
     void registerInsertionPoint(InsertionPoint*);
     void unregisterInsertionPoint(InsertionPoint*);
-    bool hasContentElementChildren() const { return m_numberOfContentElementChildren > 0; }
 
-    void registerElementShadow() { ++m_numberOfElementShadowChildren; }
-    void unregisterElementShadow() { ASSERT(m_numberOfElementShadowChildren > 0); --m_numberOfElementShadowChildren; }
-    unsigned numberOfElementShadowChildren() const { return m_numberOfElementShadowChildren; }
-    bool hasElementShadowChildren() const { return m_numberOfElementShadowChildren > 0; }
-
     void invalidateInsertionPointList();
     const Vector<RefPtr<InsertionPoint> >& ensureInsertionPointList(ShadowRoot*);
 
-    bool isUsedForRendering() const;
-
-    static bool hasContentElement(const ShadowRoot*);
-    static bool hasInsertionPoint(const ShadowRoot*);
-    static bool hasElementShadow(const ShadowRoot* holder) { return countElementShadow(holder); }
-    static unsigned countElementShadow(const ShadowRoot*);
-
 private:
-    unsigned m_numberOfContentElementChildren;
-    unsigned m_numberOfElementShadowChildren;
     bool m_insertionPointListIsValid;
     Vector<RefPtr<InsertionPoint> > m_insertionPointList;
 };
@@ -116,7 +101,6 @@
     InsertionPoint* findInsertionPointFor(const Node* key) const;
 
     void distributeSelectionsTo(InsertionPoint*, const ContentDistribution& pool, Vector<bool>& distributed);
-    void distributeNodeChildrenTo(InsertionPoint*, ContainerNode*);
 
     void invalidateDistribution(Element* host);
     void didShadowBoundaryChange(Element* host);

Modified: trunk/Source/WebCore/testing/Internals.cpp (150009 => 150010)


--- trunk/Source/WebCore/testing/Internals.cpp	2013-05-13 14:03:57 UTC (rev 150009)
+++ trunk/Source/WebCore/testing/Internals.cpp	2013-05-13 14:26:27 UTC (rev 150010)
@@ -513,25 +513,6 @@
     return frame()->animation()->pauseTransitionAtTime(pseudoElement->renderer(), property, pauseTime);
 }
 
-bool Internals::hasContentElement(const Node* root, ExceptionCode& ec) const
-{
-    if (root && root->isShadowRoot())
-        return ScopeContentDistribution::hasContentElement(toShadowRoot(root));
-
-    ec = INVALID_ACCESS_ERR;
-    return 0;
-}
-
-size_t Internals::countElementShadow(const Node* root, ExceptionCode& ec) const
-{
-    if (!root || !root->isShadowRoot()) {
-        ec = INVALID_ACCESS_ERR;
-        return 0;
-    }
-
-    return ScopeContentDistribution::countElementShadow(toShadowRoot(root));
-}
-
 bool Internals::attached(Node* node, ExceptionCode& ec)
 {
     if (!node) {

Modified: trunk/Source/WebCore/testing/Internals.h (150009 => 150010)


--- trunk/Source/WebCore/testing/Internals.h	2013-05-13 14:03:57 UTC (rev 150009)
+++ trunk/Source/WebCore/testing/Internals.h	2013-05-13 14:26:27 UTC (rev 150010)
@@ -90,8 +90,6 @@
     ShadowRootIfShadowDOMEnabledOrNode* createShadowRoot(Element* host, ExceptionCode&);
     ShadowRootIfShadowDOMEnabledOrNode* shadowRoot(Element* host, ExceptionCode&);
     String shadowRootType(const Node*, ExceptionCode&) const;
-    bool hasContentElement(const Node*, ExceptionCode&) const;
-    size_t countElementShadow(const Node*, ExceptionCode&) const;
     Element* includerFor(Node*, ExceptionCode&);
     String shadowPseudoId(Element*, ExceptionCode&);
     void setShadowPseudoId(Element*, const String&, ExceptionCode&);

Modified: trunk/Source/WebCore/testing/Internals.idl (150009 => 150010)


--- trunk/Source/WebCore/testing/Internals.idl	2013-05-13 14:03:57 UTC (rev 150009)
+++ trunk/Source/WebCore/testing/Internals.idl	2013-05-13 14:26:27 UTC (rev 150010)
@@ -47,8 +47,6 @@
     Node shadowRoot(Element host) raises (DOMException);
 #endif
     DOMString shadowRootType(Node root) raises (DOMException);
-    boolean hasContentElement(Node root) raises (DOMException);
-    unsigned long countElementShadow(Node Root) raises (DOMException);
     Element includerFor(Node node) raises (DOMException);
     DOMString shadowPseudoId(Element element) raises (DOMException);
     void setShadowPseudoId(Element element, DOMString id) raises (DOMException);

Modified: trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in (150009 => 150010)


--- trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in	2013-05-13 14:03:57 UTC (rev 150009)
+++ trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in	2013-05-13 14:26:27 UTC (rev 150010)
@@ -394,8 +394,6 @@
         ?pseudoElement@Element@WebCore@@QBEPAVPseudoElement@2@W4PseudoId@2@@Z
         ?pauseTransitionAtTime@AnimationController@WebCore@@QAE_NPAVRenderObject@2@ABVString@WTF@@N@Z
         ?addFromLiteralData@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBDI@Z
-        ?hasContentElement@ScopeContentDistribution@WebCore@@SA_NPBVShadowRoot@2@@Z
-        ?countElementShadow@ScopeContentDistribution@WebCore@@SAIPBVShadowRoot@2@@Z
         ?memoryCache@WebCore@@YAPAVMemoryCache@1@XZ
         ?resourceForURL@MemoryCache@WebCore@@QAEPAVCachedResource@2@ABVKURL@2@@Z
         ?nonFastScrollableRects@Page@WebCore@@QAE?AV?$PassRefPtr@VClientRectList@WebCore@@@WTF@@PBVFrame@2@@Z
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to