Web Inspector: [file selector dialog] for mixed case queries, score uppercase letters...
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 18:49:10 +0000 (18:49 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 18:49:10 +0000 (18:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108639

Reviewed by Vsevolod Vlasov.

Source/WebCore:

* inspector/front-end/FilteredItemSelectionDialog.js:
(WebInspector.FilteredItemSelectionDialog.prototype._createScoringRegex):

LayoutTests:

* inspector/filtered-item-selection-dialog-filtering-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141607 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/filtered-item-selection-dialog-filtering-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js

index e6b5894..ac87393 100644 (file)
@@ -1,3 +1,12 @@
+2013-02-01  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: [file selector dialog] for mixed case queries, score uppercase letters only when assessing camelcase.
+        https://bugs.webkit.org/show_bug.cgi?id=108639
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/filtered-item-selection-dialog-filtering-expected.txt:
+
 2013-02-01  Robert Hogan  <robert@webkit.org>
 
         Padding in a parent inline preceding an empty inline child should be counted towards width
index 12691b6..cec1e9e 100644 (file)
@@ -9,7 +9,7 @@ Output:["a","bc"]
 Case sensitive matching
 Query:"aB"
 Input:["abc","acB"]
-Output:["abc","acB"]
+Output:["acB","abc"]
 
 Case insensitive matching
 Query:"ab"
@@ -29,7 +29,7 @@ Output:["^[]{}()\\.$*+?|"]
 Camel case matching
 Query:"fBaB"
 Input:["fooBarBaz","FooBarBaz","Foo_Bar_Baz","foo_bar_baz","foobarbaz","foobarBaz","afooBarBaz","aFooBarBaz","a fooBarBaz","fooBorBaz","fooBorCaz"]
-Output:["fooBarBaz","foo_bar_baz","foobarBaz","foobarbaz","FooBarBaz","Foo_Bar_Baz","a fooBarBaz","aFooBarBaz","afooBarBaz"]
+Output:["fooBarBaz","FooBarBaz","Foo_Bar_Baz","a fooBarBaz","aFooBarBaz","afooBarBaz","foo_bar_baz","foobarBaz","foobarbaz"]
 
 Underscore matching
 Query:"fO_ba_b"
index 5a6d13b..79ebb6a 100644 (file)
@@ -1,3 +1,13 @@
+2013-02-01  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: [file selector dialog] for mixed case queries, score uppercase letters only when assessing camelcase.
+        https://bugs.webkit.org/show_bug.cgi?id=108639
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/front-end/FilteredItemSelectionDialog.js:
+        (WebInspector.FilteredItemSelectionDialog.prototype._createScoringRegex):
+
 2013-02-01  Robert Hogan  <robert@webkit.org>
 
         Padding in a parent inline preceding an empty inline child should be counted towards width
index 96352fe..3ced882 100644 (file)
@@ -190,12 +190,14 @@ WebInspector.FilteredItemSelectionDialog.prototype = {
 
     /**
      * @param {string} query
+     * @param {boolean} ignoreCase
      * @param {boolean} camelCase
      * @return {RegExp}
      */
-    _createScoringRegex: function(query, camelCase)
+    _createScoringRegex: function(query, ignoreCase, camelCase)
     {
-        query = query.toUpperCase();
+        if (!camelCase || (camelCase && ignoreCase))
+            query = query.toUpperCase();
         var regexString = "";
         for (var i = 0; i < query.length; ++i) {
             var c = query.charAt(i);
@@ -220,8 +222,8 @@ WebInspector.FilteredItemSelectionDialog.prototype = {
         var ignoreCase = (query === query.toLowerCase());
 
         var filterRegex = query ? this._createSearchRegex(query) : null;
-        var camelCaseScoringRegex = query ? this._createScoringRegex(query, true) : null;
-        var underscoreScoringRegex = query ? this._createScoringRegex(query, false) : null;
+        var camelCaseScoringRegex = query ? this._createScoringRegex(query, ignoreCase, true) : null;
+        var underscoreScoringRegex = query ? this._createScoringRegex(query, ignoreCase, false) : null;
 
         var oldSelectedAbsoluteIndex = this._filteredItems[this._selectedIndexInFiltered];
         this._filteredItems = [];