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