Clean up ContainerNode::childrenChanged
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Sep 2013 15:17:50 +0000 (15:17 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Sep 2013 15:17:50 +0000 (15:17 +0000)
commit1acee920aab80971ccea59e1c41b7d38a0420997
tree4899da0adff572f76b14e01fda0cff8c6aa82881
parentf98a3e8ade714e817e45afb1fdadfb7c02048a2a
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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154957 268f45cc-cd09-0410-ab3c-d52691b4dbfc
68 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Attr.cpp
Source/WebCore/dom/Attr.h
Source/WebCore/dom/CharacterData.cpp
Source/WebCore/dom/ContainerNode.cpp
Source/WebCore/dom/ContainerNode.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/ShadowRoot.cpp
Source/WebCore/dom/ShadowRoot.h
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/html/HTMLElement.h
Source/WebCore/html/HTMLFieldSetElement.cpp
Source/WebCore/html/HTMLFieldSetElement.h
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/html/HTMLObjectElement.h
Source/WebCore/html/HTMLOptGroupElement.cpp
Source/WebCore/html/HTMLOptGroupElement.h
Source/WebCore/html/HTMLOptionElement.cpp
Source/WebCore/html/HTMLOptionElement.h
Source/WebCore/html/HTMLOutputElement.cpp
Source/WebCore/html/HTMLOutputElement.h
Source/WebCore/html/HTMLScriptElement.cpp
Source/WebCore/html/HTMLScriptElement.h
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/HTMLSelectElement.h
Source/WebCore/html/HTMLStyleElement.cpp
Source/WebCore/html/HTMLStyleElement.h
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextAreaElement.h
Source/WebCore/html/HTMLTitleElement.cpp
Source/WebCore/html/HTMLTitleElement.h
Source/WebCore/html/shadow/InsertionPoint.cpp
Source/WebCore/html/shadow/InsertionPoint.h
Source/WebCore/svg/SVGClipPathElement.cpp
Source/WebCore/svg/SVGClipPathElement.h
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGElement.h
Source/WebCore/svg/SVGFELightElement.cpp
Source/WebCore/svg/SVGFELightElement.h
Source/WebCore/svg/SVGFilterElement.cpp
Source/WebCore/svg/SVGFilterElement.h
Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
Source/WebCore/svg/SVGFontFaceElement.cpp
Source/WebCore/svg/SVGFontFaceElement.h
Source/WebCore/svg/SVGFontFaceFormatElement.cpp
Source/WebCore/svg/SVGFontFaceFormatElement.h
Source/WebCore/svg/SVGFontFaceSrcElement.cpp
Source/WebCore/svg/SVGFontFaceSrcElement.h
Source/WebCore/svg/SVGFontFaceUriElement.cpp
Source/WebCore/svg/SVGFontFaceUriElement.h
Source/WebCore/svg/SVGGradientElement.cpp
Source/WebCore/svg/SVGGradientElement.h
Source/WebCore/svg/SVGMarkerElement.cpp
Source/WebCore/svg/SVGMarkerElement.h
Source/WebCore/svg/SVGMaskElement.cpp
Source/WebCore/svg/SVGMaskElement.h
Source/WebCore/svg/SVGPatternElement.cpp
Source/WebCore/svg/SVGPatternElement.h
Source/WebCore/svg/SVGScriptElement.cpp
Source/WebCore/svg/SVGScriptElement.h
Source/WebCore/svg/SVGStyleElement.cpp
Source/WebCore/svg/SVGStyleElement.h
Source/WebCore/svg/SVGTitleElement.cpp
Source/WebCore/svg/SVGTitleElement.h