Changeset 154957 in webkit


Ignore:
Timestamp:
Sep 2, 2013 8:17:50 AM (11 years ago)
Author:
Antti Koivisto
Message:

Clean up ContainerNode::childrenChanged
https://bugs.webkit.org/show_bug.cgi?id=120599

Reviewed by Andreas Kling.

  • Make childrenChanged take a single struct argument instead of a long list of arguments.
  • Use enum instead of childCountDelta. It was always -1, 0, 1 or the total number of children (in case of removing them all).
  • Remove use of Node*, give the change range as Elements.
  • Related cleanups.
  • dom/Attr.cpp:

(WebCore::Attr::childrenChanged):

  • dom/Attr.h:
  • dom/CharacterData.cpp:

(WebCore::CharacterData::parserAppendData):
(WebCore::CharacterData::dispatchModifiedEvent):

  • dom/ContainerNode.cpp:

(WebCore::ContainerNode::insertBefore):
(WebCore::ContainerNode::notifyChildInserted):
(WebCore::ContainerNode::notifyChildRemoved):

Add private helpers for setting up the struct.

(WebCore::ContainerNode::parserInsertBefore):
(WebCore::ContainerNode::replaceChild):
(WebCore::ContainerNode::removeChild):
(WebCore::ContainerNode::parserRemoveChild):
(WebCore::ContainerNode::removeChildren):
(WebCore::ContainerNode::appendChild):
(WebCore::ContainerNode::parserAppendChild):
(WebCore::ContainerNode::childrenChanged):
(WebCore::ContainerNode::updateTreeAfterInsertion):

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

(WebCore::Document::childrenChanged):

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

(WebCore::checkForSiblingStyleChanges):

Clean up and simplify. Since we now get element range automatically we don't need to compute it.

(WebCore::Element::childrenChanged):
(WebCore::Element::finishParsingChildren):

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

(WebCore::ShadowRoot::childrenChanged):

  • dom/ShadowRoot.h:
  • html/HTMLElement.cpp:

(WebCore::HTMLElement::childrenChanged):
(WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged):

Try to keep the existing behavior. This code needs more cleanup to be sane. It shouldn't operate on Nodes
as it only really cares about Elements.

  • html/HTMLElement.h:
  • html/HTMLFieldSetElement.cpp:

(WebCore::HTMLFieldSetElement::childrenChanged):

  • html/HTMLFieldSetElement.h:
  • html/HTMLObjectElement.cpp:

(WebCore::HTMLObjectElement::childrenChanged):

  • html/HTMLObjectElement.h:
  • html/HTMLOptGroupElement.cpp:

(WebCore::HTMLOptGroupElement::childrenChanged):

  • html/HTMLOptGroupElement.h:
  • html/HTMLOptionElement.cpp:

(WebCore::HTMLOptionElement::childrenChanged):

  • html/HTMLOptionElement.h:
  • html/HTMLOutputElement.cpp:

(WebCore::HTMLOutputElement::childrenChanged):

  • html/HTMLOutputElement.h:
  • html/HTMLScriptElement.cpp:

(WebCore::HTMLScriptElement::childrenChanged):

  • html/HTMLScriptElement.h:
  • html/HTMLSelectElement.cpp:

(WebCore::HTMLSelectElement::childrenChanged):

  • html/HTMLSelectElement.h:
  • html/HTMLStyleElement.cpp:

(WebCore::HTMLStyleElement::childrenChanged):

  • html/HTMLStyleElement.h:
  • html/HTMLTextAreaElement.cpp:

(WebCore::HTMLTextAreaElement::childrenChanged):

  • html/HTMLTextAreaElement.h:
  • html/HTMLTitleElement.cpp:

(WebCore::HTMLTitleElement::childrenChanged):

  • html/HTMLTitleElement.h:
  • html/shadow/InsertionPoint.cpp:

(WebCore::InsertionPoint::childrenChanged):

  • html/shadow/InsertionPoint.h:
  • svg/SVGClipPathElement.cpp:

(WebCore::SVGClipPathElement::childrenChanged):

  • svg/SVGClipPathElement.h:
  • svg/SVGElement.cpp:

(WebCore::SVGElement::childrenChanged):

  • svg/SVGElement.h:
  • svg/SVGFELightElement.cpp:

(WebCore::SVGFELightElement::childrenChanged):

  • svg/SVGFELightElement.h:
  • svg/SVGFilterElement.cpp:

(WebCore::SVGFilterElement::childrenChanged):

  • svg/SVGFilterElement.h:
  • svg/SVGFilterPrimitiveStandardAttributes.cpp:

(WebCore::SVGFilterPrimitiveStandardAttributes::childrenChanged):

  • svg/SVGFilterPrimitiveStandardAttributes.h:
  • svg/SVGFontFaceElement.cpp:

(WebCore::SVGFontFaceElement::childrenChanged):

  • svg/SVGFontFaceElement.h:
  • svg/SVGFontFaceFormatElement.cpp:

(WebCore::SVGFontFaceFormatElement::childrenChanged):

  • svg/SVGFontFaceFormatElement.h:
  • svg/SVGFontFaceSrcElement.cpp:

(WebCore::SVGFontFaceSrcElement::childrenChanged):

  • svg/SVGFontFaceSrcElement.h:
  • svg/SVGFontFaceUriElement.cpp:

(WebCore::SVGFontFaceUriElement::childrenChanged):

  • svg/SVGFontFaceUriElement.h:
  • svg/SVGGradientElement.cpp:

(WebCore::SVGGradientElement::childrenChanged):

  • svg/SVGGradientElement.h:
  • svg/SVGMarkerElement.cpp:

(WebCore::SVGMarkerElement::childrenChanged):

  • svg/SVGMarkerElement.h:
  • svg/SVGMaskElement.cpp:

(WebCore::SVGMaskElement::childrenChanged):

  • svg/SVGMaskElement.h:
  • svg/SVGPatternElement.cpp:

(WebCore::SVGPatternElement::childrenChanged):

  • svg/SVGPatternElement.h:
  • svg/SVGScriptElement.cpp:

(WebCore::SVGScriptElement::childrenChanged):

  • svg/SVGScriptElement.h:
  • svg/SVGStyleElement.cpp:

(WebCore::SVGStyleElement::childrenChanged):

  • svg/SVGStyleElement.h:
  • svg/SVGTitleElement.cpp:

(WebCore::SVGTitleElement::childrenChanged):

  • svg/SVGTitleElement.h:
