Title: [96552] trunk
Revision
96552
Author
[email protected]
Date
2011-10-03 16:02:51 -0700 (Mon, 03 Oct 2011)

Log Message

REGRESSION(r94274): cloned text input loses value
https://bugs.webkit.org/show_bug.cgi?id=69095

Reviewed by Darin Adler.

Source/WebCore: 

The bug was caused by copyNonAttributeProperties not updating inner element text after copying
m_valueIfDirty. Fixed the bug by calling updateInnerTextValue.

Test: fast/forms/clone-input-with-dirty-value.html

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::copyNonAttributeProperties):

LayoutTests: 

Added a regression test that clones an input element with a dirty value.
The cloned input element should have the edited value.

* fast/forms/clone-input-with-dirty-value-expected.txt: Added.
* fast/forms/clone-input-with-dirty-value.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96551 => 96552)


--- trunk/LayoutTests/ChangeLog	2011-10-03 22:51:20 UTC (rev 96551)
+++ trunk/LayoutTests/ChangeLog	2011-10-03 23:02:51 UTC (rev 96552)
@@ -1,3 +1,16 @@
+2011-10-03  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r94274): cloned text input loses value
+        https://bugs.webkit.org/show_bug.cgi?id=69095
+
+        Reviewed by Darin Adler.
+
+        Added a regression test that clones an input element with a dirty value.
+        The cloned input element should have the edited value.
+
+        * fast/forms/clone-input-with-dirty-value-expected.txt: Added.
+        * fast/forms/clone-input-with-dirty-value.html: Added.
+
 2011-10-03  Adam Barth  <[email protected]>
 
         Update results again now that Leopard has finally cycled.

Added: trunk/LayoutTests/fast/forms/clone-input-with-dirty-value-expected.txt (0 => 96552)


--- trunk/LayoutTests/fast/forms/clone-input-with-dirty-value-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/clone-input-with-dirty-value-expected.txt	2011-10-03 23:02:51 UTC (rev 96552)
@@ -0,0 +1,4 @@
+This tests cloning an input element with an edited value. The cloned input element should retain the edited value and you should see PASSED blow.
+
+PASSED
+

Added: trunk/LayoutTests/fast/forms/clone-input-with-dirty-value.html (0 => 96552)


--- trunk/LayoutTests/fast/forms/clone-input-with-dirty-value.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/clone-input-with-dirty-value.html	2011-10-03 23:02:51 UTC (rev 96552)
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<p>This tests cloning an input element with an edited value.
+The cloned input element should retain the edited value and you should see PASSED blow.</p>
+<pre id="log"></pre>
+<div><input id="test" title="1" type="text" value="FAIL"></div>
+<script type="text/_javascript_">
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+var test = document.getElementById('test');
+test.value = 'PASS';
+
+var x = test.offsetLeft; // Force layout
+
+var clone = test.cloneNode(true);
+test.parentNode.appendChild(clone);
+test.value = '';
+
+clone.focus();
+clone.selectionStart = clone.selectionEnd = clone.value.length;
+document.execCommand('InsertText', false, 'ED');
+
+document.getElementById('log').textContent = clone.value;
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (96551 => 96552)


--- trunk/Source/WebCore/ChangeLog	2011-10-03 22:51:20 UTC (rev 96551)
+++ trunk/Source/WebCore/ChangeLog	2011-10-03 23:02:51 UTC (rev 96552)
@@ -1,5 +1,20 @@
 2011-10-03  Ryosuke Niwa  <[email protected]>
 
+        REGRESSION(r94274): cloned text input loses value
+        https://bugs.webkit.org/show_bug.cgi?id=69095
+
+        Reviewed by Darin Adler.
+
+        The bug was caused by copyNonAttributeProperties not updating inner element text after copying
+        m_valueIfDirty. Fixed the bug by calling updateInnerTextValue.
+
+        Test: fast/forms/clone-input-with-dirty-value.html
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::copyNonAttributeProperties):
+
+2011-10-03  Ryosuke Niwa  <[email protected]>
+
         Leopard build fix after r96530.
 
         * rendering/svg/RenderSVGResourcePattern.cpp:

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (96551 => 96552)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-10-03 22:51:20 UTC (rev 96551)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-10-03 23:02:51 UTC (rev 96552)
@@ -1027,6 +1027,9 @@
     m_isIndeterminate = sourceElement->m_isIndeterminate;
 
     HTMLTextFormControlElement::copyNonAttributeProperties(source);
+
+    setFormControlValueMatchesRenderer(false);
+    updateInnerTextValue();
 }
 
 String HTMLInputElement::value() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to