Changeset 34740 in webkit


Ignore:
Timestamp:
Jun 23, 2008 10:33:49 AM (16 years ago)
Author:
timothy@apple.com
Message:

Make profiles of the same name in the Inspector group in the
sidebar under a collapsable item that contains all the runs.

https://bugs.webkit.org/show_bug.cgi?id=19713

Reviewed by Darin Adler.

  • English.lproj/localizedStrings.js: New strings.
  • page/inspector/Images/profileGroupIcon.png: Added.
  • page/inspector/Images/profileSmallIcon.png: Added.
  • page/inspector/ProfilesPanel.js: (WebInspector.ProfilesPanel.prototype.reset): Clear _profileGroups. Remove the "some-expandable" class from the sidebarTree. (WebInspector.ProfilesPanel.prototype.addProfile): Append new profiles that have the same name as a previous profile into a group. When a group has 2 profiles a ProfileGroupSidebarTreeElement is made and the ProfileSidebarTreeElements are appended to the group's element. (WebInspector.ProfileSidebarTreeElement.prototype.get mainTitle): Return _mainTitle is it is set. (WebInspector.ProfileSidebarTreeElement.prototype.set mainTitle): Set _mainTitle which is an override title. (WebInspector.ProfileGroupSidebarTreeElement): Inherit SidebarTreeElement. (WebInspector.ProfileGroupSidebarTreeElement.prototype.onselect): Show the last profile in the group when selected.
  • page/inspector/SidebarTreeElement.js: (WebInspector.SidebarTreeElement.prototype.get small): Return _small. (WebInspector.SidebarTreeElement.prototype.set small): Set _small and update the style to match. (WebInspector.SidebarTreeElement.prototype.onattach): Set the small class if the small property is true.
  • page/inspector/inspector.css: New styles for profiles groups and for the small profiles.
