Changeset 55999 in webkit


Ignore:
Timestamp:
Mar 15, 2010 9:22:24 AM (14 years ago)
Author:
apavlov@chromium.org
Message:

2010-03-15 Alexander Pavlov <apavlov@chromium.org>

Reviewed by Timothy Hatcher.

Web Inspector: Implement a progress indicator in the Audits panel
when resources are reloading
https://bugs.webkit.org/show_bug.cgi?id=35971

  • English.lproj/localizedStrings.js:
  • GNUmakefile.am:
  • WebCore.gypi:
  • inspector/front-end/AuditLauncherView.js: (WebInspector.AuditLauncherView.prototype.updateResourceTrackingState): (WebInspector.AuditLauncherView.prototype.get totalResources): (WebInspector.AuditLauncherView.prototype.set totalResources): (WebInspector.AuditLauncherView.prototype.get loadedResources): (WebInspector.AuditLauncherView.prototype.set loadedResources): (WebInspector.AuditLauncherView.prototype._resetResourceCount): (WebInspector.AuditLauncherView.prototype.resourceStarted): (WebInspector.AuditLauncherView.prototype.resourceFinished): (WebInspector.AuditLauncherView.prototype.reset): (WebInspector.AuditLauncherView.prototype._setAuditRunning): (WebInspector.AuditLauncherView.prototype._launchButtonClicked): (WebInspector.AuditLauncherView.prototype._createCategoryElement): (WebInspector.AuditLauncherView.prototype._createLauncherUI): (WebInspector.AuditLauncherView.prototype._updateResourceProgress): (WebInspector.AuditLauncherView.prototype._updateButton):
  • inspector/front-end/AuditsPanel.js: (WebInspector.AuditsPanel.prototype.resourceStarted): (WebInspector.AuditsPanel.prototype.resourceFinished): (WebInspector.AuditsPanel.prototype.reset):
  • inspector/front-end/Images/spinner.gif: Added.
  • inspector/front-end/WebKit.qrc:
  • inspector/front-end/audits.css: (.audit-launcher-view .resource-progress > img):
  • inspector/front-end/inspector.js: (WebInspector.updateResource):
