WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
105523
Web Inspector: highlight occurences of word in DefaultTextEditor
https://bugs.webkit.org/show_bug.cgi?id=105523
Summary
Web Inspector: highlight occurences of word in DefaultTextEditor
Andrey Lushnikov
Reported
2012-12-20 03:14:57 PST
It would be convenient to highlight all occurrences of some identifier in a javascript code when user selects one of them (via text selection). This is done per-word in a Sublime Text 2 (i.e. it highlights word occurrences in text)
Attachments
Patch
(5.84 KB, patch)
2012-12-20 03:26 PST
,
Andrey Lushnikov
no flags
Details
Formatted Diff
Diff
Patch
(13.02 KB, patch)
2013-01-15 07:15 PST
,
Andrey Lushnikov
no flags
Details
Formatted Diff
Diff
Patch
(13.15 KB, patch)
2013-01-15 07:43 PST
,
Andrey Lushnikov
no flags
Details
Formatted Diff
Diff
Patch
(13.15 KB, patch)
2013-01-16 02:50 PST
,
Andrey Lushnikov
no flags
Details
Formatted Diff
Diff
word-highlight-screenshot
(18.42 KB, application/octet-stream)
2013-01-16 04:24 PST
,
Andrey Lushnikov
no flags
Details
Patch
(12.88 KB, patch)
2013-01-16 07:36 PST
,
Andrey Lushnikov
no flags
Details
Formatted Diff
Diff
feature demonstration
(16.73 KB, application/octet-stream)
2013-01-16 07:39 PST
,
Andrey Lushnikov
no flags
Details
Patch
(13.09 KB, patch)
2013-01-23 07:50 PST
,
Andrey Lushnikov
no flags
Details
Formatted Diff
Diff
Patch
(13.09 KB, patch)
2013-01-24 00:55 PST
,
Andrey Lushnikov
no flags
Details
Formatted Diff
Diff
Patch
(14.29 KB, patch)
2013-01-24 07:20 PST
,
Andrey Lushnikov
no flags
Details
Formatted Diff
Diff
Patch
(14.34 KB, patch)
2013-01-24 08:16 PST
,
Andrey Lushnikov
no flags
Details
Formatted Diff
Diff
Patch
(14.32 KB, patch)
2013-01-25 01:30 PST
,
Andrey Lushnikov
no flags
Details
Formatted Diff
Diff
Patch
(14.32 KB, patch)
2013-01-25 06:39 PST
,
Andrey Lushnikov
no flags
Details
Formatted Diff
Diff
Show Obsolete
(11)
View All
Add attachment
proposed patch, testcase, etc.
Andrey Lushnikov
Comment 1
2012-12-20 03:26:51 PST
Created
attachment 180314
[details]
Patch
Pavel Feldman
Comment 2
2012-12-20 04:22:19 PST
Comment on
attachment 180314
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=180314&action=review
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1344 > + function checkSelectedIdentifier(event) {
This should be a prototype method that you bind and pass into listeners.
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1346 > + if (selection.isCollapsed)
We already have selection stored in a variable in mainPanel
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1353 > + // The following conditions will:
WebKit strongly advises not using comments. We only use them when absolutely necessary.
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1369 > + if (className === "webkit-javascript-ident") {
Do not use "javascript" word in editor. What about css variables?
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1375 > + this.element.addEventListener("mousemove", checkSelectedIdentifier.bind(this), false);
"click"
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1377 > + this.element.addEventListener("keyup", checkSelectedIdentifier.bind(this), false);
we already track text mutations, why bothering about the keyboard events?
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1391 > + var elements = document.querySelectorAll(".webkit-javascript-ident");
Just repaintAll
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1401 > + var elements = document.querySelectorAll(".webkit-selected-identifier");
ditto
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2151 > + if (span.className === "webkit-javascript-ident" && this._selectedIdentifier && this._selectedIdentifier === content)
javascript word again...
Andrey Lushnikov
Comment 3
2013-01-15 07:07:41 PST
Clarifying title: highlighting not only identifier occurrences, but any word occurrences.
Andrey Lushnikov
Comment 4
2013-01-15 07:15:50 PST
Created
attachment 182761
[details]
Patch
Pavel Feldman
Comment 5
2013-01-15 07:28:08 PST
Comment on
attachment 182761
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=182761&action=review
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:3046 > + return this._deselect();
Although I would love to act alike, we don't do that.
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:3068 > + _select: function(selectedWord)
this naming is misleading - it does not mutate selection.
Andrey Lushnikov
Comment 6
2013-01-15 07:43:32 PST
Created
attachment 182771
[details]
Patch
WebKit Review Bot
Comment 7
2013-01-15 08:28:36 PST
Comment on
attachment 182771
[details]
Patch
Attachment 182771
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/15872928
New failing tests: inspector/editor/text-editor-highlight-token.html
Build Bot
Comment 8
2013-01-15 09:10:37 PST
Comment on
attachment 182771
[details]
Patch
Attachment 182771
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/15845990
New failing tests: inspector/editor/text-editor-highlight-token.html
Build Bot
Comment 9
2013-01-16 00:44:50 PST
Comment on
attachment 182771
[details]
Patch
Attachment 182771
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://queues.webkit.org/results/15900409
New failing tests: inspector/editor/text-editor-highlight-token.html
Andrey Lushnikov
Comment 10
2013-01-16 02:50:00 PST
Created
attachment 182948
[details]
Patch
Build Bot
Comment 11
2013-01-16 03:17:02 PST
Comment on
attachment 182948
[details]
Patch
Attachment 182948
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/15901413
New failing tests: inspector/editor/text-editor-highlight-token.html
Andrey Lushnikov
Comment 12
2013-01-16 04:24:08 PST
Created
attachment 182958
[details]
word-highlight-screenshot What's happening when you select some word
Andrey Lushnikov
Comment 13
2013-01-16 07:36:47 PST
Created
attachment 182979
[details]
Patch
Andrey Lushnikov
Comment 14
2013-01-16 07:39:34 PST
Created
attachment 182981
[details]
feature demonstration
Pavel Feldman
Comment 15
2013-01-16 08:50:34 PST
Comment on
attachment 182979
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=182979&action=review
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:3043 > + if (!range) {
if (!this._muteSelectionListener)
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:3055 > + if (selectedText == this._selectedWord)
===
> Source/WebCore/inspector/front-end/DefaultTextEditor.js:3077 > + this._mainPanel.highlightRegex(this._activeRegex, "text-editor-token-highlight")
this._muteSelectionListener = true; this._mainPanel.highlightRegex(this._activeRegex, "text-editor-token-highlight"); delete this._muteSelectionListener;
Andrey Lushnikov
Comment 16
2013-01-21 02:45:44 PST
Comment on
attachment 182979
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=182979&action=review
>> Source/WebCore/inspector/front-end/DefaultTextEditor.js:3043 >> + if (!range) { > > if (!this._muteSelectionListener)
_muteSelectionListener doesn't work here (see below).
>> Source/WebCore/inspector/front-end/DefaultTextEditor.js:3055 >> + if (selectedText == this._selectedWord) > > ===
my bad; fixed.
>> Source/WebCore/inspector/front-end/DefaultTextEditor.js:3077 >> + this._mainPanel.highlightRegex(this._activeRegex, "text-editor-token-highlight") > > this._muteSelectionListener = true; > this._mainPanel.highlightRegex(this._activeRegex, "text-editor-token-highlight"); > delete this._muteSelectionListener;
this doesn't work because events happen on the next scheduled frame.
Andrey Lushnikov
Comment 17
2013-01-23 07:50:16 PST
Created
attachment 184235
[details]
Patch
Pavel Feldman
Comment 18
2013-01-23 08:00:14 PST
Comment on
attachment 184235
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=184235&action=review
> LayoutTests/inspector/editor/text-editor-highlight-token.html:35 > + setTimeout(step2);
why setTimeout ?
Andrey Lushnikov
Comment 19
2013-01-23 08:39:34 PST
Comment on
attachment 184235
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=184235&action=review
>> LayoutTests/inspector/editor/text-editor-highlight-token.html:35 >> + setTimeout(step2); > > why setTimeout ?
That's because setSelection triggers "document.selectionChange" listeners which gonna be executed on next frame (and token highlighter is one of those listeners).
Build Bot
Comment 20
2013-01-23 19:06:25 PST
Comment on
attachment 184235
[details]
Patch
Attachment 184235
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/16063935
New failing tests: svg/as-image/img-preserveAspectRatio-support-2.html
Andrey Lushnikov
Comment 21
2013-01-24 00:55:24 PST
Created
attachment 184431
[details]
Patch
Pavel Feldman
Comment 22
2013-01-24 04:46:58 PST
Comment on
attachment 184431
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=184431&action=review
> LayoutTests/inspector/editor/text-editor-highlight-token.html:45 > + setTimeout(step1);
Bump it above step1. You should use selection listener here.
Andrey Lushnikov
Comment 23
2013-01-24 07:20:19 PST
Created
attachment 184487
[details]
Patch
WebKit Review Bot
Comment 24
2013-01-24 08:12:23 PST
Comment on
attachment 184487
[details]
Patch Rejecting
attachment 184487
[details]
from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=gce-cq-01', 'apply-attachment', '--no-update', '--non-interactive', 184487, '--port=chromium-xvfb']" exit_code: 2 cwd: /mnt/git/webkit-commit-queue Last 500 characters of output: atch: **** Can't create file /tmp/ppQlOiba : No space left on device fatal: pathspec 'LayoutTests/inspector/editor/text-editor-highlight-token-expected.txt' did not match any files Failed to git add LayoutTests/inspector/editor/text-editor-highlight-token-expected.txt. at /mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply line 448. Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', '--force', '--reviewer', 'Pavel Feldman']" exit_code: 2 cwd: /mnt/git/webkit-commit-queue Full output:
http://queues.webkit.org/results/16097229
Andrey Lushnikov
Comment 25
2013-01-24 08:16:16 PST
Created
attachment 184503
[details]
Patch
Andrey Lushnikov
Comment 26
2013-01-24 08:16:48 PST
Comment on
attachment 184503
[details]
Patch re-submitted last patch
WebKit Review Bot
Comment 27
2013-01-24 08:48:46 PST
Comment on
attachment 184503
[details]
Patch Rejecting
attachment 184503
[details]
from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=gce-cq-01', 'apply-attachment', '--no-update', '--non-interactive', 184503, '--port=chromium-xvfb']" exit_code: 2 cwd: /mnt/git/webkit-commit-queue Last 500 characters of output: atch: **** Can't create file /tmp/pp2s7yc3 : No space left on device fatal: pathspec 'LayoutTests/inspector/editor/text-editor-highlight-token-expected.txt' did not match any files Failed to git add LayoutTests/inspector/editor/text-editor-highlight-token-expected.txt. at /mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply line 448. Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', '--force', '--reviewer', 'Pavel Feldman']" exit_code: 2 cwd: /mnt/git/webkit-commit-queue Full output:
http://queues.webkit.org/results/16080734
Andrey Lushnikov
Comment 28
2013-01-25 01:30:04 PST
Created
attachment 184696
[details]
Patch
WebKit Review Bot
Comment 29
2013-01-25 03:16:34 PST
Comment on
attachment 184696
[details]
Patch Rejecting
attachment 184696
[details]
from commit-queue. New failing tests: fast/frames/parser-append-subframe-count.html Full output:
http://queues.webkit.org/results/16121280
Andrey Lushnikov
Comment 30
2013-01-25 06:39:53 PST
Created
attachment 184741
[details]
Patch
WebKit Review Bot
Comment 31
2013-01-25 08:23:30 PST
Comment on
attachment 184741
[details]
Patch Clearing flags on attachment: 184741 Committed
r140828
: <
http://trac.webkit.org/changeset/140828
>
WebKit Review Bot
Comment 32
2013-01-25 08:23:36 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug