invalidateNodeListCachesInAncestors walks up ancestors even when an attribute that...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jul 2012 20:56:32 +0000 (20:56 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jul 2012 20:56:32 +0000 (20:56 +0000)
commitfae5ced7eceb10b5514dcd167d00aab923d42dc6
treed53e83fec1953d85552565b4d056fd30f2dcf616
parent5bfdc4017b51f4ee67e598ee93cdf190469e79a0
invalidateNodeListCachesInAncestors walks up ancestors even when an attribute that doesn't invalidate node lists changes
https://bugs.webkit.org/show_bug.cgi?id=91530

Reviewed by Ojan Vafai.

Source/WebCore:

The bug was caused by invalidateNodeListCachesInAncestors not calling Document::shouldInvalidateNodeListCaches with
attrName. Done that.

This chance revealed a bug in shouldInvalidateTypeOnAttributeChange that we weren't checking form attribute changes for
RadioNodeList and HTMLCollection, so fixed the bug.

Also renamed Document::clearNodeListCaches to invalidateNodeListCaches to match the name convention used elsewhere,
and added a new version of DynamicNodeListCacheBase::invalidateCache that takes attrName to reduce the code duplication.

Test: fast/forms/elements-invalidate-on-form-attribute-invalidation.html

* dom/Document.cpp:
(WebCore::Document::invalidateNodeListCaches):
* dom/Document.h:
(Document):
* dom/DynamicNodeList.h:
(WebCore::DynamicNodeListCacheBase::invalidateCache):
(WebCore::DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange):
* dom/Node.cpp:
(WebCore::Node::invalidateNodeListCachesInAncestors):
(WebCore::NodeListsNodeData::invalidateCaches):

LayoutTests:

Add a regression test for invalidating HTMLFormColletion on form attribute changes. This invalidation worked before
because we weren't properly exiting early in Node::invalidateNodeListCachesInAncestors and
Document::invalidateNodeListCaches invalidated all node lists regardless of the attribute type.

* fast/forms/elements-invalidate-on-form-attribute-invalidation-expected.txt: Added.
* fast/forms/elements-invalidate-on-form-attribute-invalidation.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@122873 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/forms/elements-invalidate-on-form-attribute-invalidation-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/elements-invalidate-on-form-attribute-invalidation.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/DynamicNodeList.h
Source/WebCore/dom/Node.cpp