Bug 67127 - Web Inspector: Implement circular tabbing through the Styles sidebar pane contents
Summary: Web Inspector: Implement circular tabbing through the Styles sidebar pane con...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-29 07:34 PDT by Alexander Pavlov (apavlov)
Modified: 2011-09-07 08:15 PDT (History)
10 users (show)

See Also:


Attachments
[PATCH] Suggested solution (10.50 KB, patch)
2011-08-29 09:09 PDT, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
[PATCH] Simplified weird CSS property name/value field editor tabbing calculations (15.21 KB, patch)
2011-09-05 09:08 PDT, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
[PATCH] Extracted a hard part of the calculations into StylePropertiesSection (asked by yurys@chromium.org) (15.33 KB, patch)
2011-09-07 04:18 PDT, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
[PATCH] A minimally intrusive solution (11.37 KB, patch)
2011-09-07 07:11 PDT, Alexander Pavlov (apavlov)
yurys: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pavlov (apavlov) 2011-08-29 07:34:35 PDT
Currently hitting Tab/Enter on a blank new property in the last editable style cancels editing. If a user has done this in error, they will need to use their mouse to restart the style editing.

Instead, the editor should loop to the beginning end of the pane contents.
Comment 1 Alexander Pavlov (apavlov) 2011-08-29 09:09:58 PDT
Created attachment 105495 [details]
[PATCH] Suggested solution
Comment 2 Pavel Feldman 2011-08-29 12:28:24 PDT
Comment on attachment 105495 [details]
[PATCH] Suggested solution

Although I don't see any flags in the code, I suspect this could be implemented via adding less code. Can you track down the case when you jump from the last new property placeholder? The very moment when focus is about to leave the traversal?
Comment 3 Alexander Pavlov (apavlov) 2011-08-30 09:19:04 PDT
(In reply to comment #2)
> (From update of attachment 105495 [details])
> Although I don't see any flags in the code, I suspect this could be implemented via adding less code.

I will look into shortening the change.

> Can you track down the case when you jump from the last new property placeholder? The very moment when focus is about to leave the traversal?

What do you mean by this? Is there anything special about this case? Just a quick overview for editor navigation outside of currently edited properties (jumping between name-value gives a few more cases):

* source editor (jump from):
  1. ordinary property (may get deleted once the editor gets committed)
  2. blank new property
* target editor (jump to):
  1. selector of the same section
  2. selector of another section
  3. ordinary property of the same section
  4. ordinary property of another section
  5. blank new property of the same section
  6. blank new property of another section

11 combinations in total (1-4 excluded, as it is impossible), of which the new ones are (partly due to element.style not having a selector):
1-6 (Jump from the first element.style property backwards to a new blank property of the last editable section). This is handled by the lines 2035-2045.
2-5 (If there is only element.style and no matched rules, jump from element.style's blank property to itself)
2-6 (Jump from a blank new property of the last section to a blank new property of an empty element.style, or vice versa). These two cases (along with the already handled 2-1 and 2-2) are handled by the lines 2114-2128).

I'll try to come up with something shorter for these cases.
Comment 4 Alexander Pavlov (apavlov) 2011-09-05 09:08:36 PDT
Created attachment 106342 [details]
[PATCH] Simplified weird CSS property name/value field editor tabbing calculations
Comment 5 Alexander Pavlov (apavlov) 2011-09-07 04:18:25 PDT
Created attachment 106568 [details]
[PATCH] Extracted a hard part of the calculations into StylePropertiesSection (asked by yurys@chromium.org)
Comment 6 Pavel Feldman 2011-09-07 04:41:36 PDT
Comment on attachment 106568 [details]
[PATCH] Extracted a hard part of the calculations into StylePropertiesSection (asked by yurys@chromium.org)

View in context: https://bugs.webkit.org/attachment.cgi?id=106568&action=review

> Source/WebCore/inspector/front-end/StylesSidebarPane.js:941
> +            var candidateSection = this;

I'd rather introduce Section::firstSibling - it can be fetched via parent element momentarily. Also, I would expect these two changes to solve the problem being addressed. Why is it not the case?

> Source/WebCore/inspector/front-end/StylesSidebarPane.js:963
> +            var candidateSection = this;

ditto, Section::lastSibling
Comment 7 Alexander Pavlov (apavlov) 2011-09-07 07:11:20 PDT
Created attachment 106581 [details]
[PATCH] A minimally intrusive solution
Comment 8 Alexander Pavlov (apavlov) 2011-09-07 07:13:34 PDT
(In reply to comment #6)
> (From update of attachment 106568 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=106568&action=review
> 
> > Source/WebCore/inspector/front-end/StylesSidebarPane.js:941
> > +            var candidateSection = this;
> 
> I'd rather introduce Section::firstSibling - it can be fetched via parent element momentarily. Also, I would expect these two changes to solve the problem being addressed. Why is it not the case?

Added first/lastSibling.

This is not the case because originally we were never able to cross the top boundary of a style with no selector (element.style). I have made a small refactoring to allow this, and dropped all my previous changes to reduce the change as much as possible.

> > Source/WebCore/inspector/front-end/StylesSidebarPane.js:963
> > +            var candidateSection = this;
> 
> ditto, Section::lastSibling

Done.
Comment 9 Yury Semikhatsky 2011-09-07 08:01:55 PDT
Comment on attachment 106581 [details]
[PATCH] A minimally intrusive solution

View in context: https://bugs.webkit.org/attachment.cgi?id=106581&action=review

> Source/WebCore/inspector/front-end/StylesSidebarPane.js:944
> +                if (curSection === this)

This shouldn't be needed since there is no sibling after the last section.

> Source/WebCore/inspector/front-end/StylesSidebarPane.js:950
> +        return curSection.editable ? curSection : null;

return (curSection && curSection.editable) ? curSection : null;

> Source/WebCore/inspector/front-end/StylesSidebarPane.js:966
> +                curSection = curSection.previousSibling;

Ditto.

> Source/WebCore/inspector/front-end/StylesSidebarPane.js:970
> +        return curSection.editable ? curSection : null;

Ditto.
Comment 10 Alexander Pavlov (apavlov) 2011-09-07 08:15:20 PDT
Committed r94671: <http://trac.webkit.org/changeset/94671>