Title: [110918] trunk
- Revision
- 110918
- Author
- [email protected]
- Date
- 2012-03-15 17:20:43 -0700 (Thu, 15 Mar 2012)
Log Message
Share code in FormAssociatedElement by resetting the form owner whenever insertedIntoTree is called
https://bugs.webkit.org/show_bug.cgi?id=81160
Reviewed by Kent Tamura.
Source/WebCore:
The only difference between the previous insertedIntoTree method and
resetFormOwner was a missing element->inDocument() check in the
former. But that check is actually important, as seen by the included test case.
Test: fast/forms/form-attribute-not-in-document.html
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::insertedIntoTree):
LayoutTests:
* fast/forms/form-attribute-not-in-document-expected.txt: Added.
* fast/forms/form-attribute-not-in-document.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (110917 => 110918)
--- trunk/LayoutTests/ChangeLog 2012-03-16 00:17:53 UTC (rev 110917)
+++ trunk/LayoutTests/ChangeLog 2012-03-16 00:20:43 UTC (rev 110918)
@@ -1,3 +1,13 @@
+2012-03-15 Adam Klein <[email protected]>
+
+ Share code in FormAssociatedElement by resetting the form owner whenever insertedIntoTree is called
+ https://bugs.webkit.org/show_bug.cgi?id=81160
+
+ Reviewed by Kent Tamura.
+
+ * fast/forms/form-attribute-not-in-document-expected.txt: Added.
+ * fast/forms/form-attribute-not-in-document.html: Added.
+
2012-03-15 Dean Jackson <[email protected]>
webgl/framebuffer-object-attachment failing on lion
Added: trunk/LayoutTests/fast/forms/form-attribute-not-in-document-expected.txt (0 => 110918)
--- trunk/LayoutTests/fast/forms/form-attribute-not-in-document-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/form-attribute-not-in-document-expected.txt 2012-03-16 00:20:43 UTC (rev 110918)
@@ -0,0 +1,11 @@
+Inserting a form control with a form attribute into a non-document tree should not cause it to get a form owner.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS input.form is null
+PASS input.form is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/form-attribute-not-in-document.html (0 => 110918)
--- trunk/LayoutTests/fast/forms/form-attribute-not-in-document.html (rev 0)
+++ trunk/LayoutTests/fast/forms/form-attribute-not-in-document.html 2012-03-16 00:20:43 UTC (rev 110918)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<form id=myform></form>
+<script src=""
+<script>
+description('Inserting a form control with a form attribute into a non-document tree should not cause it to get a form owner.');
+
+var input = document.createElement('input');
+input.setAttribute('form', 'myform');
+shouldBeNull('input.form');
+
+var div = document.createElement('div');
+div.appendChild(input);
+shouldBeNull('input.form');
+</script>
+<script src=""
Modified: trunk/Source/WebCore/ChangeLog (110917 => 110918)
--- trunk/Source/WebCore/ChangeLog 2012-03-16 00:17:53 UTC (rev 110917)
+++ trunk/Source/WebCore/ChangeLog 2012-03-16 00:20:43 UTC (rev 110918)
@@ -1,3 +1,19 @@
+2012-03-15 Adam Klein <[email protected]>
+
+ Share code in FormAssociatedElement by resetting the form owner whenever insertedIntoTree is called
+ https://bugs.webkit.org/show_bug.cgi?id=81160
+
+ Reviewed by Kent Tamura.
+
+ The only difference between the previous insertedIntoTree method and
+ resetFormOwner was a missing element->inDocument() check in the
+ former. But that check is actually important, as seen by the included test case.
+
+ Test: fast/forms/form-attribute-not-in-document.html
+
+ * html/FormAssociatedElement.cpp:
+ (WebCore::FormAssociatedElement::insertedIntoTree):
+
2012-03-15 Kentaro Hara <[email protected]>
[Refactoring] Rename StringBuilder variables in MarkupAccumulator.{h,cpp}
Modified: trunk/Source/WebCore/html/FormAssociatedElement.cpp (110917 => 110918)
--- trunk/Source/WebCore/html/FormAssociatedElement.cpp 2012-03-16 00:17:53 UTC (rev 110917)
+++ trunk/Source/WebCore/html/FormAssociatedElement.cpp 2012-03-16 00:20:43 UTC (rev 110918)
@@ -76,23 +76,7 @@
void FormAssociatedElement::insertedIntoTree()
{
- HTMLElement* element = toHTMLElement(this);
- const AtomicString& formId = element->fastGetAttribute(formAttr);
- if (!formId.isNull()) {
- HTMLFormElement* newForm = 0;
- Element* newFormCandidate = element->treeScope()->getElementById(formId);
- if (newFormCandidate && newFormCandidate->hasTagName(formTag))
- newForm = static_cast<HTMLFormElement*>(newFormCandidate);
- setForm(newForm);
- return;
- }
- if (!m_form) {
- // This handles the case of a new form element being created by
- // _javascript_ and inserted inside a form. In the case of the parser
- // setting a form, we will already have a non-null value for m_form,
- // and so we don't need to do anything.
- setForm(element->findFormAncestor());
- }
+ resetFormOwner();
}
static inline Node* findRoot(Node* n)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes