Bug 20273 - Allow incrementing/decrementing numbers in editable style properties with arrow keys
Summary: Allow incrementing/decrementing numbers in editable style properties with arr...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Timothy Hatcher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-04 08:19 PDT by Timothy Hatcher
Modified: 2008-08-05 09:49 PDT (History)
2 users (show)

See Also:


Attachments
Patch 1 of 2 (8.96 KB, patch)
2008-08-04 13:14 PDT, Timothy Hatcher
aroben: review+
Details | Formatted Diff | Diff
Patch 2 of 2 (17.80 KB, patch)
2008-08-04 13:15 PDT, Timothy Hatcher
aroben: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Hatcher 2008-08-04 08:19:15 PDT
Firebug lets you increment/decrement numbers at the insertion point with the arrow keys. We should support this.
Comment 1 Timothy Hatcher 2008-08-04 13:14:40 PDT
Created attachment 22637 [details]
Patch 1 of 2
Comment 2 Timothy Hatcher 2008-08-04 13:15:15 PDT
Created attachment 22638 [details]
Patch 2 of 2
Comment 3 Adam Roben (:aroben) 2008-08-04 18:53:02 PDT
Comment on attachment 22637 [details]
Patch 1 of 2

I wonder if there's any way to reduce the code duplication in rangeOfWord?

r=me
Comment 4 Adam Roben (:aroben) 2008-08-04 19:07:51 PDT
Comment on attachment 22638 [details]
Patch 2 of 2

+        var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset , " \t\n\"':;,/()", this.listItemElement);

I think it would really improve readability to start putting these character sets into named variables, like cssValueDelimeters or something.

+            var changeAmount = (event.shiftKey ? 10 : ((event.altKey || numberNearZero) ? 0.1 : 1));

I think this would be a little clearer as if/elseif/else.

+        if ((shorthandProperty || individualProperty) in foundProperties)

I think you should put "(shorthandProperty || individualProperty) into a local variable since you keep repeating that construct.

Do you have any test cases to land with this?

r=me
Comment 5 Anthony Ricaud 2008-08-05 02:09:27 PDT
Firebug uses Page up and down to increase/decrease by ten (see http://getfirebug.com/keyboard.html). I'm not a huge fan of that shortcut but I'm mentioning this for compatibility between tools.
Comment 6 Timothy Hatcher 2008-08-05 09:49:23 PDT
Landed in r35560 and r35561.