Bug 85586 - Web Inspector: "Goto Function" filtering should be less restrictive.
Summary: Web Inspector: "Goto Function" filtering should be less restrictive.
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: eustas.bug
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-04 00:12 PDT by eustas.bug
Modified: 2012-10-12 04:06 PDT (History)
12 users (show)

See Also:


Attachments
Patch (6.09 KB, patch)
2012-05-04 00:26 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (8.06 KB, patch)
2012-05-05 07:47 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (8.60 KB, patch)
2012-05-05 08:11 PDT, eustas.bug
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description eustas.bug 2012-05-04 00:12:35 PDT
User is forced to use asterisks to find something that is not camel-cased, or if he can't remember what terms are camel cased.

This is not convenient.

My proposal:
  1) Avoid asterisks at all; new filtering should behave like old filtering with asterisk added after every input character;
  2) Optimization: do not create regexp for each item inside filtering loop;
Comment 1 eustas.bug 2012-05-04 00:26:48 PDT
Created attachment 140171 [details]
Patch
Comment 2 Pavel Feldman 2012-05-04 22:48:37 PDT
Comment on attachment 140171 [details]
Patch

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

> Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js:129
> +            if (this._checkItemAt(i)) {

To make things simple, I would structure the code as follows:

var regex = this._createSearchRegex(this._promptElement.value);
for (var i = ...) {
    if (regex.test(this._delegate.itemKeyAt(i))
        ...
}

Then method below would not be needed.

> Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js:195
> +        if (!query) {

The WebKit style for thise would be:

if (!query) {
    delete this._checkItemAt;
    return;
}

rest of the code here.

> Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js:204
> +            this._checkItemAt = checker.bind(this);

You should  never overwrite methods on the prototype.

> Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js:231
> +                c = c + "\\";

Escaping via appending \\ looks strange. Having test cases suggesting the behavior pattern would help understanding the logic.
Comment 3 eustas.bug 2012-05-05 07:41:24 PDT
Comment on attachment 140171 [details]
Patch

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

>> Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js:129
>> +            if (this._checkItemAt(i)) {
> 
> To make things simple, I would structure the code as follows:
> 
> var regex = this._createSearchRegex(this._promptElement.value);
> for (var i = ...) {
>     if (regex.test(this._delegate.itemKeyAt(i))
>         ...
> }
> 
> Then method below would not be needed.

Right you are, but i've tried to preserve original code structure.
Fixed.

>> Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js:195
>> +        if (!query) {
> 
> The WebKit style for thise would be:
> 
> if (!query) {
>     delete this._checkItemAt;
>     return;
> }
> 
> rest of the code here.

Thanks.

>> Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js:204
>> +            this._checkItemAt = checker.bind(this);
> 
> You should  never overwrite methods on the prototype.

OK

>> Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js:231
>> +                c = c + "\\";
> 
> Escaping via appending \\ looks strange. Having test cases suggesting the behavior pattern would help understanding the logic.

Oops. Fixed. Tests added
Comment 4 eustas.bug 2012-05-05 07:47:30 PDT
Created attachment 140398 [details]
Patch
Comment 5 eustas.bug 2012-05-05 08:11:18 PDT
Created attachment 140402 [details]
Patch
Comment 6 WebKit Review Bot 2012-05-06 15:19:00 PDT
Comment on attachment 140402 [details]
Patch

Clearing flags on attachment: 140402

Committed r116244: <http://trac.webkit.org/changeset/116244>
Comment 7 WebKit Review Bot 2012-05-06 15:19:05 PDT
All reviewed patches have been landed.  Closing bug.