Title: [89006] trunk
Revision
89006
Author
[email protected]
Date
2011-06-15 22:12:24 -0700 (Wed, 15 Jun 2011)

Log Message

2011-06-08  Keishi Hattori  <[email protected]>

    Reviewed by Kent Tamura.

    Fix range element not updating when value attribute is set with JS
    https://bugs.webkit.org/show_bug.cgi?id=61857

    Test: fast/forms/range-set-attribute.html

    * html/RangeInputType.cpp:
    (WebCore::RangeInputType::minOrMaxAttributeChanged): Changed to only sanitize the value when the dirty value flag is true.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (89005 => 89006)


--- trunk/LayoutTests/ChangeLog	2011-06-16 04:40:01 UTC (rev 89005)
+++ trunk/LayoutTests/ChangeLog	2011-06-16 05:12:24 UTC (rev 89006)
@@ -1,3 +1,14 @@
+2011-06-08  Keishi Hattori  <[email protected]>
+
+        Reviewed by Kent Tamura.
+
+        Fix range element not updating when value attribute is set with JS
+        https://bugs.webkit.org/show_bug.cgi?id=61857
+
+        * fast/forms/range-set-attribute-expected.txt: Added.
+        * fast/forms/range-set-attribute.html: Added. Test to see if setting the value attribute of a 
+        range input element updates the value.
+
 2011-06-15  Kent Tamura  <[email protected]>
 
         Reviewed by Dimitri Glazkov.

Added: trunk/LayoutTests/fast/forms/range-set-attribute-expected.txt (0 => 89006)


--- trunk/LayoutTests/fast/forms/range-set-attribute-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/range-set-attribute-expected.txt	2011-06-16 05:12:24 UTC (rev 89006)
@@ -0,0 +1,16 @@
+Test to see if setting the value attribute updates the value.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS input.setAttribute("value", "10"); input.value is "10"
+rewriting the value attribute should update the value
+PASS input.setAttribute("value", "20"); input.value is "20"
+changing the max should effect value
+PASS input.setAttribute("max", "10"); input.value is "10"
+value attribute should not change the value after you set a value
+PASS input.value = 10; input.setAttribute("value", "5"); input.value is "10"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/range-set-attribute.html (0 => 89006)


--- trunk/LayoutTests/fast/forms/range-set-attribute.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/range-set-attribute.html	2011-06-16 05:12:24 UTC (rev 89006)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description('Test to see if setting the value attribute updates the value.');
+
+var input = document.createElement('input');
+input.type = 'range';
+
+shouldBe('input.setAttribute("value", "10"); input.value', '"10"');
+
+input.setAttribute('min', '0');
+input.setAttribute('max', '100');
+
+debug("rewriting the value attribute should update the value")
+shouldBe('input.setAttribute("value", "20"); input.value', '"20"');
+
+debug("changing the max should effect value")
+shouldBe('input.setAttribute("max", "10"); input.value', '"10"');
+
+debug("value attribute should not change the value after you set a value")
+shouldBe('input.value = 10; input.setAttribute("value", "5"); input.value', '"10"');
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (89005 => 89006)


--- trunk/Source/WebCore/ChangeLog	2011-06-16 04:40:01 UTC (rev 89005)
+++ trunk/Source/WebCore/ChangeLog	2011-06-16 05:12:24 UTC (rev 89006)
@@ -1,3 +1,15 @@
+2011-06-08  Keishi Hattori  <[email protected]>
+
+        Reviewed by Kent Tamura.
+
+        Fix range element not updating when value attribute is set with JS
+        https://bugs.webkit.org/show_bug.cgi?id=61857
+
+        Test: fast/forms/range-set-attribute.html
+
+        * html/RangeInputType.cpp:
+        (WebCore::RangeInputType::minOrMaxAttributeChanged): Changed to only sanitize the value when the dirty value flag is true.
+
 2011-06-15  Adam Barth  <[email protected]>
 
         Unreviewed.  (Technically I should get this reviewed, but I

Modified: trunk/Source/WebCore/html/RangeInputType.cpp (89005 => 89006)


--- trunk/Source/WebCore/html/RangeInputType.cpp	2011-06-16 04:40:01 UTC (rev 89005)
+++ trunk/Source/WebCore/html/RangeInputType.cpp	2011-06-16 05:12:24 UTC (rev 89006)
@@ -251,7 +251,8 @@
     InputType::minOrMaxAttributeChanged();
 
     // Sanitize the value.
-    element()->setValue(element()->value());
+    if (element()->hasDirtyValue())
+        element()->setValue(element()->value());
     element()->setNeedsStyleRecalc();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to