Location:
trunk/WebCore
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r55996 r55999  
     12010-03-15  Alexander Pavlov  <apavlov@chromium.org>
     2
     3        Reviewed by Timothy Hatcher.
     4
     5        Web Inspector: Implement a progress indicator in the Audits panel
     6        when resources are reloading
     7        https://bugs.webkit.org/show_bug.cgi?id=35971
     8
     9        * English.lproj/localizedStrings.js:
     10        * GNUmakefile.am:
     11        * WebCore.gypi:
     12        * inspector/front-end/AuditLauncherView.js:
     13        (WebInspector.AuditLauncherView.prototype.updateResourceTrackingState):
     14        (WebInspector.AuditLauncherView.prototype.get totalResources):
     15        (WebInspector.AuditLauncherView.prototype.set totalResources):
     16        (WebInspector.AuditLauncherView.prototype.get loadedResources):
     17        (WebInspector.AuditLauncherView.prototype.set loadedResources):
     18        (WebInspector.AuditLauncherView.prototype._resetResourceCount):
     19        (WebInspector.AuditLauncherView.prototype.resourceStarted):
     20        (WebInspector.AuditLauncherView.prototype.resourceFinished):
     21        (WebInspector.AuditLauncherView.prototype.reset):
     22        (WebInspector.AuditLauncherView.prototype._setAuditRunning):
     23        (WebInspector.AuditLauncherView.prototype._launchButtonClicked):
     24        (WebInspector.AuditLauncherView.prototype._createCategoryElement):
     25        (WebInspector.AuditLauncherView.prototype._createLauncherUI):
     26        (WebInspector.AuditLauncherView.prototype._updateResourceProgress):
     27        (WebInspector.AuditLauncherView.prototype._updateButton):
     28        * inspector/front-end/AuditsPanel.js:
     29        (WebInspector.AuditsPanel.prototype.resourceStarted):
     30        (WebInspector.AuditsPanel.prototype.resourceFinished):
     31        (WebInspector.AuditsPanel.prototype.reset):
     32        * inspector/front-end/Images/spinner.gif: Added.
     33        * inspector/front-end/WebKit.qrc:
     34        * inspector/front-end/audits.css:
     35        (.audit-launcher-view .resource-progress > img):
     36        * inspector/front-end/inspector.js:
     37        (WebInspector.updateResource):
     38
    1392010-03-15  Philippe Normand  <pnormand@igalia.com>
    240
  • trunk/WebCore/GNUmakefile.am

    r55980 r55999  
    37473747webinspectorimagesdir = ${datadir}/webkit-1.0/webinspector/Images
    37483748dist_webinspectorimages_DATA = \
     3749        $(shell ls $(WebCore)/inspector/front-end/Images/*.gif) \
    37493750        $(shell ls $(WebCore)/inspector/front-end/Images/*.png)
    37503751
  • trunk/WebCore/WebCore.gypi

    r55980 r55999  
    39433943            'inspector/front-end/Images/segmentSelectedEnd.png',
    39443944            'inspector/front-end/Images/sessionStorage.png',
     3945            'inspector/front-end/Images/spinner.gif',
    39453946            'inspector/front-end/Images/splitviewDimple.png',
    39463947            'inspector/front-end/Images/splitviewDividerBackground.png',
  • trunk/WebCore/inspector/front-end/AuditLauncherView.js

    r55799 r55999  
    4343    this.element.appendChild(this._contentElement);
    4444
     45    this._resetResourceCount();
     46
    4547    function categorySortFunction(a, b)
    4648    {
     
    6870        if (!this._auditPresentStateLabelElement)
    6971            return;
     72
     73        this._resetResourceCount();
     74
    7075        if (isTracking) {
    7176            this._auditPresentStateLabelElement.nodeValue = WebInspector.UIString("Audit Present State");
     
    8085    },
    8186
     87    get totalResources()
     88    {
     89        return this._totalResources;
     90    },
     91
     92    set totalResources(x)
     93    {
     94        if (this._totalResources === x)
     95            return;
     96        this._totalResources = x;
     97        this._updateResourceProgress();
     98    },
     99
     100    get loadedResources()
     101    {
     102        return this._loadedResources;
     103    },
     104
     105    set loadedResources(x)
     106    {
     107        if (this._loadedResources === x)
     108            return;
     109        this._loadedResources = x;
     110        this._updateResourceProgress();
     111    },
     112
     113    _resetResourceCount: function()
     114    {
     115        this.loadedResources = 0;
     116
     117        // We never receive a resourceStarted notification for the main resource
     118        // (see InspectorController.willSendRequest())
     119        this.totalResources = 1;
     120    },
     121
     122    resourceStarted: function(resource)
     123    {
     124        ++this.totalResources;
     125    },
     126
     127    resourceFinished: function(resource)
     128    {
     129        ++this.loadedResources;
     130    },
     131
     132    reset: function()
     133    {
     134        this._resetResourceCount();
     135    },
     136
    82137    _setAuditRunning: function(auditRunning)
    83138    {
     
    86141        this._auditRunning = auditRunning;
    87142        this._updateButton();
     143        this._updateResourceProgress();
    88144    },
    89145
     
    96152                catIds.push(id);
    97153        }
    98         function profilingFinishedCallback()
    99         {
    100             this._setAuditRunning(false);
    101         }
    102154        this._setAuditRunning(true);
    103         this._runnerCallback(catIds, this._auditPresentStateElement.checked, profilingFinishedCallback.bind(this));
     155        this._runnerCallback(catIds, this._auditPresentStateElement.checked, this._setAuditRunning.bind(this, false));
    104156    },
    105157
     
    122174    _createCategoryElement: function(title, id)
    123175    {
    124         var element;
    125176        var labelElement = document.createElement("label");
    126177        labelElement.id = this._categoryIdPrefix + id;
    127178
    128         element = document.createElement("input");
     179        var element = document.createElement("input");
    129180        element.type = "checkbox";
    130181        labelElement.appendChild(element);
     
    189240
    190241        this._launchButton = document.createElement("button");
    191         this._launchButton.setAttribute("type", "button");
     242        this._launchButton.type = "button";
     243        this._launchButton.textContent = WebInspector.UIString("Run");
    192244        this._launchButton.addEventListener("click", this._launchButtonClicked.bind(this), false);
    193245        this._buttonContainerElement.appendChild(this._launchButton);
    194246
     247        this._resourceProgressContainer = document.createElement("span");
     248        this._resourceProgressContainer.className = "resource-progress";
     249        var resourceProgressImage = document.createElement("img");
     250        this._resourceProgressContainer.appendChild(resourceProgressImage);
     251        this._resourceProgressTextElement = document.createElement("span");
     252        this._resourceProgressContainer.appendChild(this._resourceProgressTextElement);
     253        this._buttonContainerElement.appendChild(this._resourceProgressContainer);
     254
    195255        this._contentElement.appendChild(this._buttonContainerElement);
    196256
     
    200260    },
    201261
     262    _updateResourceProgress: function()
     263    {
     264        if (!this._resourceProgressContainer)
     265            return;
     266
     267        if (!this._auditRunning)
     268            this._resourceProgressContainer.addStyleClass("hidden");
     269        else {
     270            this._resourceProgressContainer.removeStyleClass("hidden");
     271            this._resourceProgressTextElement.textContent = WebInspector.UIString("Loading (%d of %d)", this.loadedResources, this.totalResources);
     272        }
     273    },
     274
    202275    _updateButton: function()
    203276    {
    204277        this._launchButton.disabled = !this._currentCategoriesCount || this._auditRunning;
    205         if (this._auditRunning)
    206             this._launchButton.textContent = WebInspector.UIString("Running...");
    207         else
    208             this._launchButton.textContent = WebInspector.UIString("Run");
    209278    }
    210279}
  • trunk/WebCore/inspector/front-end/AuditsPanel.js

    r55727 r55999  
    9999    },
    100100
     101    resourceStarted: function(resource)
     102    {
     103        this._launcherView.resourceStarted(resource);
     104    },
     105
     106    resourceFinished: function(resource)
     107    {
     108        this._launcherView.resourceFinished(resource);
     109    },
     110
    101111    _constructCategories: function()
    102112    {
     
    241251    },
    242252
     253    reset: function()
     254    {
     255        this._launcherView.reset();
     256    },
     257
    243258    attach: function()
    244259    {
  • trunk/WebCore/inspector/front-end/WebKit.qrc

    r55790 r55999  
    190190    <file>Images/segmentSelectedEnd.png</file>
    191191    <file>Images/sessionStorage.png</file>
     192    <file>Images/spinner.gif</file>
    192193    <file>Images/splitviewDimple.png</file>
    193194    <file>Images/splitviewDividerBackground.png</file>
  • trunk/WebCore/inspector/front-end/audits.css

    r55727 r55999  
    174174}
    175175
     176.audit-launcher-view .resource-progress > img {
     177    content: url(Images/spinner.gif);
     178    vertical-align: text-top;
     179    margin: 0 4px 0 8px;
     180}
     181
    176182.audit-result-view {
    177183    overflow: auto;
  • trunk/WebCore/inspector/front-end/inspector.js

    r55799 r55999  
    10771077        if (this.panels.resources)
    10781078            this.panels.resources.addResource(resource);
     1079        if (this.panels.audits)
     1080            this.panels.audits.resourceStarted(resource);
    10791081    }
    10801082
     
    11211123        resource.failed = payload.failed;
    11221124        resource.finished = payload.finished;
     1125        if (this.panels.audits)
     1126            this.panels.audits.resourceFinished(resource);
    11231127    }
    11241128
Note: See TracChangeset for help on using the changeset viewer.