Bug 20273

Summary: Allow incrementing/decrementing numbers in editable style properties with arrow keys
Product: WebKit Reporter: Timothy Hatcher <timothy>
Component: Web Inspector (Deprecated)Assignee: Timothy Hatcher <timothy>
Status: RESOLVED FIXED    
Severity: Enhancement CC: aroben, rik
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch 1 of 2
aroben: review+
Patch 2 of 2 aroben: review+

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.