WebCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Jan 2008 01:17:22 +0000 (01:17 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Jan 2008 01:17:22 +0000 (01:17 +0000)
commit5098d60bc3be88ded1f3acdda3bf865123f3cb1c
treec9fc44c945c79446d846dfbfdbd1c2ba61cb2a60
parentfe8748e7143e409d02a4d31611b27c4244721e1f
WebCore:

        Reviewed by Mitz.

        - fix http://bugs.webkit.org/show_bug.cgi?id=16641
          Acid3 reveals HTMLFormElement.elements fails to update when element name changes

        Test: fast/dom/HTMLFormElement/elements-not-in-document.html

        This was a bug specific to forms that are not in the document tree.
        The fix was to change the code to increment the document version number to match
        up with other document change tracking. Maybe at some point we can clean these up
        so we don't have so many competing change notification systems.

        * dom/ContainerNode.cpp:
        (WebCore::ContainerNode::replaceChild): Removed bogus comment.
        (WebCore::ContainerNode::addChild): Added an explicit incDOMTreeVersion
        call here, since this code path bypasses the subtree-modified event code.

        * dom/Element.cpp:
        (WebCore::Element::setAttribute): Remove the inDocument() check -- not all HTML
        collections are for things in the document.
        (WebCore::Element::setAttributeMap): Ditto.

        * dom/EventTargetNode.cpp:
        (WebCore::EventTargetNode::dispatchSubtreeModifiedEvent): Added a call to
        incDOMTreeVersion here; covers most cases of tree structure changes.

        * dom/Node.cpp:
        (WebCore::Node::attach): Remove call to incDOMTreeVersion -- creating a renderer
        has nothing to do with changes to the DOM tree!
        (WebCore::Node::detach): Ditto.

        * html/HTMLFormElement.cpp:
        (WebCore::HTMLFormElement::registerFormElement): Remove call to incDOMTreeVersion.
        This is handled at a lower level and doesn't need to be here.
        (WebCore::HTMLFormElement::removeFormElement): Ditto.

LayoutTests:

        Reviewed by Mitz.

        - test for http://bugs.webkit.org/show_bug.cgi?id=16641
          Acid3 reveals HTMLFormElement.elements fails to update when element name changes

        * fast/dom/HTMLFormElement: Added.
        * fast/dom/HTMLFormElement/elements-not-in-document-expected.txt: Added.
        * fast/dom/HTMLFormElement/elements-not-in-document.html: Added.
        * fast/dom/HTMLFormElement/resources: Added.
        * fast/dom/HTMLFormElement/resources/TEMPLATE.html: Added.
        * fast/dom/HTMLFormElement/resources/elements-not-in-document.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29053 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLFormElement/elements-not-in-document-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLFormElement/elements-not-in-document.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLFormElement/resources/TEMPLATE.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLFormElement/resources/elements-not-in-document.js [new file with mode: 0644]
WebCore/ChangeLog
WebCore/dom/ContainerNode.cpp
WebCore/dom/Element.cpp
WebCore/dom/EventTargetNode.cpp
WebCore/dom/Node.cpp
WebCore/html/HTMLFormElement.cpp