Title: [98839] trunk
Revision
98839
Author
apav...@chromium.org
Date
2011-10-31 01:37:32 -0700 (Mon, 31 Oct 2011)

Log Message

Web Inspector: Using keyboard to increment/decrement units is inconsistent
https://bugs.webkit.org/show_bug.cgi?id=71119

Reviewed by Pavel Feldman.

Source/WebCore:

This change makes the behavior consistent with that described at http://trac.webkit.org/wiki/WebInspector

* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane.alteredFloatNumber):
(WebInspector.StylesSidebarPane.prototype._attributesModified):

LayoutTests:

* inspector/styles/up-down-numerics-and-colors-expected.txt:
* inspector/styles/up-down-numerics-and-colors.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (98838 => 98839)


--- trunk/LayoutTests/ChangeLog	2011-10-31 08:28:13 UTC (rev 98838)
+++ trunk/LayoutTests/ChangeLog	2011-10-31 08:37:32 UTC (rev 98839)
@@ -1,3 +1,13 @@
+2011-10-28  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: Using keyboard to increment/decrement units is inconsistent
+        https://bugs.webkit.org/show_bug.cgi?id=71119
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/styles/up-down-numerics-and-colors-expected.txt:
+        * inspector/styles/up-down-numerics-and-colors.html:
+
 2011-10-31  Andrey Kosyakov  <ca...@chromium.org>
 
         Unreviewed. compositing/visibility/visibility-image-layers.html fails on GPU.

Modified: trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors-expected.txt (98838 => 98839)


--- trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors-expected.txt	2011-10-31 08:28:13 UTC (rev 98838)
+++ trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors-expected.txt	2011-10-31 08:37:32 UTC (rev 98839)
@@ -9,7 +9,7 @@
 color: #EE3;
 
 Running: testAlterNumber
-opacity: 10.6;
+opacity: 11.6;
 
 Running: testAlterBigNumber
 -webkit-transform: rotate(1000000000000000065537deg);

Modified: trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors.html (98838 => 98839)


--- trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors.html	2011-10-31 08:28:13 UTC (rev 98838)
+++ trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors.html	2011-10-31 08:37:32 UTC (rev 98839)
@@ -48,8 +48,13 @@
         {
             var opacityTreeElement = section.findTreeElementWithName("opacity");
             opacityTreeElement.startEditing(opacityTreeElement.valueElement);
+            // 0.5 (initial)
+            opacityTreeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Up", false, true, false)); // Alt-Up
+            // 0.6
             opacityTreeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Up"));
+            // 1.6
             opacityTreeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("PageUp"));
+            // 11.6
             InspectorTest.addResult(opacityTreeElement.listItemElement.textContent);
             next();
         },

Modified: trunk/Source/WebCore/ChangeLog (98838 => 98839)


--- trunk/Source/WebCore/ChangeLog	2011-10-31 08:28:13 UTC (rev 98838)
+++ trunk/Source/WebCore/ChangeLog	2011-10-31 08:37:32 UTC (rev 98839)
@@ -1,3 +1,16 @@
+2011-10-28  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: Using keyboard to increment/decrement units is inconsistent
+        https://bugs.webkit.org/show_bug.cgi?id=71119
+
+        Reviewed by Pavel Feldman.
+
+        This change makes the behavior consistent with that described at http://trac.webkit.org/wiki/WebInspector
+
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylesSidebarPane.alteredFloatNumber):
+        (WebInspector.StylesSidebarPane.prototype._attributesModified):
+
 2011-10-29  Martin Robinson  <mrobin...@igalia.com>
 
         [GTK] Switch to a backing store approach for painting WebKitWebView

Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (98838 => 98839)


--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2011-10-31 08:28:13 UTC (rev 98838)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2011-10-31 08:37:32 UTC (rev 98839)
@@ -133,39 +133,25 @@
 WebInspector.StylesSidebarPane.alteredFloatNumber = function(number, event)
 {
     var arrowKeyPressed = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down");
-    // If the number is near zero or the number is one and the direction will take it near zero.
-    var numberNearZero = (number < 1 && number > -1);
-    if (number === 1 && event.keyIdentifier === "Down")
-        numberNearZero = true;
-    else if (number === -1 && event.keyIdentifier === "Up")
-        numberNearZero = true;
 
-    var result;
-    if (numberNearZero && event.altKey && arrowKeyPressed) {
-        if (event.keyIdentifier === "Down")
-            result = Math.ceil(number - 1);
-        else
-            result = Math.floor(number + 1);
-    } else {
-        // Jump by 10 when shift is down or jump by 0.1 when near zero or Alt/Option is down.
-        // Also jump by 10 for page up and down, or by 100 if shift is held with a page key.
-        var changeAmount = 1;
-        if (event.shiftKey && !arrowKeyPressed)
-            changeAmount = 100;
-        else if (event.shiftKey || !arrowKeyPressed)
-            changeAmount = 10;
-        else if (event.altKey || numberNearZero)
-            changeAmount = 0.1;
+    // Jump by 10 when shift is down or jump by 0.1 when Alt/Option is down.
+    // Also jump by 10 for page up and down, or by 100 if shift is held with a page key.
+    var changeAmount = 1;
+    if (event.shiftKey && !arrowKeyPressed)
+        changeAmount = 100;
+    else if (event.shiftKey || !arrowKeyPressed)
+        changeAmount = 10;
+    else if (event.altKey)
+        changeAmount = 0.1;
 
-        if (event.keyIdentifier === "Down" || event.keyIdentifier === "PageDown")
-            changeAmount *= -1;
+    if (event.keyIdentifier === "Down" || event.keyIdentifier === "PageDown")
+        changeAmount *= -1;
 
-        // Make the new number and constrain it to a precision of 6, this matches numbers the engine returns.
-        // Use the Number constructor to forget the fixed precision, so 1.100000 will print as 1.1.
-        result = Number((number + changeAmount).toFixed(6));
-        if (!String(result).match(WebInspector.StylesSidebarPane.CSSNumberRegex))
-            return null;
-    }
+    // Make the new number and constrain it to a precision of 6, this matches numbers the engine returns.
+    // Use the Number constructor to forget the fixed precision, so 1.100000 will print as 1.1.
+    var result = Number((number + changeAmount).toFixed(6));
+    if (!String(result).match(WebInspector.StylesSidebarPane.CSSNumberRegex))
+        return null;
 
     return result;
 }
@@ -284,7 +270,7 @@
         if (this.node !== event.data.node)
             return;
 
-        // Changing style attribute will anyways generate _styleInvalidated message. 
+        // Changing style attribute will anyways generate _styleInvalidated message.
         if (event.data.name === "style")
             return;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to