Location:
trunk/Source/WebCore
Files:
68 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r154955 r154957  
     12013-09-02  Antti Koivisto  <antti@apple.com>
     2
     3        Clean up ContainerNode::childrenChanged
     4        https://bugs.webkit.org/show_bug.cgi?id=120599
     5
     6        Reviewed by Andreas Kling.
     7
     8        - Make childrenChanged take a single struct argument instead of a long list of arguments.
     9        - Use enum instead of childCountDelta. It was always -1, 0, 1 or the total number of children (in case of removing them all).
     10        - Remove use of Node*, give the change range as Elements.
     11        - Related cleanups.
     12
     13        * dom/Attr.cpp:
     14        (WebCore::Attr::childrenChanged):
     15        * dom/Attr.h:
     16        * dom/CharacterData.cpp:
     17        (WebCore::CharacterData::parserAppendData):
     18        (WebCore::CharacterData::dispatchModifiedEvent):
     19        * dom/ContainerNode.cpp:
     20        (WebCore::ContainerNode::insertBefore):
     21        (WebCore::ContainerNode::notifyChildInserted):
     22        (WebCore::ContainerNode::notifyChildRemoved):
     23       
     24            Add private helpers for setting up the struct.
     25
     26        (WebCore::ContainerNode::parserInsertBefore):
     27        (WebCore::ContainerNode::replaceChild):
     28        (WebCore::ContainerNode::removeChild):
     29        (WebCore::ContainerNode::parserRemoveChild):
     30        (WebCore::ContainerNode::removeChildren):
     31        (WebCore::ContainerNode::appendChild):
     32        (WebCore::ContainerNode::parserAppendChild):
     33        (WebCore::ContainerNode::childrenChanged):
     34        (WebCore::ContainerNode::updateTreeAfterInsertion):
     35        * dom/ContainerNode.h:
     36        * dom/Document.cpp:
     37        (WebCore::Document::childrenChanged):
     38        * dom/Document.h:
     39        * dom/Element.cpp:
     40        (WebCore::checkForSiblingStyleChanges):
     41       
     42            Clean up and simplify. Since we now get element range automatically we don't need to compute it.
     43
     44        (WebCore::Element::childrenChanged):
     45        (WebCore::Element::finishParsingChildren):
     46        * dom/Element.h:
     47        * dom/ShadowRoot.cpp:
     48        (WebCore::ShadowRoot::childrenChanged):
     49        * dom/ShadowRoot.h:
     50        * html/HTMLElement.cpp:
     51        (WebCore::HTMLElement::childrenChanged):
     52        (WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged):
     53       
     54            Try to keep the existing behavior. This code needs  more cleanup to be sane. It shouldn't operate on Nodes
     55            as it only really cares about Elements.
     56
     57        * html/HTMLElement.h:
     58        * html/HTMLFieldSetElement.cpp:
     59        (WebCore::HTMLFieldSetElement::childrenChanged):
     60        * html/HTMLFieldSetElement.h:
     61        * html/HTMLObjectElement.cpp:
     62        (WebCore::HTMLObjectElement::childrenChanged):
     63        * html/HTMLObjectElement.h:
     64        * html/HTMLOptGroupElement.cpp:
     65        (WebCore::HTMLOptGroupElement::childrenChanged):
     66        * html/HTMLOptGroupElement.h:
     67        * html/HTMLOptionElement.cpp:
     68        (WebCore::HTMLOptionElement::childrenChanged):
     69        * html/HTMLOptionElement.h:
     70        * html/HTMLOutputElement.cpp:
     71        (WebCore::HTMLOutputElement::childrenChanged):
     72        * html/HTMLOutputElement.h:
     73        * html/HTMLScriptElement.cpp:
     74        (WebCore::HTMLScriptElement::childrenChanged):
     75        * html/HTMLScriptElement.h:
     76        * html/HTMLSelectElement.cpp:
     77        (WebCore::HTMLSelectElement::childrenChanged):
     78        * html/HTMLSelectElement.h:
     79        * html/HTMLStyleElement.cpp:
     80        (WebCore::HTMLStyleElement::childrenChanged):
     81        * html/HTMLStyleElement.h:
     82        * html/HTMLTextAreaElement.cpp:
     83        (WebCore::HTMLTextAreaElement::childrenChanged):
     84        * html/HTMLTextAreaElement.h:
     85        * html/HTMLTitleElement.cpp:
     86        (WebCore::HTMLTitleElement::childrenChanged):
     87        * html/HTMLTitleElement.h:
     88        * html/shadow/InsertionPoint.cpp:
     89        (WebCore::InsertionPoint::childrenChanged):
     90        * html/shadow/InsertionPoint.h:
     91        * svg/SVGClipPathElement.cpp:
     92        (WebCore::SVGClipPathElement::childrenChanged):
     93        * svg/SVGClipPathElement.h:
     94        * svg/SVGElement.cpp:
     95        (WebCore::SVGElement::childrenChanged):
     96        * svg/SVGElement.h:
     97        * svg/SVGFELightElement.cpp:
     98        (WebCore::SVGFELightElement::childrenChanged):
     99        * svg/SVGFELightElement.h:
     100        * svg/SVGFilterElement.cpp:
     101        (WebCore::SVGFilterElement::childrenChanged):
     102        * svg/SVGFilterElement.h:
     103        * svg/SVGFilterPrimitiveStandardAttributes.cpp:
     104        (WebCore::SVGFilterPrimitiveStandardAttributes::childrenChanged):
     105        * svg/SVGFilterPrimitiveStandardAttributes.h:
     106        * svg/SVGFontFaceElement.cpp:
     107        (WebCore::SVGFontFaceElement::childrenChanged):
     108        * svg/SVGFontFaceElement.h:
     109        * svg/SVGFontFaceFormatElement.cpp:
     110        (WebCore::SVGFontFaceFormatElement::childrenChanged):
     111        * svg/SVGFontFaceFormatElement.h:
     112        * svg/SVGFontFaceSrcElement.cpp:
     113        (WebCore::SVGFontFaceSrcElement::childrenChanged):
     114        * svg/SVGFontFaceSrcElement.h:
     115        * svg/SVGFontFaceUriElement.cpp:
     116        (WebCore::SVGFontFaceUriElement::childrenChanged):
     117        * svg/SVGFontFaceUriElement.h:
     118        * svg/SVGGradientElement.cpp:
     119        (WebCore::SVGGradientElement::childrenChanged):
     120        * svg/SVGGradientElement.h:
     121        * svg/SVGMarkerElement.cpp:
     122        (WebCore::SVGMarkerElement::childrenChanged):
     123        * svg/SVGMarkerElement.h:
     124        * svg/SVGMaskElement.cpp:
     125        (WebCore::SVGMaskElement::childrenChanged):
     126        * svg/SVGMaskElement.h:
     127        * svg/SVGPatternElement.cpp:
     128        (WebCore::SVGPatternElement::childrenChanged):
     129        * svg/SVGPatternElement.h:
     130        * svg/SVGScriptElement.cpp:
     131        (WebCore::SVGScriptElement::childrenChanged):
     132        * svg/SVGScriptElement.h:
     133        * svg/SVGStyleElement.cpp:
     134        (WebCore::SVGStyleElement::childrenChanged):
     135        * svg/SVGStyleElement.h:
     136        * svg/SVGTitleElement.cpp:
     137        (WebCore::SVGTitleElement::childrenChanged):
     138        * svg/SVGTitleElement.h:
     139
    11402013-09-02  Andreas Kling  <akling@apple.com>
    2141
  • trunk/Source/WebCore/dom/Attr.cpp

    r154877 r154957  
    160160}
    161161
    162 void Attr::childrenChanged(bool, Node*, Node*, int)
     162void Attr::childrenChanged(const ChildChange&)
    163163{
    164164    if (m_ignoreChildrenChanged > 0)
  • trunk/Source/WebCore/dom/Attr.h

    r149974 r154957  
    8787    virtual bool childTypeAllowed(NodeType) const;
    8888
    89     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     89    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    9090
    9191    Attribute& elementAttribute();
  • trunk/Source/WebCore/dom/CharacterData.cpp

    r154877 r154957  
    2424
    2525#include "Document.h"
     26#include "ElementTraversal.h"
    2627#include "EventNames.h"
    2728#include "ExceptionCode.h"
     
    9798    // We don't call dispatchModifiedEvent here because we don't want the
    9899    // parser to dispatch DOM mutation events.
    99     if (parentNode())
    100         parentNode()->childrenChanged();
     100    if (parentNode()) {
     101        ContainerNode::ChildChange change = {
     102            ContainerNode::TextChanged,
     103            ElementTraversal::previousSibling(this),
     104            ElementTraversal::nextSibling(this),
     105            ContainerNode::ChildChangeSourceParser
     106        };
     107        parentNode()->childrenChanged(change);
     108    }
    101109
    102110    return characterLengthLimit;
     
    206214        mutationRecipients->enqueueMutationRecord(MutationRecord::createCharacterData(this, oldData));
    207215    if (!isInShadowTree()) {
    208         if (parentNode())
    209             parentNode()->childrenChanged();
     216        if (parentNode()) {
     217            ContainerNode::ChildChange change = {
     218                ContainerNode::TextChanged,
     219                ElementTraversal::previousSibling(this),
     220                ElementTraversal::nextSibling(this),
     221                ContainerNode::ChildChangeSourceAPI
     222            };
     223            parentNode()->childrenChanged(change);
     224        }
    210225        if (document().hasListenerType(Document::DOMCHARACTERDATAMODIFIED_LISTENER))
    211226            dispatchScopedEvent(MutationEvent::create(eventNames().DOMCharacterDataModifiedEvent, true, 0, oldData, m_data));
  • trunk/Source/WebCore/dom/ContainerNode.cpp

    r154903 r154957  
    3030#include "ContainerNodeAlgorithms.h"
    3131#include "Editor.h"
     32#include "ElementTraversal.h"
    3233#include "EventNames.h"
    3334#include "ExceptionCode.h"
     
    6768static void dispatchChildInsertionEvents(Node*);
    6869static void dispatchChildRemovalEvents(Node*);
    69 static void updateTreeAfterInsertion(ContainerNode*, Node*, AttachBehavior);
    7070
    7171typedef pair<RefPtr<Node>, unsigned> CallbackParameters;
     
    316316        insertBeforeCommon(next.get(), child);
    317317
    318         updateTreeAfterInsertion(this, child, attachBehavior);
     318        updateTreeAfterInsertion(child, attachBehavior);
    319319    }
    320320
     
    349349}
    350350
     351void ContainerNode::notifyChildInserted(Node* child, ChildChangeSource source)
     352{
     353    ChildChange change;
     354    change.type = child->isElementNode() ? ElementInserted : child->isTextNode() ? TextInserted : NonContentsChildChanged;
     355    change.previousSiblingElement =  ElementTraversal::previousSibling(child);
     356    change.nextSiblingElement = ElementTraversal::nextSibling(child);
     357    change.source = source;
     358
     359    childrenChanged(change);
     360}
     361
     362void ContainerNode::notifyChildRemoved(Node* child, Node* previousSibling, Node* nextSibling, ChildChangeSource source)
     363{
     364    ChildChange change;
     365    change.type = child->isElementNode() ? ElementRemoved : child->isTextNode() ? TextRemoved : NonContentsChildChanged;
     366    change.previousSiblingElement = (!previousSibling || previousSibling->isElementNode()) ? toElement(previousSibling) : ElementTraversal::previousSibling(previousSibling);
     367    change.nextSiblingElement = (!nextSibling || nextSibling->isElementNode()) ? toElement(nextSibling) : ElementTraversal::nextSibling(nextSibling);
     368    change.source = source;
     369
     370    childrenChanged(change);
     371}
     372
    351373void ContainerNode::parserInsertBefore(PassRefPtr<Node> newChild, Node* nextChild)
    352374{
     
    371393    ChildListMutationScope(this).childAdded(newChild.get());
    372394
    373     childrenChanged(true, newChild->previousSibling(), nextChild, 1);
     395    notifyChildInserted(newChild.get(), ChildChangeSourceParser);
     396
    374397    ChildNodeInsertionNotifier(this).notify(newChild.get());
    375398}
     
    455478        }
    456479
    457         updateTreeAfterInsertion(this, child, attachBehavior);
     480        updateTreeAfterInsertion(child, attachBehavior);
    458481    }
    459482
     
    549572        Node* next = child->nextSibling();
    550573        removeBetween(prev, next, child.get());
    551         childrenChanged(false, prev, next, -1);
     574
     575        notifyChildRemoved(child.get(), prev, next, ChildChangeSourceAPI);
     576
    552577        ChildNodeRemovalNotifier(this).notify(child.get());
    553578    }
     
    600625    removeBetween(prev, next, oldChild);
    601626
    602     childrenChanged(true, prev, next, -1);
     627    notifyChildRemoved(oldChild, prev, next, ChildChangeSourceParser);
     628
    603629    ChildNodeRemovalNotifier(this).notify(oldChild);
    604630}
     
    637663        }
    638664
    639         childrenChanged(false, 0, 0, -static_cast<int>(removedChildren.size()));
     665        ChildChange change = { AllChildrenRemoved, nullptr, nullptr, ChildChangeSourceAPI };
     666        childrenChanged(change);
    640667       
    641668        for (size_t i = 0; i < removedChildren.size(); ++i)
     
    696723        }
    697724
    698         updateTreeAfterInsertion(this, child, attachBehavior);
     725        updateTreeAfterInsertion(child, attachBehavior);
    699726    }
    700727
     
    715742        document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION);
    716743
    717     Node* last = m_lastChild;
    718744    {
    719745        NoEventDispatchAssertion assertNoEventDispatch;
     
    727753    ChildListMutationScope(this).childAdded(newChild.get());
    728754
    729     childrenChanged(true, last, 0, 1);
     755    notifyChildInserted(newChild.get(), ChildChangeSourceParser);
     756
    730757    ChildNodeInsertionNotifier(this).notify(newChild.get());
    731758}
     
    805832}
    806833
    807 void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int childCountDelta)
     834void ContainerNode::childrenChanged(const ChildChange& change)
    808835{
    809836    document().incDOMTreeVersion();
    810     if (!changedByParser && childCountDelta)
     837    if (change.source == ChildChangeSourceAPI && change.type != TextChanged)
    811838        document().updateRangesAfterChildrenChanged(this);
    812839    invalidateNodeListCachesInAncestors();
     
    10371064}
    10381065
    1039 static void updateTreeAfterInsertion(ContainerNode* parent, Node* child, AttachBehavior attachBehavior)
    1040 {
    1041     ASSERT(parent->refCount());
     1066void ContainerNode::updateTreeAfterInsertion(Node* child, AttachBehavior attachBehavior)
     1067{
    10421068    ASSERT(child->refCount());
    10431069
    1044     ChildListMutationScope(parent).childAdded(child);
    1045 
    1046     parent->childrenChanged(false, child->previousSibling(), child->nextSibling(), 1);
    1047 
    1048     ChildNodeInsertionNotifier(parent).notify(child);
     1070    ChildListMutationScope(this).childAdded(child);
     1071
     1072    notifyChildInserted(child, ChildChangeSourceAPI);
     1073
     1074    ChildNodeInsertionNotifier(this).notify(child);
    10491075
    10501076    // FIXME: Attachment should be the first operation in this function, but some code
    10511077    // (for example, HTMLFormControlElement's autofocus support) requires this ordering.
    1052     if (parent->attached() && !child->attached() && child->parentNode() == parent) {
     1078    if (attached() && !child->attached() && child->parentNode() == this) {
    10531079        if (attachBehavior == AttachLazily) {
    10541080            if (child->isElementNode())
  • trunk/Source/WebCore/dom/ContainerNode.h

    r154929 r154957  
    110110    virtual void scheduleSetNeedsStyleRecalc(StyleChangeType = FullStyleChange) OVERRIDE FINAL;
    111111
    112     // -----------------------------------------------------------------------------
    113     // Notification of document structure changes (see Node.h for more notification methods)
    114 
    115     // Notifies the node that it's list of children have changed (either by adding or removing child nodes), or a child
    116     // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE has changed its value.
    117     virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     112    enum ChildChangeType { ElementInserted, ElementRemoved, TextInserted, TextRemoved, TextChanged, AllChildrenRemoved, NonContentsChildChanged };
     113    enum ChildChangeSource { ChildChangeSourceParser, ChildChangeSourceAPI };
     114    struct ChildChange {
     115        ChildChangeType type;
     116        Element* previousSiblingElement;
     117        Element* nextSiblingElement;
     118        ChildChangeSource source;
     119    };
     120    virtual void childrenChanged(const ChildChange&);
    118121
    119122    void disconnectDescendantFrames();
     
    147150    bool getUpperLeftCorner(FloatPoint&) const;
    148151    bool getLowerRightCorner(FloatPoint&) const;
     152
     153    void notifyChildInserted(Node* child, ChildChangeSource);
     154    void notifyChildRemoved(Node* child, Node* previousSibling, Node* nextSibling, ChildChangeSource);
     155
     156    void updateTreeAfterInsertion(Node* child, AttachBehavior);
    149157
    150158    bool isContainerNode() const WTF_DELETED_FUNCTION;
  • trunk/Source/WebCore/dom/Document.cpp

    r154929 r154957  
    773773}
    774774
    775 void Document::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    776 {
    777     ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     775void Document::childrenChanged(const ChildChange& change)
     776{
     777    ContainerNode::childrenChanged(change);
    778778
    779779    Element* newDocumentElement = 0;
  • trunk/Source/WebCore/dom/Document.h

    r154877 r154957  
    12021202    virtual bool isDocument() const OVERRIDE { return true; }
    12031203
    1204     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     1204    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    12051205
    12061206    virtual String nodeName() const;
  • trunk/Source/WebCore/dom/Element.cpp

    r154903 r154957  
    15361536}
    15371537
    1538 static void checkForSiblingStyleChanges(Element* e, RenderStyle* style, bool finishedParsingCallback,
    1539                                         Node* beforeChange, Node* afterChange, int childCountDelta)
    1540 {
     1538enum SiblingCheckType { FinishedParsingChildren, SiblingElementRemoved, Other };
     1539
     1540static void checkForSiblingStyleChanges(Element* parent, SiblingCheckType checkType, Element* elementBeforeChange, Element* elementAfterChange)
     1541{
     1542    RenderStyle* style = parent->renderStyle();
    15411543    // :empty selector.
    1542     checkForEmptyStyleChange(e, style);
     1544    checkForEmptyStyleChange(parent, style);
    15431545   
    1544     if (!style || (e->needsStyleRecalc() && e->childrenAffectedByPositionalRules()))
     1546    if (!style || (parent->needsStyleRecalc() && parent->childrenAffectedByPositionalRules()))
    15451547        return;
    15461548
     
    15481550    // In the DOM case, we only need to do something if |afterChange| is not 0.
    15491551    // |afterChange| is 0 in the parser case, so it works out that we'll skip this block.
    1550     if (e->childrenAffectedByFirstChildRules() && afterChange) {
     1552    if (parent->childrenAffectedByFirstChildRules() && elementAfterChange) {
    15511553        // Find our new first child.
    1552         Node* newFirstChild = 0;
    1553         for (newFirstChild = e->firstChild(); newFirstChild && !newFirstChild->isElementNode(); newFirstChild = newFirstChild->nextSibling()) {};
    1554        
     1554        Element* newFirstElement = ElementTraversal::firstChild(parent);
    15551555        // Find the first element node following |afterChange|
    1556         Node* firstElementAfterInsertion = 0;
    1557         for (firstElementAfterInsertion = afterChange;
    1558              firstElementAfterInsertion && !firstElementAfterInsertion->isElementNode();
    1559              firstElementAfterInsertion = firstElementAfterInsertion->nextSibling()) {};
    1560        
     1556
    15611557        // This is the insert/append case.
    1562         if (newFirstChild != firstElementAfterInsertion && firstElementAfterInsertion && firstElementAfterInsertion->attached() &&
    1563             firstElementAfterInsertion->renderStyle() && firstElementAfterInsertion->renderStyle()->firstChildState())
    1564             firstElementAfterInsertion->setNeedsStyleRecalc();
     1558        if (newFirstElement != elementAfterChange && elementAfterChange->attached()
     1559            && elementAfterChange->renderStyle() && elementAfterChange->renderStyle()->firstChildState())
     1560            elementAfterChange->setNeedsStyleRecalc();
    15651561           
    15661562        // We also have to handle node removal.
    1567         if (childCountDelta < 0 && newFirstChild == firstElementAfterInsertion && newFirstChild && (!newFirstChild->renderStyle() || !newFirstChild->renderStyle()->firstChildState()))
    1568             newFirstChild->setNeedsStyleRecalc();
     1563        if (checkType == SiblingElementRemoved && newFirstElement == elementAfterChange && newFirstElement && (!newFirstElement->renderStyle() || !newFirstElement->renderStyle()->firstChildState()))
     1564            newFirstElement->setNeedsStyleRecalc();
    15691565    }
    15701566
    15711567    // :last-child.  In the parser callback case, we don't have to check anything, since we were right the first time.
    15721568    // In the DOM case, we only need to do something if |afterChange| is not 0.
    1573     if (e->childrenAffectedByLastChildRules() && beforeChange) {
     1569    if (parent->childrenAffectedByLastChildRules() && elementBeforeChange) {
    15741570        // Find our new last child.
    1575         Node* newLastChild = 0;
    1576         for (newLastChild = e->lastChild(); newLastChild && !newLastChild->isElementNode(); newLastChild = newLastChild->previousSibling()) {};
    1577        
    1578         // Find the last element node going backwards from |beforeChange|
    1579         Node* lastElementBeforeInsertion = 0;
    1580         for (lastElementBeforeInsertion = beforeChange;
    1581              lastElementBeforeInsertion && !lastElementBeforeInsertion->isElementNode();
    1582              lastElementBeforeInsertion = lastElementBeforeInsertion->previousSibling()) {};
    1583        
    1584         if (newLastChild != lastElementBeforeInsertion && lastElementBeforeInsertion && lastElementBeforeInsertion->attached() &&
    1585             lastElementBeforeInsertion->renderStyle() && lastElementBeforeInsertion->renderStyle()->lastChildState())
    1586             lastElementBeforeInsertion->setNeedsStyleRecalc();
     1571        Element* newLastElement = ElementTraversal::lastChild(parent);
     1572
     1573        if (newLastElement != elementBeforeChange && elementBeforeChange->attached()
     1574            && elementBeforeChange->renderStyle() && elementBeforeChange->renderStyle()->lastChildState())
     1575            elementBeforeChange->setNeedsStyleRecalc();
    15871576           
    15881577        // We also have to handle node removal.  The parser callback case is similar to node removal as well in that we need to change the last child
    15891578        // to match now.
    1590         if ((childCountDelta < 0 || finishedParsingCallback) && newLastChild == lastElementBeforeInsertion && newLastChild && (!newLastChild->renderStyle() || !newLastChild->renderStyle()->lastChildState()))
    1591             newLastChild->setNeedsStyleRecalc();
     1579        if ((checkType == SiblingElementRemoved || checkType == FinishedParsingChildren) && newLastElement == elementBeforeChange && newLastElement
     1580            && (!newLastElement->renderStyle() || !newLastElement->renderStyle()->lastChildState()))
     1581            newLastElement->setNeedsStyleRecalc();
    15921582    }
    15931583
    15941584    // The + selector.  We need to invalidate the first element following the insertion point.  It is the only possible element
    15951585    // that could be affected by this DOM change.
    1596     if (e->childrenAffectedByDirectAdjacentRules() && afterChange) {
    1597         Node* firstElementAfterInsertion = 0;
    1598         for (firstElementAfterInsertion = afterChange;
    1599              firstElementAfterInsertion && !firstElementAfterInsertion->isElementNode();
    1600              firstElementAfterInsertion = firstElementAfterInsertion->nextSibling()) {};
    1601         if (firstElementAfterInsertion && firstElementAfterInsertion->attached())
    1602             firstElementAfterInsertion->setNeedsStyleRecalc();
     1586    if (parent->childrenAffectedByDirectAdjacentRules() && elementAfterChange) {
     1587        if (elementAfterChange->attached())
     1588            elementAfterChange->setNeedsStyleRecalc();
    16031589    }
    16041590
     
    16101596    // For performance reasons we just mark the parent node as changed, since we don't want to make childrenChanged O(n^2) by crawling all our kids
    16111597    // here.  recalcStyle will then force a walk of the children when it sees that this has happened.
    1612     if ((e->childrenAffectedByForwardPositionalRules() && afterChange)
    1613         || (e->childrenAffectedByBackwardPositionalRules() && beforeChange))
    1614         e->setNeedsStyleRecalc();
    1615 }
    1616 
    1617 void Element::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    1618 {
    1619     ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
    1620     if (changedByParser)
     1598    if (parent->childrenAffectedByForwardPositionalRules() && elementAfterChange)
     1599        parent->setNeedsStyleRecalc();
     1600    if (parent->childrenAffectedByBackwardPositionalRules() && elementBeforeChange)
     1601        parent->setNeedsStyleRecalc();
     1602}
     1603
     1604void Element::childrenChanged(const ChildChange& change)
     1605{
     1606    ContainerNode::childrenChanged(change);
     1607    if (change.source == ChildChangeSourceParser)
    16211608        checkForEmptyStyleChange(this, renderStyle());
    1622     else
    1623         checkForSiblingStyleChanges(this, renderStyle(), false, beforeChange, afterChange, childCountDelta);
     1609    else {
     1610        SiblingCheckType checkType = change.type == ElementRemoved ? SiblingElementRemoved : Other;
     1611        checkForSiblingStyleChanges(this, checkType, change.previousSiblingElement, change.nextSiblingElement);
     1612    }
    16241613
    16251614    if (ShadowRoot* shadowRoot = this->shadowRoot())
     
    16461635    ContainerNode::finishParsingChildren();
    16471636    setIsParsingChildrenFinished();
    1648     checkForSiblingStyleChanges(this, renderStyle(), true, lastChild(), 0, 0);
     1637    checkForSiblingStyleChanges(this, FinishedParsingChildren, ElementTraversal::lastChild(this), nullptr);
    16491638    if (StyleResolver* styleResolver = document().styleResolverIfExists())
    16501639        styleResolver->popParentElement(this);
  • trunk/Source/WebCore/dom/Element.h

    r154877 r154957  
    560560    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    561561    virtual void removedFrom(ContainerNode*) OVERRIDE;
    562     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE;
     562    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    563563    virtual void removeAllEventListeners() OVERRIDE FINAL;
    564564
  • trunk/Source/WebCore/dom/ShadowRoot.cpp

    r154903 r154957  
    149149}
    150150
    151 void ShadowRoot::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     151void ShadowRoot::childrenChanged(const ChildChange& change)
    152152{
    153153    if (isOrphan())
    154154        return;
    155155
    156     ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     156    ContainerNode::childrenChanged(change);
    157157    invalidateDistribution();
    158158}
  • trunk/Source/WebCore/dom/ShadowRoot.h

    r154809 r154957  
    8787    virtual void dispose() OVERRIDE;
    8888    virtual bool childTypeAllowed(NodeType) const OVERRIDE;
    89     virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) OVERRIDE;
     89    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    9090
    9191    // ShadowRoots should never be cloned.
  • trunk/Source/WebCore/html/HTMLElement.cpp

    r154940 r154957  
    806806}
    807807
    808 void HTMLElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    809 {
    810     StyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
    811     adjustDirectionalityIfNeededAfterChildrenChanged(beforeChange, childCountDelta);
     808void HTMLElement::childrenChanged(const ChildChange& change)
     809{
     810    StyledElement::childrenChanged(change);
     811    adjustDirectionalityIfNeededAfterChildrenChanged(change.previousSiblingElement, change.type);
    812812}
    813813
     
    911911}
    912912
    913 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeChange, int childCountDelta)
    914 {
    915     if (document().renderer() && childCountDelta < 0) {
    916         Node* node = beforeChange ? NodeTraversal::nextSkippingChildren(beforeChange) : 0;
    917         for (int counter = 0; node && counter < childCountDelta; counter++, node = NodeTraversal::nextSkippingChildren(node)) {
     913void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(Element* beforeChange, ChildChangeType changeType)
     914{
     915    // FIXME: This function looks suspicious.
     916    if (document().renderer() && (changeType == ElementRemoved || changeType == TextRemoved)) {
     917        Node* node = beforeChange ? beforeChange->nextSibling() : 0;
     918        for (; node; node = node->nextSibling()) {
    918919            if (elementAffectsDirectionality(node))
    919920                continue;
     
    926927        return;
    927928
    928     Node* oldMarkedNode = beforeChange ? NodeTraversal::nextSkippingChildren(beforeChange) : 0;
     929    Node* oldMarkedNode = 0;
     930    if (beforeChange)
     931        oldMarkedNode = changeType == ElementInserted ? ElementTraversal::nextSibling(beforeChange) : beforeChange->nextSibling();
     932
    929933    while (oldMarkedNode && elementAffectsDirectionality(oldMarkedNode))
    930         oldMarkedNode = NodeTraversal::nextSkippingChildren(oldMarkedNode, this);
     934        oldMarkedNode = oldMarkedNode->nextSibling();
    931935    if (oldMarkedNode)
    932936        setHasDirAutoFlagRecursively(oldMarkedNode, false);
  • trunk/Source/WebCore/html/HTMLElement.h

    r154955 r154957  
    110110    unsigned parseBorderWidthAttribute(const AtomicString&) const;
    111111
    112     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     112    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    113113    void calculateAndAdjustDirectionality();
    114114
     
    127127    void dirAttributeChanged(const AtomicString&);
    128128    void adjustDirectionalityIfNeededAfterChildAttributeChanged(Element* child);
    129     void adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeChange, int childCountDelta);
     129    void adjustDirectionalityIfNeededAfterChildrenChanged(Element* beforeChange, ChildChangeType);
    130130    TextDirection directionality(Node** strongDirectionalityTextNode= 0) const;
    131131
  • trunk/Source/WebCore/html/HTMLFieldSetElement.cpp

    r154928 r154957  
    6464}
    6565
    66 void HTMLFieldSetElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     66void HTMLFieldSetElement::childrenChanged(const ChildChange& change)
    6767{
    68     HTMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     68    HTMLFormControlElement::childrenChanged(change);
    6969
    7070    auto legendChildren = childrenOfType<HTMLLegendElement>(this);
  • trunk/Source/WebCore/html/HTMLFieldSetElement.h

    r154955 r154957  
    5353    virtual const AtomicString& formControlType() const;
    5454    virtual bool recalcWillValidate() const { return false; }
    55     virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) OVERRIDE;
     55    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    5656    virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
    5757
  • trunk/Source/WebCore/html/HTMLObjectElement.cpp

    r154928 r154957  
    345345}
    346346
    347 void HTMLObjectElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     347void HTMLObjectElement::childrenChanged(const ChildChange& change)
    348348{
    349349    updateDocNamedItem();
     
    352352        setNeedsStyleRecalc();
    353353    }
    354     HTMLPlugInImageElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     354    HTMLPlugInImageElement::childrenChanged(change);
    355355}
    356356
  • trunk/Source/WebCore/html/HTMLObjectElement.h

    r154761 r154957  
    7777    virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
    7878
    79     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     79    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    8080
    8181    virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
  • trunk/Source/WebCore/html/HTMLOptGroupElement.cpp

    r154877 r154957  
    6767}
    6868
    69 void HTMLOptGroupElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     69void HTMLOptGroupElement::childrenChanged(const ChildChange& change)
    7070{
    7171    recalcSelectOptions();
    72     HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     72    HTMLElement::childrenChanged(change);
    7373}
    7474
  • trunk/Source/WebCore/html/HTMLOptGroupElement.h

    r154955 r154957  
    5050    virtual void willDetachRenderers() OVERRIDE;
    5151
    52     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     52    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    5353
    5454    virtual void accessKeyAction(bool sendMouseEvents);
  • trunk/Source/WebCore/html/HTMLOptionElement.cpp

    r154877 r154957  
    254254}
    255255
    256 void HTMLOptionElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     256void HTMLOptionElement::childrenChanged(const ChildChange& change)
    257257{
    258258#if ENABLE(DATALIST_ELEMENT)
     
    263263    if (HTMLSelectElement* select = ownerSelectElement())
    264264        select->optionElementChildrenChanged();
    265     HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     265    HTMLElement::childrenChanged(change);
    266266}
    267267
  • trunk/Source/WebCore/html/HTMLOptionElement.h

    r154955 r154957  
    8080    virtual void accessKeyAction(bool);
    8181
    82     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     82    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    8383
    8484    // <option> never has a renderer so we manually manage a cached style.
  • trunk/Source/WebCore/html/HTMLOutputElement.cpp

    r146417 r154957  
    8181}
    8282
    83 void HTMLOutputElement::childrenChanged(bool createdByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     83void HTMLOutputElement::childrenChanged(const ChildChange& change)
    8484{
    85     HTMLFormControlElement::childrenChanged(createdByParser, beforeChange, afterChange, childCountDelta);
     85    HTMLFormControlElement::childrenChanged(change);
    8686
    87     if (createdByParser || m_isSetTextContentInProgress) {
     87    if (change.source == ChildChangeSourceParser || m_isSetTextContentInProgress) {
    8888        m_isSetTextContentInProgress = false;
    8989        return;
  • trunk/Source/WebCore/html/HTMLOutputElement.h

    r151947 r154957  
    6060    virtual bool supportLabels() const OVERRIDE { return true; }
    6161    virtual bool supportsFocus() const OVERRIDE;
    62     virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     62    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    6363    virtual void reset();
    6464
  • trunk/Source/WebCore/html/HTMLScriptElement.cpp

    r154877 r154957  
    5353}
    5454
    55 void HTMLScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     55void HTMLScriptElement::childrenChanged(const ChildChange& change)
    5656{
    57     HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     57    HTMLElement::childrenChanged(change);
    5858    ScriptElement::childrenChanged();
    5959}
  • trunk/Source/WebCore/html/HTMLScriptElement.h

    r154955 r154957  
    4747    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    4848    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    49     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     49    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    5050
    5151    virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
  • trunk/Source/WebCore/html/HTMLSelectElement.cpp

    r154903 r154957  
    370370}
    371371
    372 void HTMLSelectElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     372void HTMLSelectElement::childrenChanged(const ChildChange& change)
    373373{
    374374    setRecalcListItems();
     
    376376    m_lastOnChangeSelection.clear();
    377377
    378     HTMLFormControlElementWithState::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     378    HTMLFormControlElementWithState::childrenChanged(change);
    379379}
    380380
  • trunk/Source/WebCore/html/HTMLSelectElement.h

    r154371 r154957  
    180180    int nextSelectableListIndexPageAway(int startIndex, SkipDirection) const;
    181181
    182     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     182    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    183183    virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
    184184
  • trunk/Source/WebCore/html/HTMLStyleElement.cpp

    r154877 r154957  
    207207}
    208208
    209 void HTMLStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    210 {
    211     HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     209void HTMLStyleElement::childrenChanged(const ChildChange& change)
     210{
     211    HTMLElement::childrenChanged(change);
    212212    m_styleSheetOwner.childrenChanged(this);
    213213}
  • trunk/Source/WebCore/html/HTMLStyleElement.h

    r154955 r154957  
    6767    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    6868    virtual void removedFrom(ContainerNode*) OVERRIDE;
    69     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     69    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    7070
    7171    virtual void finishParsingChildren();
  • trunk/Source/WebCore/html/HTMLTextAreaElement.cpp

    r154877 r154957  
    129129}
    130130
    131 void HTMLTextAreaElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    132 {
    133     HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     131void HTMLTextAreaElement::childrenChanged(const ChildChange& change)
     132{
     133    HTMLElement::childrenChanged(change);
    134134    setLastChangeWasNotUserEdit();
    135135    if (m_isDirty)
  • trunk/Source/WebCore/html/HTMLTextAreaElement.h

    r154955 r154957  
    9797    virtual bool isTextFormControl() const { return true; }
    9898
    99     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     99    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    100100    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    101101    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
  • trunk/Source/WebCore/html/HTMLTitleElement.cpp

    r154877 r154957  
    6262}
    6363
    64 void HTMLTitleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     64void HTMLTitleElement::childrenChanged(const ChildChange& change)
    6565{
    66     HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     66    HTMLElement::childrenChanged(change);
    6767    m_title = textWithDirection();
    6868    if (inDocument()) {
  • trunk/Source/WebCore/html/HTMLTitleElement.h

    r154955 r154957  
    4242    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    4343    virtual void removedFrom(ContainerNode*) OVERRIDE;
    44     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     44    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    4545
    4646    StringWithDirection m_title;
  • trunk/Source/WebCore/html/shadow/InsertionPoint.cpp

    r154903 r154957  
    108108}
    109109
    110 void InsertionPoint::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     110void InsertionPoint::childrenChanged(const ChildChange& change)
    111111{
    112     HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     112    HTMLElement::childrenChanged(change);
    113113    if (ShadowRoot* root = containingShadowRoot())
    114114        root->invalidateDistribution();
  • trunk/Source/WebCore/html/shadow/InsertionPoint.h

    r154371 r154957  
    7575    InsertionPoint(const QualifiedName&, Document*);
    7676    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE;
    77     virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) OVERRIDE;
     77    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    7878    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    7979    virtual void removedFrom(ContainerNode*) OVERRIDE;
  • trunk/Source/WebCore/svg/SVGClipPathElement.cpp

    r152343 r154957  
    104104}
    105105
    106 void SVGClipPathElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     106void SVGClipPathElement::childrenChanged(const ChildChange& change)
    107107{
    108     SVGGraphicsElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     108    SVGGraphicsElement::childrenChanged(change);
    109109
    110     if (changedByParser)
     110    if (change.source == ChildChangeSourceParser)
    111111        return;
    112112
  • trunk/Source/WebCore/svg/SVGClipPathElement.h

    r152167 r154957  
    4747    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    4848    virtual void svgAttributeChanged(const QualifiedName&);
    49     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     49    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    5050
    5151    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
  • trunk/Source/WebCore/svg/SVGElement.cpp

    r154928 r154957  
    10571057}
    10581058
    1059 void SVGElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    1060 {
    1061     StyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
    1062 
    1063     // Invalidate all SVGElementInstances associated with us
    1064     if (!changedByParser)
    1065         SVGElementInstance::invalidateAllInstancesOfElement(this);
     1059void SVGElement::childrenChanged(const ChildChange& change)
     1060{
     1061    StyledElement::childrenChanged(change);
     1062
     1063    if (change.source == ChildChangeSourceParser)
     1064        return;
     1065    SVGElementInstance::invalidateAllInstancesOfElement(this);
    10661066}
    10671067
  • trunk/Source/WebCore/svg/SVGElement.h

    r154955 r154957  
    162162    virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
    163163    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    164     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     164    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    165165    virtual bool selfHasRelativeLengths() const { return false; }
    166166    void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); }
  • trunk/Source/WebCore/svg/SVGFELightElement.cpp

    r151800 r154957  
    208208}
    209209
    210 void SVGFELightElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    211 {
    212     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
    213 
    214     if (!changedByParser) {
    215         if (ContainerNode* parent = parentNode()) {
    216             RenderObject* renderer = parent->renderer();
    217             if (renderer && renderer->isSVGResourceFilterPrimitive())
    218                 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
    219         }
    220     }
     210void SVGFELightElement::childrenChanged(const ChildChange& change)
     211{
     212    SVGElement::childrenChanged(change);
     213
     214    if (change.source == ChildChangeSourceParser)
     215        return;
     216    ContainerNode* parent = parentNode();
     217    if (!parent)
     218        return;
     219    RenderObject* renderer = parent->renderer();
     220    if (renderer && renderer->isSVGResourceFilterPrimitive())
     221        RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
    221222}
    222223
  • trunk/Source/WebCore/svg/SVGFELightElement.h

    r154462 r154957  
    4545    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    4646    virtual void svgAttributeChanged(const QualifiedName&);
    47     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     47    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    4848
    4949    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFELightElement)
  • trunk/Source/WebCore/svg/SVGFilterElement.cpp

    r154462 r154957  
    178178}
    179179
    180 void SVGFilterElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    181 {
    182     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
    183 
    184     if (changedByParser)
     180void SVGFilterElement::childrenChanged(const ChildChange& change)
     181{
     182    SVGElement::childrenChanged(change);
     183
     184    if (change.source == ChildChangeSourceParser)
    185185        return;
    186186
  • trunk/Source/WebCore/svg/SVGFilterElement.h

    r154462 r154957  
    5353    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    5454    virtual void svgAttributeChanged(const QualifiedName&);
    55     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     55    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    5656
    5757    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE;
  • trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp

    r154462 r154957  
    118118}
    119119
    120 void SVGFilterPrimitiveStandardAttributes::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     120void SVGFilterPrimitiveStandardAttributes::childrenChanged(const ChildChange& change)
    121121{
    122     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     122    SVGElement::childrenChanged(change);
    123123
    124     if (!changedByParser)
    125         invalidate();
     124    if (change.source == ChildChangeSourceParser)
     125        return;
     126    invalidate();
    126127}
    127128
  • trunk/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h

    r154679 r154957  
    5252    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    5353    virtual void svgAttributeChanged(const QualifiedName&);
    54     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     54    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    5555
    5656    inline void invalidate()
  • trunk/Source/WebCore/svg/SVGFontFaceElement.cpp

    r154877 r154957  
    297297}
    298298
    299 void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    300 {
    301     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     299void SVGFontFaceElement::childrenChanged(const ChildChange& change)
     300{
     301    SVGElement::childrenChanged(change);
    302302    rebuildFontFace();
    303303}
  • trunk/Source/WebCore/svg/SVGFontFaceElement.h

    r154955 r154957  
    5858    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    5959
    60     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     60    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    6161    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    6262    virtual void removedFrom(ContainerNode*) OVERRIDE;
  • trunk/Source/WebCore/svg/SVGFontFaceFormatElement.cpp

    r153561 r154957  
    4141}
    4242
    43 void SVGFontFaceFormatElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     43void SVGFontFaceFormatElement::childrenChanged(const ChildChange& change)
    4444{
    45     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     45    SVGElement::childrenChanged(change);
    4646
    4747    if (!parentNode() || !parentNode()->hasTagName(font_face_uriTag))
  • trunk/Source/WebCore/svg/SVGFontFaceFormatElement.h

    r154462 r154957  
    3333    SVGFontFaceFormatElement(const QualifiedName&, Document*);
    3434
    35     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     35    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    3636    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
    3737};
  • trunk/Source/WebCore/svg/SVGFontFaceSrcElement.cpp

    r153561 r154957  
    6060}
    6161
    62 void SVGFontFaceSrcElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     62void SVGFontFaceSrcElement::childrenChanged(const ChildChange& change)
    6363{
    64     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     64    SVGElement::childrenChanged(change);
    6565    if (parentNode() && parentNode()->hasTagName(font_faceTag))
    6666        toSVGFontFaceElement(parentNode())->rebuildFontFace();
  • trunk/Source/WebCore/svg/SVGFontFaceSrcElement.h

    r154462 r154957  
    3737    SVGFontFaceSrcElement(const QualifiedName&, Document*);
    3838   
    39     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     39    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    4040    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
    4141};
  • trunk/Source/WebCore/svg/SVGFontFaceUriElement.cpp

    r154877 r154957  
    7171}
    7272
    73 void SVGFontFaceUriElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     73void SVGFontFaceUriElement::childrenChanged(const ChildChange& change)
    7474{
    75     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     75    SVGElement::childrenChanged(change);
    7676
    7777    if (!parentNode() || !parentNode()->hasTagName(font_face_srcTag))
  • trunk/Source/WebCore/svg/SVGFontFaceUriElement.h

    r154462 r154957  
    4242   
    4343    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    44     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     44    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    4545    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    4646    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
  • trunk/Source/WebCore/svg/SVGGradientElement.cpp

    r154462 r154957  
    127127}
    128128   
    129 void SVGGradientElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     129void SVGGradientElement::childrenChanged(const ChildChange& change)
    130130{
    131     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     131    SVGElement::childrenChanged(change);
    132132
    133     if (changedByParser)
     133    if (change.source == ChildChangeSourceParser)
    134134        return;
    135135
  • trunk/Source/WebCore/svg/SVGGradientElement.h

    r154462 r154957  
    9898    virtual bool needsPendingResourceHandling() const { return false; }
    9999
    100     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     100    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    101101
    102102    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGradientElement)
  • trunk/Source/WebCore/svg/SVGMarkerElement.cpp

    r154462 r154957  
    180180}
    181181
    182 void SVGMarkerElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    183 {
    184     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
    185 
    186     if (changedByParser)
     182void SVGMarkerElement::childrenChanged(const ChildChange& change)
     183{
     184    SVGElement::childrenChanged(change);
     185
     186    if (change.source == ChildChangeSourceParser)
    187187        return;
    188188
  • trunk/Source/WebCore/svg/SVGMarkerElement.h

    r154462 r154957  
    129129    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    130130    virtual void svgAttributeChanged(const QualifiedName&);
    131     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     131    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    132132
    133133    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
  • trunk/Source/WebCore/svg/SVGMaskElement.cpp

    r154462 r154957  
    147147}
    148148
    149 void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     149void SVGMaskElement::childrenChanged(const ChildChange& change)
    150150{
    151     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     151    SVGElement::childrenChanged(change);
    152152
    153     if (changedByParser)
     153    if (change.source == ChildChangeSourceParser)
    154154        return;
    155155
  • trunk/Source/WebCore/svg/SVGMaskElement.h

    r154462 r154957  
    4848    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    4949    virtual void svgAttributeChanged(const QualifiedName&);
    50     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     50    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    5151
    5252    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
  • trunk/Source/WebCore/svg/SVGPatternElement.cpp

    r154877 r154957  
    172172}
    173173
    174 void SVGPatternElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    175 {
    176     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
    177 
    178     if (changedByParser)
     174void SVGPatternElement::childrenChanged(const ChildChange& change)
     175{
     176    SVGElement::childrenChanged(change);
     177
     178    if (change.source == ChildChangeSourceParser)
    179179        return;
    180180
  • trunk/Source/WebCore/svg/SVGPatternElement.h

    r154462 r154957  
    6262    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    6363    virtual void svgAttributeChanged(const QualifiedName&);
    64     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     64    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    6565
    6666    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
  • trunk/Source/WebCore/svg/SVGScriptElement.cpp

    r154877 r154957  
    128128}
    129129
    130 void SVGScriptElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
    131 {
    132     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     130void SVGScriptElement::childrenChanged(const ChildChange& change)
     131{
     132    SVGElement::childrenChanged(change);
    133133    ScriptElement::childrenChanged();
    134134}
  • trunk/Source/WebCore/svg/SVGScriptElement.h

    r154955 r154957  
    4949    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
    5050    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    51     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     51    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    5252
    5353    virtual void svgAttributeChanged(const QualifiedName&);
  • trunk/Source/WebCore/svg/SVGStyleElement.cpp

    r154877 r154957  
    156156}
    157157
    158 void SVGStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     158void SVGStyleElement::childrenChanged(const ChildChange& change)
    159159{
    160     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     160    SVGElement::childrenChanged(change);
    161161    m_styleSheetOwner.childrenChanged(this);
    162162}
  • trunk/Source/WebCore/svg/SVGStyleElement.h

    r154877 r154957  
    5555    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    5656    virtual void removedFrom(ContainerNode*) OVERRIDE;
    57     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     57    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    5858
    5959    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
  • trunk/Source/WebCore/svg/SVGTitleElement.cpp

    r154877 r154957  
    5757}
    5858
    59 void SVGTitleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
     59void SVGTitleElement::childrenChanged(const ChildChange& change)
    6060{
    61     SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
     61    SVGElement::childrenChanged(change);
    6262    if (inDocument())
    6363        // FIXME: does SVG have title text direction?
  • trunk/Source/WebCore/svg/SVGTitleElement.h

    r154481 r154957  
    3737    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    3838    virtual void removedFrom(ContainerNode*) OVERRIDE;
    39     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     39    virtual void childrenChanged(const ChildChange&) OVERRIDE;
    4040
    4141    virtual bool rendererIsNeeded(const RenderStyle&) { return false; }
Note: See TracChangeset for help on using the changeset viewer.