Diff
Modified: trunk/LayoutTests/ChangeLog (122545 => 122546)
--- trunk/LayoutTests/ChangeLog 2012-07-13 06:50:15 UTC (rev 122545)
+++ trunk/LayoutTests/ChangeLog 2012-07-13 07:20:49 UTC (rev 122546)
@@ -1,3 +1,15 @@
+2012-07-13 Ryosuke Niwa <[email protected]>
+
+ RadioNodeList is not updated upon input type change
+ https://bugs.webkit.org/show_bug.cgi?id=91178
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add a regression test.
+
+ * fast/forms/radionodelist-image-type-expected.txt: Added.
+ * fast/forms/radionodelist-image-type.html: Added.
+
2012-07-12 Filip Pizlo <[email protected]>
DFG property access stubs should use structure transition watchpoints
Added: trunk/LayoutTests/fast/forms/radionodelist-image-type-expected.txt (0 => 122546)
--- trunk/LayoutTests/fast/forms/radionodelist-image-type-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/radionodelist-image-type-expected.txt 2012-07-13 07:20:49 UTC (rev 122546)
@@ -0,0 +1,11 @@
+RadioNodeList should respond to type attribute change.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Initially, there are three input elements with type=text.
+nodeList = form.elements.namedItem('someName');
+PASS nodeList.length is 3
+PASS document.getElementsByTagName('input')[2].type = 'image'; nodeList.length is 2
+PASS document.getElementsByTagName('input')[2].type = 'radio'; nodeList.length is 3
+
Added: trunk/LayoutTests/fast/forms/radionodelist-image-type.html (0 => 122546)
--- trunk/LayoutTests/fast/forms/radionodelist-image-type.html (rev 0)
+++ trunk/LayoutTests/fast/forms/radionodelist-image-type.html 2012-07-13 07:20:49 UTC (rev 122546)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<body>
+<form>
+<input type="text" name="someName" value="firstItem" checked>
+<input type="text" name="someName" value="secondItem" checked>
+<input type="text" name="someName" value="thirdItem" checked>
+</form>
+<script src=""
+<script>
+
+description("RadioNodeList should respond to type attribute change.");
+
+
+var form = document.querySelector('form');
+var nodeList;
+
+debug("Initially, there are three input elements with type=text.");
+evalAndLog("nodeList = form.elements.namedItem('someName');");
+shouldBe("nodeList.length", "3");
+shouldBe("document.getElementsByTagName('input')[2].type = 'image'; nodeList.length", "2");
+shouldBe("document.getElementsByTagName('input')[2].type = 'radio'; nodeList.length", "3");
+
+form.style.display = 'none';
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (122545 => 122546)
--- trunk/Source/WebCore/ChangeLog 2012-07-13 06:50:15 UTC (rev 122545)
+++ trunk/Source/WebCore/ChangeLog 2012-07-13 07:20:49 UTC (rev 122546)
@@ -1,3 +1,22 @@
+2012-07-13 Ryosuke Niwa <[email protected]>
+
+ RadioNodeList is not updated upon input type change
+ https://bugs.webkit.org/show_bug.cgi?id=91178
+
+ Reviewed by Alexey Proskuryakov.
+
+ Invalidate the radio node lists when type content attribute changes since it excludes
+ image type input elements.
+
+ Test: fast/forms/radionodelist-image-type.html
+
+ * dom/Document.cpp:
+ (WebCore::shouldInvalidateNodeListForType):
+ * dom/Document.h: Renamed InvalidateOnIdNameForAttrChange to InvalidateOnFormAttrChange
+ since listing all attribute name isn't useful at this point.
+ * html/RadioNodeList.cpp:
+ (WebCore::RadioNodeList::RadioNodeList):
+
2012-07-12 Dongwoo Im <[email protected]>
CodeGeneratorJS.pm need to handle the attribute which has "CallWith=ScriptExecutionContext" option.
Modified: trunk/Source/WebCore/dom/Document.cpp (122545 => 122546)
--- trunk/Source/WebCore/dom/Document.cpp 2012-07-13 06:50:15 UTC (rev 122545)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-07-13 07:20:49 UTC (rev 122546)
@@ -3900,8 +3900,8 @@
return attrName == nameAttr;
case InvalidateOnForAttrChange:
return attrName == forAttr;
- case InvalidateOnIdNameForAttrChange:
- return attrName == nameAttr || attrName == idAttr || attrName == forAttr;
+ case InvalidateForFormControls:
+ return attrName == nameAttr || attrName == idAttr || attrName == forAttr || attrName == typeAttr;
case InvalidateOnItemAttrChange:
#if ENABLE(MICRODATA)
return attrName == itemscopeAttr || attrName == itempropAttr || attrName == itemtypeAttr;
Modified: trunk/Source/WebCore/dom/Document.h (122545 => 122546)
--- trunk/Source/WebCore/dom/Document.h 2012-07-13 06:50:15 UTC (rev 122545)
+++ trunk/Source/WebCore/dom/Document.h 2012-07-13 07:20:49 UTC (rev 122546)
@@ -196,7 +196,7 @@
InvalidateOnClassAttrChange,
InvalidateOnNameAttrChange,
InvalidateOnForAttrChange,
- InvalidateOnIdNameForAttrChange,
+ InvalidateForFormControls,
InvalidateOnItemAttrChange,
};
const int numNodeListInvalidationTypes = InvalidateOnItemAttrChange + 1;
Modified: trunk/Source/WebCore/html/RadioNodeList.cpp (122545 => 122546)
--- trunk/Source/WebCore/html/RadioNodeList.cpp 2012-07-13 06:50:15 UTC (rev 122545)
+++ trunk/Source/WebCore/html/RadioNodeList.cpp 2012-07-13 07:20:49 UTC (rev 122546)
@@ -38,7 +38,7 @@
using namespace HTMLNames;
RadioNodeList::RadioNodeList(Node* rootNode, const AtomicString& name)
- : DynamicSubtreeNodeList(rootNode, InvalidateOnIdNameForAttrChange, rootNode->hasTagName(formTag) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode)
+ : DynamicSubtreeNodeList(rootNode, InvalidateForFormControls, rootNode->hasTagName(formTag) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode)
, m_name(name)
{
}