Changeset 62647 in webkit


Ignore:
Timestamp:
Jul 7, 2010 3:10:11 AM (14 years ago)
Author:
yurys@chromium.org
Message:

2010-07-06 Yury Semikhatsky <yurys@chromium.org>

Reviewed by Pavel Feldman.

Inspector should remember the size of sidebars set by the user
https://bugs.webkit.org/show_bug.cgi?id=19207

  • inspector/front-end/AbstractTimelinePanel.js: (WebInspector.AbstractTimelinePanel):
  • inspector/front-end/AuditsPanel.js: (WebInspector.AuditsPanel):
  • inspector/front-end/ConsolePanel.js: (WebInspector.ConsolePanel):
  • inspector/front-end/ElementsPanel.js: (WebInspector.ElementsPanel.prototype.rightSidebarResizerDragEnd):
  • inspector/front-end/Panel.js: (WebInspector.Panel): (WebInspector.Panel.prototype.get toolbarItemClass): (WebInspector.Panel.prototype.show): (WebInspector.Panel.prototype.createSidebar): (WebInspector.Panel.prototype.get _sidebarWidthSettingName): (WebInspector.Panel.prototype._endSidebarDragging): (WebInspector.Panel.prototype.updateSidebarWidth): (WebInspector.Panel.prototype.restoreSidebarWidth): (WebInspector.Panel.prototype.saveSidebarWidth):
  • inspector/front-end/ProfilesPanel.js: (WebInspector.ProfilesPanel):
  • inspector/front-end/ResourcesPanel.js: (WebInspector.ResourcesPanel): (WebInspector.ResourcesPanel.prototype.resourceTrackingWasEnabled):
  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel): (WebInspector.ScriptsPanel.prototype._endSidebarResizeDrag): (WebInspector.ScriptsPanel.prototype._sidebarResizeDrag): (WebInspector.ScriptsPanel.prototype.setSidebarWidth):
  • inspector/front-end/Settings.js: (WebInspector.populateApplicationSettings):
  • inspector/front-end/StoragePanel.js: (WebInspector.StoragePanel):
  • inspector/front-end/TimelinePanel.js: (WebInspector.TimelinePanel):
