Closed Bug 891556 Opened 11 years ago Closed 11 years ago

Add Ctrl-Shift-C (Cmd-Opt-C) shortcut to toggle highlighting

Categories

(DevTools :: Inspector, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 25

People

(Reporter: harth, Assigned: bgrins)

References

(Blocks 1 open bug)

Details

(Whiteboard: [landed-in-fxteam])

Attachments

(1 file, 4 obsolete files)

Currently we don't have a shortcut to toggle the highlighter. We need this. Chrome uses Ctrl-Shift-C (Cmd-Opt-C), and it's available in Mac/Win at least.

If the toolbox is open, this will switch to the Inspector tab and start the highlighter. If the toolbox is closed, it will open the devtools window with the Inspector tab selected and start highlighting. If the inspector tab is already open, this will just start highlighting. And if the highlighter happens to be on, this will stop highlighting.
Assignee: nobody → bgrinstead
Attached patch bug-891556-1.patch (obsolete) — Splinter Review
Flags: needinfo?(fayearthur)
Status: NEW → ASSIGNED
Attached patch bug-891556-2.patch (obsolete) — Splinter Review
Version that works, except for when devtools is undocked and you are focused on the web
Attachment #783905 - Attachment is obsolete: true
Attachment #784059 - Flags: feedback?
Attached patch bug-891556-3.patch (obsolete) — Splinter Review
This patch implements the cmd+alt+c keyboard shortcut for toggling highlighting, and fixes another issue that happened when devtools were undocked *and* focused - keyboard shortcuts would not fire in the same way.  This is because _addKeysToWindow (toolbox.js) was actually running different logic than selectToolCommand (gDevTools.jsm).  Rather than trying to figure out a way to pass gBrowser to selectToolCommand from toolbox.js (which is not possible AFAIK), I implemented a fireCustomKey instance method  on the toolbox.  This way at least some of the logic can be shared between gDevTools and toolbox.  It will take a while to work out how to properly test this, so this patch is still a WIP.
Attachment #784059 - Attachment is obsolete: true
Attachment #784059 - Flags: feedback?
Flags: needinfo?(fayearthur)
Attached patch bug-891556-4.patch (obsolete) — Splinter Review
Adds a basic keybinding test for the panels.  The behavior is such that on inspector, pressing ctrl+shift+c/cmd+alt+c will always switch to inspector tab and toggle highlighter.  For the other panels, they will continue to switch to their tab if not already selected, or close devtools otherwise.  The behavior for other tabs is different when devtools in undocked, since it will never close the window.  For inspector, the behavior is the same when docked and undocked.  Had to work around a situation where the keyboard shortcut for inspector did not work when the devtools window was focused (_addKeysToWindow had to be modified to fix this).
Attachment #784535 - Attachment is obsolete: true
Attachment #785086 - Flags: review?(jwalker)
Comment on attachment 785086 [details] [diff] [review]
bug-891556-4.patch

Review of attachment 785086 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/devtools/framework/gDevTools.jsm
@@ +349,3 @@
>  
>      if (toolbox && toolbox.currentToolId == toolId) {
> +      let customKeyHandled = toolbox.fireCustomKey(toolId);

As discussed, we can probably find a more obvious solution than this, perhaps using a property to indicate how the tool wants to handle toggling.

::: browser/devtools/framework/toolbox.js
@@ +285,5 @@
> +
> +    if (activeToolDefinition.onkey && this.currentToolId === toolId) {
> +        activeToolDefinition.onkey(this.getCurrentPanel());
> +        return true;
> +    }

I know that undefined==false, but I still think it makes sense to 'return false;' here in case anyone assumes a boolean.
Attachment #785086 - Flags: review?(jwalker) → review+
Fixes minor issues from previous patch
Attachment #785086 - Attachment is obsolete: true
Joe,
Can you push this to try?
Flags: needinfo?(jwalker)
https://hg.mozilla.org/mozilla-central/rev/9e0f2aef72e3
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 25
Depends on: 907891
Blocks: 934088
FYI this new shortcut conflicts with Firebug.[1]

> Currently we don't have a shortcut to toggle the highlighter.
Actually you already had Ctrl+Shift+I for it since you introduced the inspector.

Sebastian

[1] http://code.google.com/p/fbug/issues/detail?id=6957
Any tips, how Firebug can simply override the default Ctrl+Shift+C shortcut?

Honza
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: