[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

tkent at chromium.org tkent at chromium.org
Wed Dec 22 11:43:37 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 07e1f1132dc2a363ca1e4752e7d82c594fe7c175
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 5 05:51:33 2010 +0000

    Spin-button behavior improvement for out-of-range values
    https://bugs.webkit.org/show_bug.cgi?id=43463
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    If the current value is smaller than the minimum value, the up
    button should change the value to the minimum value. If the
    current value is larger than the maximum value, the down button
    should change the value to the maximum value.
    
    Test: fast/forms/input-number-outofrange.html
    
    * html/HTMLInputElement.cpp:
    (WebCore::HTMLInputElement::stepUpFromRenderer):
    
    LayoutTests:
    
    * fast/forms/input-number-outofrange-expected.txt: Added.
    * fast/forms/input-number-outofrange.html: Added.
    * fast/forms/script-tests/input-number-outofrange.js: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64711 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 54c111f..255bd20 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,16 @@
 2010-08-04  Kent Tamura  <tkent at chromium.org>
 
+        Reviewed by Darin Adler.
+
+        Spin-button behavior improvement for out-of-range values
+        https://bugs.webkit.org/show_bug.cgi?id=43463
+
+        * fast/forms/input-number-outofrange-expected.txt: Added.
+        * fast/forms/input-number-outofrange.html: Added.
+        * fast/forms/script-tests/input-number-outofrange.js: Added.
+
+2010-08-04  Kent Tamura  <tkent at chromium.org>
+
         Unreviewed, test expectation update.
 
         * platform/chromium/drt_expectations.txt: Add flaky tests on DRT/Chromium/Mac
diff --git a/LayoutTests/fast/forms/input-number-outofrange-expected.txt b/LayoutTests/fast/forms/input-number-outofrange-expected.txt
new file mode 100644
index 0000000..ce3bdff
--- /dev/null
+++ b/LayoutTests/fast/forms/input-number-outofrange-expected.txt
@@ -0,0 +1,17 @@
+Test for spinbutton behavior for out-of-range values.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Pressing the down arrow key on an input field of which value is lower than the minimum:
+PASS lower.value is unchanged
+Pressing the up arrow key on the input:
+PASS lower.value is lower.min
+Pressing the up arrow key on an input field of which value is higher than the maximum:
+PASS higher.value is unchanged
+Pressing the down arrow key on the input:
+PASS higher.value is higher.max
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/forms/input-number-outofrange.html b/LayoutTests/fast/forms/input-number-outofrange.html
new file mode 100644
index 0000000..7e0324c
--- /dev/null
+++ b/LayoutTests/fast/forms/input-number-outofrange.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/input-number-outofrange.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/forms/script-tests/input-number-outofrange.js b/LayoutTests/fast/forms/script-tests/input-number-outofrange.js
new file mode 100644
index 0000000..5d27b51
--- /dev/null
+++ b/LayoutTests/fast/forms/script-tests/input-number-outofrange.js
@@ -0,0 +1,38 @@
+description('Test for spinbutton behavior for out-of-range values.');
+
+var parent = document.createElement('div');
+document.body.appendChild(parent);
+parent.innerHTML = '<input type=number id=lower value=-10 min=0 max=100>'
+    + '<input type=number id=higher value=200 min=0 max=100>';
+var lower = document.getElementById('lower');
+var higher = document.getElementById('higher');
+
+function sendKeyEvent(element, key)
+{
+    element.focus();
+    var event = document.createEvent('KeyboardEvents');
+    event.initKeyboardEvent('keydown', true, true, document.defaultView, key, 0, false, false, false, false, false);
+    element.dispatchEvent(event);
+}
+
+debug('Pressing the down arrow key on an input field of which value is lower than the minimum:');
+sendKeyEvent(lower, 'Down');
+var unchanged = "-10";
+shouldBe('lower.value', 'unchanged');
+
+debug('Pressing the up arrow key on the input:');
+sendKeyEvent(lower, 'Up');
+shouldBe('lower.value', 'lower.min');
+
+debug('Pressing the up arrow key on an input field of which value is higher than the maximum:');
+sendKeyEvent(higher, 'Up');
+unchanged = "200";
+shouldBe('higher.value', 'unchanged');
+
+debug('Pressing the down arrow key on the input:');
+sendKeyEvent(higher, 'Down');
+shouldBe('higher.value', 'higher.max');
+
+parent.innerHTML = '';
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d2fcc8d..b0c9e6e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-04  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Spin-button behavior improvement for out-of-range values
+        https://bugs.webkit.org/show_bug.cgi?id=43463
+
+        If the current value is smaller than the minimum value, the up
+        button should change the value to the minimum value. If the
+        current value is larger than the maximum value, the down button
+        should change the value to the maximum value.
+
+        Test: fast/forms/input-number-outofrange.html
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::stepUpFromRenderer):
+
 2010-08-04  Antonio Gomes  <tonikitoo at webkit.org>
 
         Reviewed by Daniel Bates.
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index b4e5452..f87a65f 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -2817,10 +2817,16 @@ HTMLOptionElement* HTMLInputElement::selectedOption() const
 
 void HTMLInputElement::stepUpFromRenderer(int n)
 {
-    // The difference from stepUp()/stepDown() is:
-    // If the current value is invalid, the value will be
-    //  - the minimum value if n > 0
-    //  - the maximum value if n < 0
+    // The differences from stepUp()/stepDown():
+    // If the current value is not a number, the value will be
+    //  - The value should be the minimum value if n > 0
+    //  - The value should be the maximum value if n < 0
+    // If the current value is smaller than the minimum value:
+    //  - The value should be the minimum value if n > 0
+    //  - Nothing should happen if n < 0
+    // If the current value is larger than the maximum value:
+    //  - The value should be the maximum value if n < 0
+    //  - Nothing should happen if n > 0
 
     ASSERT(hasSpinButton());
     if (!hasSpinButton())
@@ -2832,7 +2838,7 @@ void HTMLInputElement::stepUpFromRenderer(int n)
     const double nan = numeric_limits<double>::quiet_NaN();
     String currentStringValue = value();
     double current = parseToDouble(currentStringValue, nan);
-    if (!isfinite(current))
+    if (!isfinite(current) || (n > 0 && current < minimum()) || (n < 0 && current > maximum()))
         setValue(serialize(n > 0 ? minimum() : maximum()));
     else {
         ExceptionCode ec;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list