Title: [118495] trunk
Revision
118495
Author
[email protected]
Date
2012-05-25 01:51:07 -0700 (Fri, 25 May 2012)

Log Message

RadioNodeList does not include a object element
https://bugs.webkit.org/show_bug.cgi?id=87371

Patch by Rakesh KN <[email protected]> on 2012-05-25
Reviewed by Kent Tamura.

Source/WebCore:

As per spec http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#category-listed
Object element should also be listed in RadioNodeList object.

Updated existing test.

* html/RadioNodeList.cpp:
(WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter):
Compares if test element's name/id  and form matches that of the RadioNodeList filter.
(WebCore::RadioNodeList::nodeMatches):
Added support for Object element, check if object elements name/id matches the RadioNodeList filter.
* html/RadioNodeList.h:
(RadioNodeList): Ditto

LayoutTests:

* fast/forms/form-collection-radio-node-list-expected.txt:
* fast/forms/form-collection-radio-node-list.html:
Updated test to include test for object element.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (118494 => 118495)


--- trunk/LayoutTests/ChangeLog	2012-05-25 08:41:45 UTC (rev 118494)
+++ trunk/LayoutTests/ChangeLog	2012-05-25 08:51:07 UTC (rev 118495)
@@ -1,3 +1,14 @@
+2012-05-25  Rakesh KN  <[email protected]>
+
+        RadioNodeList does not include a object element
+        https://bugs.webkit.org/show_bug.cgi?id=87371
+
+        Reviewed by Kent Tamura.
+
+        * fast/forms/form-collection-radio-node-list-expected.txt:
+        * fast/forms/form-collection-radio-node-list.html:
+        Updated test to include test for object element.
+
 2012-05-25  Jan Keromnes  <[email protected]>
 
         Web Inspector: Resource object has no methods getContent and setContent

Modified: trunk/LayoutTests/fast/forms/form-collection-radio-node-list-expected.txt (118494 => 118495)


--- trunk/LayoutTests/fast/forms/form-collection-radio-node-list-expected.txt	2012-05-25 08:41:45 UTC (rev 118494)
+++ trunk/LayoutTests/fast/forms/form-collection-radio-node-list-expected.txt	2012-05-25 08:51:07 UTC (rev 118495)
@@ -51,6 +51,11 @@
 After changing the id
 PASS radioNodeList2.length is 2
 
+Check that object element also reflects in RadioNodeList.
+PASS radioNodeList.length is 5
+
+Check that object element does not reflect in RadioNodeList if its owner form is not present.
+PASS container.appendChild(nonSubtreeObjectElement); radioNodeList.length is 5
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/form-collection-radio-node-list.html (118494 => 118495)


--- trunk/LayoutTests/fast/forms/form-collection-radio-node-list.html	2012-05-25 08:41:45 UTC (rev 118494)
+++ trunk/LayoutTests/fast/forms/form-collection-radio-node-list.html	2012-05-25 08:51:07 UTC (rev 118495)
@@ -123,6 +123,16 @@
 shouldBe('radioNodeList2.length', '2');
 debug("");
 
+debug("Check that object element also reflects in RadioNodeList.");
+document.getElementById("object1").id = "inputcommon";
+shouldBe('radioNodeList.length', '5');
+
+debug("");
+debug("Check that object element does not reflect in RadioNodeList if its owner form is not present.");
+var nonSubtreeObjectElement = document.createElement("object");
+nonSubtreeObjectElement.setAttribute("id", "inputcommon");
+shouldBe('container.appendChild(nonSubtreeObjectElement); radioNodeList.length', '5');
+
 container.parentNode.removeChild(container);
 </script>
 <script src=""

Modified: trunk/Source/WebCore/ChangeLog (118494 => 118495)


--- trunk/Source/WebCore/ChangeLog	2012-05-25 08:41:45 UTC (rev 118494)
+++ trunk/Source/WebCore/ChangeLog	2012-05-25 08:51:07 UTC (rev 118495)
@@ -1,3 +1,23 @@
+2012-05-25  Rakesh KN  <[email protected]>
+
+        RadioNodeList does not include a object element
+        https://bugs.webkit.org/show_bug.cgi?id=87371
+
+        Reviewed by Kent Tamura.
+
+        As per spec http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#category-listed
+        Object element should also be listed in RadioNodeList object.
+
+        Updated existing test.
+
+        * html/RadioNodeList.cpp:
+        (WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter):
+        Compares if test element's name/id  and form matches that of the RadioNodeList filter.
+        (WebCore::RadioNodeList::nodeMatches):
+        Added support for Object element, check if object elements name/id matches the RadioNodeList filter.
+        * html/RadioNodeList.h:
+        (RadioNodeList): Ditto
+
 2012-05-25  Jan Keromnes  <[email protected]>
 
         Web Inspector: Resource object has no methods getContent and setContent

Modified: trunk/Source/WebCore/html/RadioNodeList.cpp (118494 => 118495)


--- trunk/Source/WebCore/html/RadioNodeList.cpp	2012-05-25 08:41:45 UTC (rev 118494)
+++ trunk/Source/WebCore/html/RadioNodeList.cpp	2012-05-25 08:51:07 UTC (rev 118495)
@@ -30,6 +30,7 @@
 #include "HTMLFormElement.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
+#include "HTMLObjectElement.h"
 
 namespace WebCore {
 
@@ -82,13 +83,23 @@
     }
 }
 
-bool RadioNodeList::nodeMatches(Element* testElement) const
+bool RadioNodeList::checkElementMatchesRadioNodeListFilter(Element* testElement) const
 {
-    if (!testElement->isFormControlElement())
+    ASSERT(testElement->hasTagName(objectTag) || testElement->isFormControlElement());
+    HTMLFormElement* formElement = 0;
+    if (testElement->hasTagName(objectTag))
+        formElement = static_cast<HTMLObjectElement*>(testElement)->form();
+    else
+        formElement = static_cast<HTMLFormControlElement*>(testElement)->form();
+    if (!formElement || formElement != m_formElement)
         return false;
 
-    HTMLFormElement* formElement = static_cast<HTMLFormControlElement*>(testElement)->form();
-    if (!formElement || formElement != m_formElement)
+    return testElement->getIdAttribute() == m_name || testElement->getNameAttribute() == m_name;
+}
+
+bool RadioNodeList::nodeMatches(Element* testElement) const
+{
+    if (!testElement->hasTagName(objectTag) && !testElement->isFormControlElement())
         return false;
 
     if (HTMLInputElement* inputElement = testElement->toInputElement()) {
@@ -96,7 +107,7 @@
             return false;
     }
 
-    return testElement->getIdAttribute() ==  m_name || testElement->getNameAttribute() == m_name;
+    return checkElementMatchesRadioNodeListFilter(testElement);
 }
 
 } // namspace

Modified: trunk/Source/WebCore/html/RadioNodeList.h (118494 => 118495)


--- trunk/Source/WebCore/html/RadioNodeList.h	2012-05-25 08:41:45 UTC (rev 118494)
+++ trunk/Source/WebCore/html/RadioNodeList.h	2012-05-25 08:51:07 UTC (rev 118495)
@@ -51,6 +51,7 @@
 
 private:
     RadioNodeList(const AtomicString& name, Element*);
+    bool checkElementMatchesRadioNodeListFilter(Element*) const;
 
     AtomicString m_name;
     RefPtr<Element> m_formElement;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to