Changeset 152197 in webkit


Ignore:
Timestamp:
Jun 28, 2013 5:01:37 PM (11 years ago)
Author:
rniwa@webkit.org
Message:

Remove unused attachChildrenLazily method and make attach/detachChildren private
https://bugs.webkit.org/show_bug.cgi?id=118016

Reviewed by Darin Adler.

Merge https://chromium.googlesource.com/chromium/blink/+/009520dc31c9458e0cf71cf212fa5688c4ca68b0

No one should be manually trying to attach or detach all their children so there's
no reason for these methods to be public.

In doing this I realized that attachChildrenLazily is not used and can be removed.

I also realized that we were detaching all our children before the ShadowRoots which
is sad since the InsertionPoints will call detach() on them as well, and then when we
call ContainerNode::detach at the end of Element::detach we'll go detach them again!
This patch makes it so we only go through and detach them twice instead of three times.
In the future we should figure out a way to only do this once.

  • dom/ContainerNode.h:
  • dom/Element.cpp:

(WebCore::Element::detach):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r152196 r152197  
     12013-06-28  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Remove unused attachChildrenLazily method and make attach/detachChildren private
     4        https://bugs.webkit.org/show_bug.cgi?id=118016
     5
     6        Reviewed by Darin Adler.
     7
     8        Merge https://chromium.googlesource.com/chromium/blink/+/009520dc31c9458e0cf71cf212fa5688c4ca68b0
     9
     10        No one should be manually trying to attach or detach all their children so there's
     11        no reason for these methods to be public.
     12       
     13        In doing this I realized that attachChildrenLazily is not used and can be removed.
     14       
     15        I also realized that we were detaching all our children before the ShadowRoots which
     16        is sad since the InsertionPoints will call detach() on them as well, and then when we
     17        call ContainerNode::detach at the end of Element::detach we'll go detach them again!
     18        This patch makes it so we only go through and detach them twice instead of three times.
     19        In the future we should figure out a way to only do this once.
     20
     21        * dom/ContainerNode.h:
     22        * dom/Element.cpp:
     23        (WebCore::Element::detach):
     24
    1252013-06-28  Alexey Proskuryakov  <ap@apple.com>
    226
  • trunk/Source/WebCore/dom/ContainerNode.h

    r151839 r152197  
    119119    virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
    120120
    121     void attachChildren(const AttachContext& = AttachContext());
    122     void attachChildrenLazily();
    123     void detachChildren(const AttachContext& = AttachContext());
    124     void detachChildrenIfNeeded(const AttachContext& = AttachContext());
    125 
    126121    void disconnectDescendantFrames();
    127122
     
    147142    void removeBetween(Node* previousChild, Node* nextChild, Node* oldChild);
    148143    void insertBeforeCommon(Node* nextChild, Node* oldChild);
     144
     145    void attachChildren(const AttachContext& = AttachContext());
     146    void detachChildren(const AttachContext& = AttachContext());
    149147
    150148    static void dispatchPostAttachCallbacks();
     
    194192        if (!child->attached())
    195193            child->attach(childrenContext);
    196     }
    197 }
    198 
    199 inline void ContainerNode::attachChildrenLazily()
    200 {
    201     for (Node* child = firstChild(); child; child = child->nextSibling())
    202         if (!child->attached())
    203             child->lazyAttach();
    204 }
    205 
    206 inline void ContainerNode::detachChildrenIfNeeded(const AttachContext& context)
    207 {
    208     AttachContext childrenContext(context);
    209     childrenContext.resolvedStyle = 0;
    210 
    211     for (Node* child = firstChild(); child; child = child->nextSibling()) {
    212         if (child->attached())
    213             child->detach(childrenContext);
    214194    }
    215195}
  • trunk/Source/WebCore/dom/Element.cpp

    r152088 r152197  
    14791479    }
    14801480
    1481     if (ElementShadow* shadow = this->shadow()) {
    1482         detachChildrenIfNeeded(context);
     1481    if (ElementShadow* shadow = this->shadow())
    14831482        shadow->detach(context);
    1484     }
    14851483
    14861484    // Do not remove the element's hovered and active status
Note: See TracChangeset for help on using the changeset viewer.