WebCore:
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2009 20:14:39 +0000 (20:14 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Apr 2009 20:14:39 +0000 (20:14 +0000)
commit4120edf0b867507968f1efe4f0ae55efcfe737e1
tree9049c4e9042b7fcd85629a19a1f34141c5ea199a
parentc5f92da07df21364e655361f6e2f8f689232d931
WebCore:

2009-04-28  Brady Eidson  <beidson@apple.com>

        Reviewed by Darin Adler

        <rdar://problem/6643219> Crashes after moving nodes between documents with Safari 4 Beta installed

        When moving Nodes between documents we weren't properly updating style declarations.  Certain operations, such
        as creating webarchives, would tickle this bug.

        Tests: webarchive/adopt-attribute-styled-body-webarchive.html
               webarchive/adopt-attribute-styled-node-webarchive.html
               webarchive/adopt-inline-styled-node-webarchive.html

        * dom/Node.cpp:  Add a debug-only mechanism to insure that anyone who overrides (did/will)MoveToNewOwnerDocument
          calls their parent-class implementation after they've done their own work.
        (WebCore::setWillMoveToNewOwnerDocumentWasCalled):
        (WebCore::setDidMoveToNewOwnerDocumentWasCalled):
        (WebCore::Node::setDocument):
        (WebCore::Node::willMoveToNewOwnerDocument):
        (WebCore::Node::didMoveToNewOwnerDocument):

        * dom/StyledElement.cpp:
        (WebCore::StyledElement::attributeChanged): Add a comment explaining why we don't need to walk the nameAttrMap
          to update style declarations.
        (WebCore::StyledElement::didMoveToNewOwnerDocument): Update the parent pointer for the inline style declaration.
        * dom/StyledElement.h:

        * html/HTMLBodyElement.cpp:
        (WebCore::HTMLBodyElement::didMoveToNewOwnerDocument): Update the parent pointer for the link declaration.
        * html/HTMLBodyElement.h:

LayoutTests:

2009-04-28  Brady Eidson  <beidson@apple.com>

        Reviewed by Darin Adler

        <rdar://problem/6643219> Crashes after moving nodes between documents with Safari 4 Beta installed

        * webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive: Added.
        * webarchive/adopt-attribute-styled-body-webarchive.html: Added.
        * webarchive/resources/adopt-attribute-styled-body-iframe.html: Added.
        * webarchive/resources/adopt-attribute-styled-body-second-window.html: Added.

        * webarchive/adopt-attribute-styled-node-webarchive-expected.webarchive: Added.
        * webarchive/adopt-attribute-styled-node-webarchive.html: Added.
        * webarchive/resources/adopt-attribute-styled-node-second-window.html: Added.

        * webarchive/adopt-inline-styled-node-webarchive-expected.webarchive: Added.
        * webarchive/adopt-inline-styled-node-webarchive.html: Added.
        * webarchive/resources/adopt-inline-styled-node-second-window.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@42955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/webarchive/adopt-attribute-styled-body-webarchive-expected.webarchive [new file with mode: 0644]
LayoutTests/webarchive/adopt-attribute-styled-body-webarchive.html [new file with mode: 0644]
LayoutTests/webarchive/adopt-attribute-styled-node-webarchive-expected.webarchive [new file with mode: 0644]
LayoutTests/webarchive/adopt-attribute-styled-node-webarchive.html [new file with mode: 0644]
LayoutTests/webarchive/adopt-inline-styled-node-webarchive-expected.webarchive [new file with mode: 0644]
LayoutTests/webarchive/adopt-inline-styled-node-webarchive.html [new file with mode: 0644]
LayoutTests/webarchive/resources/adopt-attribute-styled-body-iframe.html [new file with mode: 0644]
LayoutTests/webarchive/resources/adopt-attribute-styled-body-second-window.html [new file with mode: 0644]
LayoutTests/webarchive/resources/adopt-attribute-styled-node-second-window.html [new file with mode: 0644]
LayoutTests/webarchive/resources/adopt-inline-styled-node-second-window.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/dom/Node.cpp
WebCore/dom/StyledElement.cpp
WebCore/dom/StyledElement.h
WebCore/html/HTMLBodyElement.cpp
WebCore/html/HTMLBodyElement.h