Bug 119012 - Web Inspector: pressing the Cmd key over a CSS property should underline it immediately (jump to definition mode)
Summary: Web Inspector: pressing the Cmd key over a CSS property should underline it i...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-07-23 07:17 PDT by Antoine Quint
Modified: 2013-10-04 16:00 PDT (History)
5 users (show)

See Also:


Attachments
Patch (16.16 KB, patch)
2013-10-03 08:27 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch (19.26 KB, patch)
2013-10-04 06:22 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch for landing (19.26 KB, patch)
2013-10-04 14:00 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2013-07-23 07:17:36 PDT
When the user mouses over a CSS property in the styles panel and pressed the command key, it should underline directly so that it's clear that jump-to-definition is available. Right now, you need to move the mouse before the Cmd key press is registered.
Comment 1 Radar WebKit Bug Importer 2013-07-23 07:18:15 PDT
<rdar://problem/14521089>
Comment 2 Antoine Quint 2013-10-03 08:27:26 PDT
Created attachment 213249 [details]
Patch
Comment 3 Joseph Pecoraro 2013-10-03 11:11:27 PDT
Comment on attachment 213249 [details]
Patch

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

I think you can remove a bunch of code here now right? If CodeMirrorTokenTracking controller is always tracking when appropriate then:

    1. Make CodeMirrorTokenTrackingController.prototype.{start,stop}Tracking private, or roll them into _mouseEntered and _mouseLeft
    2. Remove CodeMirrorTokenTrackingController.prototype.tracking and code that uses it
      - Remove SourceCodeTextEditor.prototype._shouldTrackTokenHovering, _startTrackingTokenHoveringIfNeeded, _stopTrackingTokenHoveringIfNeeded, _debuggerDidPause
      - Remove registration and callers of _debuggerDidPause

The only thing I am unsure of is the bottom two lines of this patch (if we disable jump to symbol tracking by unpressing Cmd, the removal highlighted range). I suspect you can just remove the if tracking branch.

I'd like to see a follow up patch removing the dead code!

> Source/WebInspectorUI/ChangeLog:22
> +        tracking since otherwise pressing the Cmd key over a read-only editor could highlight the previously selected
> +        candidate of another editor.

Is that really true? Each editor gets a separate tokenTrackingController instance, how could a range be highlighted in a separate editor?

> Source/WebInspectorUI/UserInterface/Main.js:110
> +    window.addEventListener("mousemove", this._mousemoved.bind(this), true);

Style: "_mousemoved" => "_mouseMoved"
Comment 4 Antoine Quint 2013-10-03 13:05:51 PDT
(In reply to comment #3)
> (From update of attachment 213249 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=213249&action=review
> 
> I think you can remove a bunch of code here now right? If CodeMirrorTokenTracking controller is always tracking when appropriate then:
> 
>     1. Make CodeMirrorTokenTrackingController.prototype.{start,stop}Tracking private, or roll them into _mouseEntered and _mouseLeft
>     2. Remove CodeMirrorTokenTrackingController.prototype.tracking and code that uses it
>       - Remove SourceCodeTextEditor.prototype._shouldTrackTokenHovering, _startTrackingTokenHoveringIfNeeded, _stopTrackingTokenHoveringIfNeeded, _debuggerDidPause
>       - Remove registration and callers of _debuggerDidPause
> 
> The only thing I am unsure of is the bottom two lines of this patch (if we disable jump to symbol tracking by unpressing Cmd, the removal highlighted range). I suspect you can just remove the if tracking branch.
> 
> I'd like to see a follow up patch removing the dead code!

Most of the code I added ends up being specific to the NonSymbolTokens mode, I should see if I could shave off some code for the other mode too.

> > Source/WebInspectorUI/ChangeLog:22
> > +        tracking since otherwise pressing the Cmd key over a read-only editor could highlight the previously selected
> > +        candidate of another editor.
> 
> Is that really true? Each editor gets a separate tokenTrackingController instance, how could a range be highlighted in a separate editor?

Because the monitoring of key modifier changes is shared through all text editor instances. There's probably another way to deal with this though.

> > Source/WebInspectorUI/UserInterface/Main.js:110
> > +    window.addEventListener("mousemove", this._mousemoved.bind(this), true);
> 
> Style: "_mousemoved" => "_mouseMoved"

Thanks for spotting that.
Comment 5 Joseph Pecoraro 2013-10-03 13:44:43 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > (From update of attachment 213249 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=213249&action=review
> > 
> > > Source/WebInspectorUI/ChangeLog:22
> > > +        tracking since otherwise pressing the Cmd key over a read-only editor could highlight the previously selected
> > > +        candidate of another editor.
> > 
> > Is that really true? Each editor gets a separate tokenTrackingController instance, how could a range be highlighted in a separate editor?
> 
> Because the monitoring of key modifier changes is shared through all text editor instances. There's probably another way to deal with this though.

But shouldn't your mouse only be over one editor, so only that editor will have a candidate / update.

Maybe this is indicative of a bug? Maybe on mouseLeft we need to clear something? It already clears the tracking state, so many something should respect the tracking state?
Comment 6 Antoine Quint 2013-10-04 05:48:27 PDT
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > (From update of attachment 213249 [details] [details] [details])
> > > View in context: https://bugs.webkit.org/attachment.cgi?id=213249&action=review
> > > 
> > > > Source/WebInspectorUI/ChangeLog:22
> > > > +        tracking since otherwise pressing the Cmd key over a read-only editor could highlight the previously selected
> > > > +        candidate of another editor.
> > > 
> > > Is that really true? Each editor gets a separate tokenTrackingController instance, how could a range be highlighted in a separate editor?
> > 
> > Because the monitoring of key modifier changes is shared through all text editor instances. There's probably another way to deal with this though.
> 
> But shouldn't your mouse only be over one editor, so only that editor will have a candidate / update.
> 
> Maybe this is indicative of a bug? Maybe on mouseLeft we need to clear something? It already clears the tracking state, so many something should respect the tracking state?

Correct! I'll fix this in an updated patch coming up.
Comment 7 Antoine Quint 2013-10-04 06:22:05 PDT
Created attachment 213357 [details]
Patch
Comment 8 Joseph Pecoraro 2013-10-04 13:21:39 PDT
Comment on attachment 213357 [details]
Patch

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

r=me, thanks for cleaning up the dead code!

> Source/WebInspectorUI/ChangeLog:46
> +        "mouseleave" event hanling when we're in the "enabled" state. Additionally, the public

Typo: "hanling" => "handling"
Comment 9 Antoine Quint 2013-10-04 14:00:43 PDT
Created attachment 213398 [details]
Patch for landing
Comment 10 Antoine Quint 2013-10-04 14:01:07 PDT
(In reply to comment #8)
> (From update of attachment 213357 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=213357&action=review
> 
> r=me, thanks for cleaning up the dead code!

My pleasure, thanks for the thoughtful and thorough review!

> > Source/WebInspectorUI/ChangeLog:46
> > +        "mouseleave" event hanling when we're in the "enabled" state. Additionally, the public
> 
> Typo: "hanling" => "handling"

Will be fixed in commit.
Comment 11 WebKit Commit Bot 2013-10-04 16:00:29 PDT
Comment on attachment 213398 [details]
Patch for landing

Clearing flags on attachment: 213398

Committed r156923: <http://trac.webkit.org/changeset/156923>
Comment 12 WebKit Commit Bot 2013-10-04 16:00:32 PDT
All reviewed patches have been landed.  Closing bug.