Location:
trunk/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r62646 r62647  
     12010-07-06  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Inspector should remember the size of sidebars set by the user
     6        https://bugs.webkit.org/show_bug.cgi?id=19207
     7
     8        * inspector/front-end/AbstractTimelinePanel.js:
     9        (WebInspector.AbstractTimelinePanel):
     10        * inspector/front-end/AuditsPanel.js:
     11        (WebInspector.AuditsPanel):
     12        * inspector/front-end/ConsolePanel.js:
     13        (WebInspector.ConsolePanel):
     14        * inspector/front-end/ElementsPanel.js:
     15        (WebInspector.ElementsPanel.prototype.rightSidebarResizerDragEnd):
     16        * inspector/front-end/Panel.js:
     17        (WebInspector.Panel):
     18        (WebInspector.Panel.prototype.get toolbarItemClass):
     19        (WebInspector.Panel.prototype.show):
     20        (WebInspector.Panel.prototype.createSidebar):
     21        (WebInspector.Panel.prototype.get _sidebarWidthSettingName):
     22        (WebInspector.Panel.prototype._endSidebarDragging):
     23        (WebInspector.Panel.prototype.updateSidebarWidth):
     24        (WebInspector.Panel.prototype.restoreSidebarWidth):
     25        (WebInspector.Panel.prototype.saveSidebarWidth):
     26        * inspector/front-end/ProfilesPanel.js:
     27        (WebInspector.ProfilesPanel):
     28        * inspector/front-end/ResourcesPanel.js:
     29        (WebInspector.ResourcesPanel):
     30        (WebInspector.ResourcesPanel.prototype.resourceTrackingWasEnabled):
     31        * inspector/front-end/ScriptsPanel.js:
     32        (WebInspector.ScriptsPanel):
     33        (WebInspector.ScriptsPanel.prototype._endSidebarResizeDrag):
     34        (WebInspector.ScriptsPanel.prototype._sidebarResizeDrag):
     35        (WebInspector.ScriptsPanel.prototype.setSidebarWidth):
     36        * inspector/front-end/Settings.js:
     37        (WebInspector.populateApplicationSettings):
     38        * inspector/front-end/StoragePanel.js:
     39        (WebInspector.StoragePanel):
     40        * inspector/front-end/TimelinePanel.js:
     41        (WebInspector.TimelinePanel):
     42
    1432010-07-05  Steve Block  <steveblock@google.com>
    244
  • trunk/WebCore/inspector/front-end/AbstractTimelinePanel.js

    r59372 r62647  
    2929 */
    3030
    31 WebInspector.AbstractTimelinePanel = function()
     31WebInspector.AbstractTimelinePanel = function(name)
    3232{
    33     WebInspector.Panel.call(this);
     33    WebInspector.Panel.call(this, name);
    3434    this._items = [];
    3535    this._staleItems = [];
  • trunk/WebCore/inspector/front-end/AuditsPanel.js

    r60414 r62647  
    3131WebInspector.AuditsPanel = function()
    3232{
    33     WebInspector.Panel.call(this);
     33    WebInspector.Panel.call(this, "audits");
    3434
    3535    this._constructCategories();
     
    4848    this.auditResultsTreeElement.expand();
    4949
    50     this.element.addStyleClass("audits");
    51 
    5250    this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear audit results."), "clear-status-bar-item");
    5351    this.clearResultsButton.addEventListener("click", this._clearButtonClicked.bind(this), false);
     
    6159
    6260WebInspector.AuditsPanel.prototype = {
    63     toolbarItemClass: "audits",
    64 
    6561    get toolbarItemLabel()
    6662    {
  • trunk/WebCore/inspector/front-end/ConsolePanel.js

    r51952 r62647  
    2929WebInspector.ConsolePanel = function()
    3030{
    31     WebInspector.Panel.call(this);
     31    WebInspector.Panel.call(this, "console");
    3232}
    3333
    3434WebInspector.ConsolePanel.prototype = {
    35     toolbarItemClass: "console",
    36 
    3735    get toolbarItemLabel()
    3836    {
  • trunk/WebCore/inspector/front-end/ElementsPanel.js

    r62489 r62647  
    3131WebInspector.ElementsPanel = function()
    3232{
    33     WebInspector.Panel.call(this);
    34 
    35     this.element.addStyleClass("elements");
     33    WebInspector.Panel.call(this, "elements");
    3634
    3735    this.contentElement = document.createElement("div");
     
    115113
    116114WebInspector.ElementsPanel.prototype = {
    117     toolbarItemClass: "elements",
    118 
    119115    get toolbarItemLabel()
    120116    {
     
    11221118    {
    11231119        WebInspector.elementDragEnd(event);
     1120        this.saveSidebarWidth();
    11241121    },
    11251122
     
    11281125        var x = event.pageX;
    11291126        var newWidth = Number.constrain(window.innerWidth - x, Preferences.minElementsSidebarWidth, window.innerWidth * 0.66);
    1130 
     1127        this.setSidebarWidth(newWidth);
     1128        event.preventDefault();
     1129    },
     1130
     1131    setSidebarWidth: function(newWidth)
     1132    {
    11311133        this.sidebarElement.style.width = newWidth + "px";
    11321134        this.contentElement.style.right = newWidth + "px";
    11331135        this.sidebarResizeElement.style.right = (newWidth - 3) + "px";
    1134 
    11351136        this.treeOutline.updateSelection();
    1136 
    1137         event.preventDefault();
    11381137    },
    11391138
  • trunk/WebCore/inspector/front-end/Panel.js

    r60414 r62647  
    2727 */
    2828
    29 WebInspector.Panel = function()
     29WebInspector.Panel = function(name)
    3030{
    3131    WebInspector.View.call(this);
    3232
    3333    this.element.addStyleClass("panel");
     34    this.element.addStyleClass(name);
     35    this._panelName = name;
     36
     37    WebInspector.applicationSettings.installSetting(this._sidebarWidthSettingName(), this._panelName + "-sidebar-width", undefined);
    3438}
    3539
     
    5357        this._toolbarItem.panel = this;
    5458
    55         if ("toolbarItemClass" in this)
    56             this._toolbarItem.addStyleClass(this.toolbarItemClass);
     59        this._toolbarItem.addStyleClass(this._panelName);
    5760
    5861        var iconElement = document.createElement("div");
     
    8790        WebInspector.currentFocusElement = this.defaultFocusedElement;
    8891
    89         this.updateSidebarWidth();
     92        this.restoreSidebarWidth();
    9093        this._restoreScrollPositions();
    9194    },
     
    292295    createSidebar: function(parentElement, resizerParentElement)
    293296    {
    294         if (this.hasSidebar)
     297        if (this.sidebarElement)
    295298            return;
    296299
     
    300303        if (!resizerParentElement)
    301304            resizerParentElement = parentElement;
    302 
    303         this.hasSidebar = true;
    304305
    305306        this.sidebarElement = document.createElement("div");
     
    320321    },
    321322
     323    _sidebarWidthSettingName: function()
     324    {
     325        return this._panelName + "SidebarWidth";
     326    },
     327
    322328    _startSidebarDragging: function(event)
    323329    {
     
    335341    {
    336342        WebInspector.elementDragEnd(event);
     343        this.saveSidebarWidth();
    337344    },
    338345
    339346    updateSidebarWidth: function(width)
    340347    {
    341         if (!this.hasSidebar)
     348        if (!this.sidebarElement)
    342349            return;
    343350
     
    366373        this.sidebarElement.style.width = width + "px";
    367374        this.sidebarResizeElement.style.left = (width - 3) + "px";
     375    },
     376
     377    restoreSidebarWidth: function()
     378    {
     379        var sidebarWidth = WebInspector.applicationSettings[this._sidebarWidthSettingName()];
     380        this.updateSidebarWidth(sidebarWidth);
     381    },
     382
     383    saveSidebarWidth: function()
     384    {
     385        if (!this.sidebarElement)
     386            return;
     387        WebInspector.applicationSettings[this._sidebarWidthSettingName()] = this.sidebarElement.offsetWidth;
    368388    },
    369389
  • trunk/WebCore/inspector/front-end/ProfilesPanel.js

    r61691 r62647  
    9191WebInspector.ProfilesPanel = function()
    9292{
    93     WebInspector.Panel.call(this);
     93    WebInspector.Panel.call(this, "profiles");
    9494
    9595    this.createSidebar();
    9696
    97     this.element.addStyleClass("profiles");
    9897    this._profileTypesByIdMap = {};
    9998    this._profileTypeButtonsByIdMap = {};
     
    129128
    130129WebInspector.ProfilesPanel.prototype = {
    131     toolbarItemClass: "profiles",
    132 
    133130    get toolbarItemLabel()
    134131    {
  • trunk/WebCore/inspector/front-end/ResourcesPanel.js

    r61014 r62647  
    3030WebInspector.ResourcesPanel = function()
    3131{
    32     WebInspector.AbstractTimelinePanel.call(this);
    33 
    34     this.element.addStyleClass("resources");
     32    WebInspector.AbstractTimelinePanel.call(this, "resources");
    3533
    3634    this._createPanelEnabler();
     
    5250
    5351WebInspector.ResourcesPanel.prototype = {
    54     toolbarItemClass: "resources",
    55 
    5652    get toolbarItemLabel()
    5753    {
     
    320316        this._resourceTrackingEnabled = true;
    321317        this.reset();
     318        this.restoreSidebarWidth();
    322319    },
    323320
  • trunk/WebCore/inspector/front-end/ScriptsPanel.js

    r62645 r62647  
    2626WebInspector.ScriptsPanel = function()
    2727{
    28     WebInspector.Panel.call(this);
    29 
    30     this.element.addStyleClass("scripts");
     28    WebInspector.Panel.call(this, "scripts");
    3129
    3230    this.topStatusBar = document.createElement("div");
     
    185183
    186184WebInspector.ScriptsPanel.prototype = {
    187     toolbarItemClass: "scripts",
    188 
    189185    get toolbarItemLabel()
    190186    {
     
    791787    {
    792788        WebInspector.elementDragEnd(event);
    793 
    794789        delete this._dragOffset;
     790        this.saveSidebarWidth();
    795791    },
    796792
     
    799795        var x = event.pageX + this._dragOffset;
    800796        var newWidth = Number.constrain(window.innerWidth - x, Preferences.minScriptsSidebarWidth, window.innerWidth * 0.66);
    801 
     797        this.setSidebarWidth(newWidth);
     798        event.preventDefault();
     799    },
     800
     801    setSidebarWidth: function(newWidth)
     802    {
    802803        this.sidebarElement.style.width = newWidth + "px";
    803804        this.sidebarButtonsElement.style.width = newWidth + "px";
     
    807808
    808809        this.resize();
    809         event.preventDefault();
    810810    },
    811811
  • trunk/WebCore/inspector/front-end/Settings.js

    r61014 r62647  
    4949{
    5050    WebInspector.applicationSettings._load(settingsString);
    51     WebInspector.applicationSettings._installSetting("eventListenersFilter", "event-listeners-filter", "all");
    52     WebInspector.applicationSettings._installSetting("colorFormat", "color-format", "hex");
    53     WebInspector.applicationSettings._installSetting("resourcesLargeRows", "resources-large-rows", true);
    54     WebInspector.applicationSettings._installSetting("watchExpressions", "watch-expressions", []);
    55     WebInspector.applicationSettings._installSetting("lastViewedScriptFile", "last-viewed-script-file");
    56     WebInspector.applicationSettings._installSetting("showInheritedComputedStyleProperties", "show-inherited-computed-style-properties", false);
    57     WebInspector.applicationSettings._installSetting("showUserAgentStyles", "show-user-agent-styles", true);
    58     WebInspector.applicationSettings._installSetting("resourceViewTab", "resource-view-tab", "content");
    59     WebInspector.applicationSettings._installSetting("consoleHistory", "console-history", []);
     51    WebInspector.applicationSettings.installSetting("eventListenersFilter", "event-listeners-filter", "all");
     52    WebInspector.applicationSettings.installSetting("colorFormat", "color-format", "hex");
     53    WebInspector.applicationSettings.installSetting("resourcesLargeRows", "resources-large-rows", true);
     54    WebInspector.applicationSettings.installSetting("watchExpressions", "watch-expressions", []);
     55    WebInspector.applicationSettings.installSetting("lastViewedScriptFile", "last-viewed-script-file");
     56    WebInspector.applicationSettings.installSetting("showInheritedComputedStyleProperties", "show-inherited-computed-style-properties", false);
     57    WebInspector.applicationSettings.installSetting("showUserAgentStyles", "show-user-agent-styles", true);
     58    WebInspector.applicationSettings.installSetting("resourceViewTab", "resource-view-tab", "content");
     59    WebInspector.applicationSettings.installSetting("consoleHistory", "console-history", []);
     60
    6061    WebInspector.applicationSettings.dispatchEventToListeners("loaded");
    6162}
     
    7071{
    7172    this._sessionScope = sessionScope;
     73    this._defaultValues = {};
    7274}
    7375
     
    8991    },
    9092
    91     _installSetting: function(name, propertyName, defaultValue)
     93    installSetting: function(name, propertyName, defaultValue)
    9294    {
    9395        this.__defineGetter__(name, this._get.bind(this, propertyName));
    9496        this.__defineSetter__(name, this._set.bind(this, propertyName));
    95         if (!(propertyName in this._store)) {
    96             this._store[propertyName] = defaultValue;
    97         }
     97        this._defaultValues[propertyName] = defaultValue;
    9898    },
    9999
    100100    _get: function(propertyName)
    101101    {
    102         return this._store[propertyName];
     102        if (propertyName in this._store)
     103            return this._store[propertyName];
     104        return this._defaultValues[propertyName];
    103105    },
    104106
  • trunk/WebCore/inspector/front-end/StoragePanel.js

    r62503 r62647  
    3030WebInspector.StoragePanel = function(database)
    3131{
    32     WebInspector.Panel.call(this);
     32    WebInspector.Panel.call(this, "storage");
    3333
    3434    this.createSidebar();
     
    6565
    6666WebInspector.StoragePanel.prototype = {
    67     toolbarItemClass: "storage",
    68 
    6967    get toolbarItemLabel()
    7068    {
  • trunk/WebCore/inspector/front-end/TimelinePanel.js

    r60552 r62647  
    3131WebInspector.TimelinePanel = function()
    3232{
    33     WebInspector.Panel.call(this);
    34     this.element.addStyleClass("timeline");
     33    WebInspector.Panel.call(this, "timeline");
    3534
    3635    this.element.appendChild(this._createTopPane());
     
    107106
    108107WebInspector.TimelinePanel.prototype = {
    109     toolbarItemClass: "timeline",
    110 
    111108    _createTopPane: function() {
    112109        var topPaneElement = document.createElement("div");
Note: See TracChangeset for help on using the changeset viewer.