Location:
trunk/WebCore
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r34739 r34740  
     12008-06-23  Timothy Hatcher  <timothy@apple.com>
     2
     3        Make profiles of the same name in the Inspector group in the
     4        sidebar under a collapsable item that contains all the runs.
     5
     6        https://bugs.webkit.org/show_bug.cgi?id=19713
     7
     8        Reviewed by Darin Adler.
     9
     10        * English.lproj/localizedStrings.js: New strings.
     11        * page/inspector/Images/profileGroupIcon.png: Added.
     12        * page/inspector/Images/profileSmallIcon.png: Added.
     13        * page/inspector/ProfilesPanel.js:
     14        (WebInspector.ProfilesPanel.prototype.reset): Clear _profileGroups.
     15        Remove the "some-expandable" class from the sidebarTree.
     16        (WebInspector.ProfilesPanel.prototype.addProfile): Append new profiles
     17        that have the same name as a previous profile into a group. When a
     18        group has 2 profiles a ProfileGroupSidebarTreeElement is made and the
     19        ProfileSidebarTreeElements are appended to the group's element.
     20        (WebInspector.ProfileSidebarTreeElement.prototype.get mainTitle):
     21        Return _mainTitle is it is set.
     22        (WebInspector.ProfileSidebarTreeElement.prototype.set mainTitle):
     23        Set _mainTitle which is an override title.
     24        (WebInspector.ProfileGroupSidebarTreeElement): Inherit SidebarTreeElement.
     25        (WebInspector.ProfileGroupSidebarTreeElement.prototype.onselect):
     26        Show the last profile in the group when selected.
     27        * page/inspector/SidebarTreeElement.js:
     28        (WebInspector.SidebarTreeElement.prototype.get small): Return _small.
     29        (WebInspector.SidebarTreeElement.prototype.set small): Set _small and
     30        update the style to match.
     31        (WebInspector.SidebarTreeElement.prototype.onattach): Set the small
     32        class if the small property is true.
     33        * page/inspector/inspector.css: New styles for profiles groups
     34        and for the small profiles.
     35
    1362008-06-23  Anders Carlsson  <andersca@apple.com>
    237
  • trunk/WebCore/page/inspector/ProfilesPanel.js

    r34072 r34740  
    106106
    107107        this._profiles = [];
     108        this._profileGroups = {};
     109
     110        this.sidebarTreeElement.removeStyleClass("some-expandable");
    108111
    109112        this.sidebarTree.removeChildren();
     
    122125        this._profiles.push(profile);
    123126
     127        var sidebarParent = this.sidebarTree;
     128        var small = false;
     129        var alternateTitle;
     130
     131        if (profile.title !== "org.webkit.profiles.user-initiated") {
     132            if (!(profile.title in this._profileGroups))
     133                this._profileGroups[profile.title] = [];
     134
     135            var group = this._profileGroups[profile.title];
     136            group.push(profile);
     137
     138            if (group.length === 2) {
     139                // Make a group TreeElement now that there are 2 profiles.
     140                group._profilesTreeElement = new WebInspector.ProfileGroupSidebarTreeElement(profile.title);
     141
     142                // Insert at the same index for the first profile of the group.
     143                var index = this.sidebarTree.children.indexOf(group[0]._profilesTreeElement);
     144                this.sidebarTree.insertChild(group._profilesTreeElement, index);
     145
     146                // Move the first profile to the group.
     147                var selected = group[0]._profilesTreeElement.selected;
     148                this.sidebarTree.removeChild(group[0]._profilesTreeElement);
     149                group._profilesTreeElement.appendChild(group[0]._profilesTreeElement);
     150                if (selected) {
     151                    group[0]._profilesTreeElement.select();
     152                    group[0]._profilesTreeElement.reveal();
     153                }
     154
     155                group[0]._profilesTreeElement.small = true;
     156                group[0]._profilesTreeElement.mainTitle = WebInspector.UIString("Run %d", 1);
     157
     158                this.sidebarTreeElement.addStyleClass("some-expandable");
     159            }
     160
     161            if (group.length >= 2) {
     162                sidebarParent = group._profilesTreeElement;
     163                alternateTitle = WebInspector.UIString("Run %d", group.length);
     164                small = true;
     165            }
     166        }
     167
    124168        var profileTreeElement = new WebInspector.ProfileSidebarTreeElement(profile);
     169        profileTreeElement.small = small;
     170        if (alternateTitle)
     171            profileTreeElement.mainTitle = alternateTitle;
    125172        profile._profilesTreeElement = profileTreeElement;
    126173
    127         this.sidebarTree.appendChild(profileTreeElement);
     174        sidebarParent.appendChild(profileTreeElement);
    128175    },
    129176
     
    256303    get mainTitle()
    257304    {
     305        if (this._mainTitle)
     306            return this._mainTitle;
    258307        if (this.profile.title === "org.webkit.profiles.user-initiated")
    259308            return WebInspector.UIString("Profile %d", this._profileNumber);
     
    263312    set mainTitle(x)
    264313    {
    265         // Can't change mainTitle.
     314        this._mainTitle = x;
     315        this.refreshTitles();
    266316    },
    267317
     
    278328
    279329WebInspector.ProfileSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
     330
     331WebInspector.ProfileGroupSidebarTreeElement = function(title, subtitle)
     332{
     333    WebInspector.SidebarTreeElement.call(this, "profile-group-sidebar-tree-item", title, subtitle, null, true);
     334}
     335
     336WebInspector.ProfileGroupSidebarTreeElement.prototype = {
     337    onselect: function()
     338    {
     339        WebInspector.panels.profiles.showProfile(this.children[this.children.length - 1].profile);
     340    }
     341}
     342
     343WebInspector.ProfileGroupSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
  • trunk/WebCore/page/inspector/SidebarTreeElement.js

    r34272 r34740  
    9898
    9999WebInspector.SidebarTreeElement.prototype = {
     100    get small()
     101    {
     102        return this._small;
     103    },
     104
     105    set small(x)
     106    {
     107        this._small = x;
     108
     109        if (this._listItemNode) {
     110            if (this._small)
     111                this._listItemNode.addStyleClass("small");
     112            else
     113                this._listItemNode.removeStyleClass("small");
     114        }
     115    },
     116
    100117    get mainTitle()
    101118    {
     
    164181            this._listItemNode.addStyleClass(this.className);
    165182
     183        if (this.small)
     184            this._listItemNode.addStyleClass("small");
     185
    166186        if (this.hasChildren && this.disclosureButton)
    167187            this._listItemNode.appendChild(this.disclosureButton);
  • trunk/WebCore/page/inspector/inspector.css

    r34694 r34740  
    24872487}
    24882488
     2489.profile-sidebar-tree-item.small .icon {
     2490    content: url(Images/profileSmallIcon.png);
     2491}
     2492
     2493.profile-group-sidebar-tree-item .icon {
     2494    content: url(Images/profileGroupIcon.png);
     2495}
     2496
    24892497.profile-view {
    24902498    display: none;
Note: See TracChangeset for help on using the changeset viewer.