Changeset 50038 in webkit


Ignore:
Timestamp:
Oct 24, 2009 9:13:13 PM (14 years ago)
Author:
bweinstein@apple.com
Message:

Fixes <https://bugs.webkit.org/show_bug.cgi?id=30752>.
Web Inspector: Multiple Selection on Scope Bars by default Conflicts with other behavior on OSX.

Reviewed by Timothy Hatcher.

Have the scope bars select one scope by default, but if the multiple selection key
is pressed, allow for multiple selection.

  • inspector/front-end/ConsoleView.js:

(WebInspector.ConsoleView):
(WebInspector.ConsoleView.prototype._updateFilter):
(WebInspector.ConsoleView.prototype.filter):

  • inspector/front-end/ResourcesPanel.js:

(WebInspector.ResourcesPanel):
(WebInspector.ResourcesPanel.prototype.filter):
(WebInspector.ResourcesPanel.prototype._updateFilter):

Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r50037 r50038  
     12009-10-24  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Fixes <https://bugs.webkit.org/show_bug.cgi?id=30752>.
     6        Web Inspector: Multiple Selection on Scope Bars by default Conflicts with other behavior on OSX.
     7       
     8        Have the scope bars select one scope by default, but if the multiple selection key
     9        is pressed, allow for multiple selection.
     10
     11        * inspector/front-end/ConsoleView.js:
     12        (WebInspector.ConsoleView):
     13        (WebInspector.ConsoleView.prototype._updateFilter):
     14        (WebInspector.ConsoleView.prototype.filter):
     15        * inspector/front-end/ResourcesPanel.js:
     16        (WebInspector.ResourcesPanel):
     17        (WebInspector.ResourcesPanel.prototype.filter):
     18        (WebInspector.ResourcesPanel.prototype._updateFilter):
     19
    1202009-10-24  Sam Weinig  <sam@webkit.org>
    221
  • trunk/WebCore/inspector/front-end/ConsoleView.js

    r49917 r50038  
    9595    this.logElement = createFilterElement.call(this, "Logs");
    9696
    97     this.filter(this.allElement);
     97    this.filter(this.allElement, false);
    9898}
    9999
     
    102102    _updateFilter: function(e)
    103103    {
    104         this.filter(e.target);
     104        var isMac = InspectorController.platform().indexOf("mac-") === 0;
     105        var selectMultiple = false;
     106        if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey)
     107            selectMultiple = true;
     108        if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey)
     109            selectMultiple = true;
     110
     111        this.filter(e.target, selectMultiple);
    105112    },
    106113   
    107     filter: function(target)
    108     {
     114    filter: function(target, selectMultiple)
     115    {
     116        function unselectAll()
     117        {
     118            this.allElement.removeStyleClass("selected");
     119            this.errorElement.removeStyleClass("selected");
     120            this.warningElement.removeStyleClass("selected");
     121            this.logElement.removeStyleClass("selected");
     122           
     123            this.messagesElement.removeStyleClass("filter-all");
     124            this.messagesElement.removeStyleClass("filter-errors");
     125            this.messagesElement.removeStyleClass("filter-warnings");
     126            this.messagesElement.removeStyleClass("filter-logs");
     127        }
     128       
     129        var targetFilterClass = "filter-" + target.category.toLowerCase();
     130
    109131        if (target.category == "All") {
    110132            if (target.hasStyleClass("selected")) {
     
    112134                return;
    113135            }
    114            
    115             this.errorElement.removeStyleClass("selected");
    116             this.warningElement.removeStyleClass("selected");
    117             this.logElement.removeStyleClass("selected");
    118            
    119             document.getElementById("console-messages").removeStyleClass("filter-errors");
    120             document.getElementById("console-messages").removeStyleClass("filter-warnings");
    121             document.getElementById("console-messages").removeStyleClass("filter-logs");
     136
     137            unselectAll.call(this);
    122138        } else {
    123139            // Something other than all is being selected, so we want to unselect all
    124140            if (this.allElement.hasStyleClass("selected")) {
    125141                this.allElement.removeStyleClass("selected");
    126                 document.getElementById("console-messages").removeStyleClass("filter-all");
     142                this.messagesElement.removeStyleClass("filter-all");
    127143            }
     144        }
     145       
     146        if (!selectMultiple) {
     147            // If multiple selection is off, we want to unselect everything else
     148            // and just select ourselves.
     149            unselectAll.call(this);
     150           
     151            target.addStyleClass("selected");
     152            this.messagesElement.addStyleClass(targetFilterClass);
     153           
     154            return;
    128155        }
    129156       
    130157        if (target.hasStyleClass("selected")) {
     158            // If selectMultiple is turned on, and we were selected, we just
     159            // want to unselect ourselves.
    131160            target.removeStyleClass("selected");
    132             var newClass = "filter-" + target.category.toLowerCase();
    133             var filterElement = document.getElementById("console-messages");
    134             filterElement.removeStyleClass(newClass);
     161            this.messagesElement.removeStyleClass(targetFilterClass);
    135162        } else {
     163            // If selectMultiple is turned on, and we weren't selected, we just
     164            // want to select ourselves.
    136165            target.addStyleClass("selected");
    137             var newClass = "filter-" + target.category.toLowerCase();
    138             var filterElement = document.getElementById("console-messages");
    139             filterElement.addStyleClass(newClass);
     166            this.messagesElement.addStyleClass(targetFilterClass);
    140167        }
    141168    },
  • trunk/WebCore/inspector/front-end/ResourcesPanel.js

    r50036 r50038  
    165165        createFilterElement.call(this, category);
    166166
    167     this.filter(this.allElement);
     167    this.filter(this.allElement, false);
    168168
    169169    this.reset();
     
    186186    },
    187187
    188     filter: function(target)
    189     {
     188    filter: function(target, selectMultiple)
     189    {
     190        function unselectAll()
     191        {
     192            for (var i = 0; i < this.filterBarElement.childNodes.length; ++i) {
     193                var child = this.filterBarElement.childNodes[i];
     194                if (!child.category)
     195                    continue;
     196               
     197                child.removeStyleClass("selected");
     198               
     199                var filterClass = "filter-" + child.category.toLowerCase();
     200                this.resourcesGraphsElement.removeStyleClass(filterClass);
     201                this.resourcesTreeElement.childrenListElement.removeStyleClass(filterClass);
     202            }
     203        }
     204       
     205        var targetFilterClass = "filter-" + target.category.toLowerCase();
     206
    190207        if (target === this.allElement) {
    191208            if (target.hasStyleClass("selected")) {
     
    195212
    196213            // If All wasn't selected, and now is, unselect everything else.
    197             for (var i = 0; i < this.filterBarElement.childNodes.length; ++i) {
    198                 var child = this.filterBarElement.childNodes[i];
    199                 if (!child.category)
    200                     continue;
    201 
    202                 if (child !== this.allElement)
    203                     child.removeStyleClass("selected");
    204 
    205                 var filterClass = "filter-" + child.category.toLowerCase();
    206                 this.resourcesGraphsElement.removeStyleClass(filterClass);
    207                 this.resourcesTreeElement.childrenListElement.removeStyleClass(filterClass);
    208             }
     214            unselectAll.call(this);
    209215        } else {
    210216            // Something other than All is being selected, so we want to unselect All.
     
    215221            }
    216222        }
     223       
     224        if (!selectMultiple) {
     225            // If multiple selection is off, we want to unselect everything else
     226            // and just select ourselves.
     227            unselectAll.call(this);
     228           
     229            target.addStyleClass("selected");
     230            this.resourcesGraphsElement.addStyleClass(targetFilterClass);
     231            this.resourcesTreeElement.childrenListElement.addStyleClass(targetFilterClass);
     232           
     233            return;
     234        }
    217235
    218236        if (target.hasStyleClass("selected")) {
     237            // If selectMultiple is turned on, and we were selected, we just
     238            // want to unselect ourselves.
    219239            target.removeStyleClass("selected");
    220240
    221             var filterClass = "filter-" + target.category.toLowerCase();
    222             this.resourcesGraphsElement.removeStyleClass(filterClass);
    223             this.resourcesTreeElement.childrenListElement.removeStyleClass(filterClass);
     241            this.resourcesGraphsElement.removeStyleClass(targetFilterClass);
     242            this.resourcesTreeElement.childrenListElement.removeStyleClass(targetFilterClass);
    224243        } else {
     244            // If selectMultiple is turned on, and we weren't selected, we just
     245            // want to select ourselves.
    225246            target.addStyleClass("selected");
    226247
    227             var filterClass = "filter-" + target.category.toLowerCase();
    228             this.resourcesGraphsElement.addStyleClass(filterClass);
    229             this.resourcesTreeElement.childrenListElement.addStyleClass(filterClass);
     248            this.resourcesGraphsElement.addStyleClass(targetFilterClass);
     249            this.resourcesTreeElement.childrenListElement.addStyleClass(targetFilterClass);
    230250        }
    231251    },
     
    238258    _updateFilter: function(e)
    239259    {
    240         this.filter(e.target);
     260        var isMac = InspectorController.platform().indexOf("mac-") === 0;
     261        var selectMultiple = false;
     262        if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey)
     263            selectMultiple = true;
     264        if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey)
     265            selectMultiple = true;
     266       
     267        this.filter(e.target, selectMultiple);
    241268    },
    242269
Note: See TracChangeset for help on using the changeset viewer.