Changed Option/Alt-Up or Down in CSS editing when the value is
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Aug 2008 04:28:16 +0000 (04:28 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Aug 2008 04:28:16 +0000 (04:28 +0000)
        near zero to jump to the next integer.

        Reviewed by Tim Hatcher.

        https://bugs.webkit.org/show_bug.cgi?id=20326

        * page/inspector/StylesSidebarPane.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35678 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/page/inspector/StylesSidebarPane.js

index fb87201..57bd369 100644 (file)
@@ -1,5 +1,16 @@
 2008-08-11  Anthony Ricaud  <rik24d@gmail.com>
 
+        Changed Option/Alt-Up or Down in CSS editing when the value is
+        near zero to jump to the next integer.
+
+        Reviewed by Tim Hatcher.
+
+        https://bugs.webkit.org/show_bug.cgi?id=20326
+
+        * page/inspector/StylesSidebarPane.js:
+
+2008-08-11  Anthony Ricaud  <rik24d@gmail.com>
+
         Changed the line highlight transition for an easier animation.
 
         Reviewed by Tim Hatcher.
index a4b6229..8f290bb 100644 (file)
@@ -726,22 +726,29 @@ WebInspector.StylePropertyTreeElement.prototype = {
             else if (number === -1 && event.keyIdentifier === "Up")
                 numberNearZero = true;
 
-            // 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 && pageKeyPressed)
-                changeAmount = 100;
-            else if (event.shiftKey || pageKeyPressed)
-                changeAmount = 10;
-            else if (event.altKey || numberNearZero)
-                changeAmount = 0.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.
-            number = Number((number + changeAmount).toFixed(6));
+            if (numberNearZero && event.altKey && arrowKeyPressed) {
+                if (event.keyIdentifier === "Down")
+                    number = Math.ceil(number - 1);
+                else
+                    number = 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 && pageKeyPressed)
+                    changeAmount = 100;
+                else if (event.shiftKey || pageKeyPressed)
+                    changeAmount = 10;
+                else if (event.altKey || numberNearZero)
+                    changeAmount = 0.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.
+                number = Number((number + changeAmount).toFixed(6));
+            }
 
             replacementString = prefix + number + suffix;
         } else {