[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

apavlov at chromium.org apavlov at chromium.org
Thu Apr 8 02:22:33 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 009271623db76faf6e160b544d7afcf307dc3f8f
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Mar 15 16:22:24 2010 +0000

    2010-03-15  Alexander Pavlov  <apavlov at 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):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55999 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3b752be..03d2902 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,41 @@
+2010-03-15  Alexander Pavlov  <apavlov at 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):
+
 2010-03-15  Philippe Normand  <pnormand at igalia.com>
 
         Reviewed by Gustavo Noronha Silva.
diff --git a/WebCore/English.lproj/localizedStrings.js b/WebCore/English.lproj/localizedStrings.js
index c325326..7355b37 100644
Binary files a/WebCore/English.lproj/localizedStrings.js and b/WebCore/English.lproj/localizedStrings.js differ
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index e563e41..1766967 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -3746,6 +3746,7 @@ dist_webinspector_DATA = \
 
 webinspectorimagesdir = ${datadir}/webkit-1.0/webinspector/Images
 dist_webinspectorimages_DATA = \
+	$(shell ls $(WebCore)/inspector/front-end/Images/*.gif) \
 	$(shell ls $(WebCore)/inspector/front-end/Images/*.png)
 
 webresourcesdir = ${datadir}/webkit-1.0/images
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 8e59742..80c5d60 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3942,6 +3942,7 @@
             'inspector/front-end/Images/segmentSelected.png',
             'inspector/front-end/Images/segmentSelectedEnd.png',
             'inspector/front-end/Images/sessionStorage.png',
+            'inspector/front-end/Images/spinner.gif',
             'inspector/front-end/Images/splitviewDimple.png',
             'inspector/front-end/Images/splitviewDividerBackground.png',
             'inspector/front-end/Images/statusbarBackground.png',
diff --git a/WebCore/inspector/front-end/AuditLauncherView.js b/WebCore/inspector/front-end/AuditLauncherView.js
index 47424c5..b8af0b7 100644
--- a/WebCore/inspector/front-end/AuditLauncherView.js
+++ b/WebCore/inspector/front-end/AuditLauncherView.js
@@ -42,6 +42,8 @@ WebInspector.AuditLauncherView = function(categoriesById, runnerCallback)
     this._contentElement.className = "audit-launcher-view-content";
     this.element.appendChild(this._contentElement);
 
+    this._resetResourceCount();
+
     function categorySortFunction(a, b)
     {
         var aTitle = a.displayName || "";
@@ -67,6 +69,9 @@ WebInspector.AuditLauncherView.prototype = {
     {
         if (!this._auditPresentStateLabelElement)
             return;
+
+        this._resetResourceCount();
+
         if (isTracking) {
             this._auditPresentStateLabelElement.nodeValue = WebInspector.UIString("Audit Present State");
             this._auditPresentStateElement.disabled = false;
@@ -79,12 +84,63 @@ WebInspector.AuditLauncherView.prototype = {
         }
     },
 
+    get totalResources()
+    {
+        return this._totalResources;
+    },
+
+    set totalResources(x)
+    {
+        if (this._totalResources === x)
+            return;
+        this._totalResources = x;
+        this._updateResourceProgress();
+    },
+
+    get loadedResources()
+    {
+        return this._loadedResources;
+    },
+
+    set loadedResources(x)
+    {
+        if (this._loadedResources === x)
+            return;
+        this._loadedResources = x;
+        this._updateResourceProgress();
+    },
+
+    _resetResourceCount: function()
+    {
+        this.loadedResources = 0;
+
+        // We never receive a resourceStarted notification for the main resource
+        // (see InspectorController.willSendRequest())
+        this.totalResources = 1;
+    },
+
+    resourceStarted: function(resource)
+    {
+        ++this.totalResources;
+    },
+
+    resourceFinished: function(resource)
+    {
+        ++this.loadedResources;
+    },
+
+    reset: function()
+    {
+        this._resetResourceCount();
+    },
+
     _setAuditRunning: function(auditRunning)
     {
         if (this._auditRunning === auditRunning)
             return;
         this._auditRunning = auditRunning;
         this._updateButton();
+        this._updateResourceProgress();
     },
 
     _launchButtonClicked: function(event)
@@ -95,12 +151,8 @@ WebInspector.AuditLauncherView.prototype = {
             if (this._categoriesById[id]._checkboxElement.checked)
                 catIds.push(id);
         }
-        function profilingFinishedCallback()
-        {
-            this._setAuditRunning(false);
-        }
         this._setAuditRunning(true);
-        this._runnerCallback(catIds, this._auditPresentStateElement.checked, profilingFinishedCallback.bind(this));
+        this._runnerCallback(catIds, this._auditPresentStateElement.checked, this._setAuditRunning.bind(this, false));
     },
 
     _selectAllClicked: function(checkCategories)
@@ -121,11 +173,10 @@ WebInspector.AuditLauncherView.prototype = {
 
     _createCategoryElement: function(title, id)
     {
-        var element;
         var labelElement = document.createElement("label");
         labelElement.id = this._categoryIdPrefix + id;
 
-        element = document.createElement("input");
+        var element = document.createElement("input");
         element.type = "checkbox";
         labelElement.appendChild(element);
         labelElement.appendChild(document.createTextNode(title));
@@ -188,10 +239,19 @@ WebInspector.AuditLauncherView.prototype = {
         this._buttonContainerElement.appendChild(labelElement);
 
         this._launchButton = document.createElement("button");
-        this._launchButton.setAttribute("type", "button");
+        this._launchButton.type = "button";
+        this._launchButton.textContent = WebInspector.UIString("Run");
         this._launchButton.addEventListener("click", this._launchButtonClicked.bind(this), false);
         this._buttonContainerElement.appendChild(this._launchButton);
 
+        this._resourceProgressContainer = document.createElement("span");
+        this._resourceProgressContainer.className = "resource-progress";
+        var resourceProgressImage = document.createElement("img");
+        this._resourceProgressContainer.appendChild(resourceProgressImage);
+        this._resourceProgressTextElement = document.createElement("span");
+        this._resourceProgressContainer.appendChild(this._resourceProgressTextElement);
+        this._buttonContainerElement.appendChild(this._resourceProgressContainer);
+
         this._contentElement.appendChild(this._buttonContainerElement);
 
         this._selectAllClicked(this._selectAllCheckboxElement.checked);
@@ -199,13 +259,22 @@ WebInspector.AuditLauncherView.prototype = {
         this._updateButton();
     },
 
+    _updateResourceProgress: function()
+    {
+        if (!this._resourceProgressContainer)
+            return;
+
+        if (!this._auditRunning)
+            this._resourceProgressContainer.addStyleClass("hidden");
+        else {
+            this._resourceProgressContainer.removeStyleClass("hidden");
+            this._resourceProgressTextElement.textContent = WebInspector.UIString("Loading (%d of %d)", this.loadedResources, this.totalResources);
+        }
+    },
+
     _updateButton: function()
     {
         this._launchButton.disabled = !this._currentCategoriesCount || this._auditRunning;
-        if (this._auditRunning)
-            this._launchButton.textContent = WebInspector.UIString("Running...");
-        else
-            this._launchButton.textContent = WebInspector.UIString("Run");
     }
 }
 
diff --git a/WebCore/inspector/front-end/AuditsPanel.js b/WebCore/inspector/front-end/AuditsPanel.js
index 350f7b7..8d3c396 100644
--- a/WebCore/inspector/front-end/AuditsPanel.js
+++ b/WebCore/inspector/front-end/AuditsPanel.js
@@ -98,6 +98,16 @@ WebInspector.AuditsPanel.prototype = {
         return this._auditCategoriesById;
     },
 
+    resourceStarted: function(resource)
+    {
+        this._launcherView.resourceStarted(resource);
+    },
+
+    resourceFinished: function(resource)
+    {
+        this._launcherView.resourceFinished(resource);
+    },
+
     _constructCategories: function()
     {
         this._auditCategoriesById = {};
@@ -240,6 +250,11 @@ WebInspector.AuditsPanel.prototype = {
         this._updateLauncherViewControls(WebInspector.panels.resources.resourceTrackingEnabled);
     },
 
+    reset: function()
+    {
+        this._launcherView.reset();
+    },
+
     attach: function()
     {
         WebInspector.Panel.prototype.attach.call(this);
diff --git a/WebCore/inspector/front-end/Images/spinner.gif b/WebCore/inspector/front-end/Images/spinner.gif
new file mode 100644
index 0000000..5f68c02
Binary files /dev/null and b/WebCore/inspector/front-end/Images/spinner.gif differ
diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc
index 8b057c0..47a2e90 100644
--- a/WebCore/inspector/front-end/WebKit.qrc
+++ b/WebCore/inspector/front-end/WebKit.qrc
@@ -189,6 +189,7 @@
     <file>Images/segmentSelected.png</file>
     <file>Images/segmentSelectedEnd.png</file>
     <file>Images/sessionStorage.png</file>
+    <file>Images/spinner.gif</file>
     <file>Images/splitviewDimple.png</file>
     <file>Images/splitviewDividerBackground.png</file>
     <file>Images/statusbarBackground.png</file>
diff --git a/WebCore/inspector/front-end/audits.css b/WebCore/inspector/front-end/audits.css
index 31b2287..be12fc0 100644
--- a/WebCore/inspector/front-end/audits.css
+++ b/WebCore/inspector/front-end/audits.css
@@ -173,6 +173,12 @@ body.inactive .audit-launcher-view button, .audit-launcher-view button:disabled
                 -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
 }
 
+.audit-launcher-view .resource-progress > img {
+    content: url(Images/spinner.gif);
+    vertical-align: text-top;
+    margin: 0 4px 0 8px;
+}
+
 .audit-result-view {
     overflow: auto;
     position: absolute;
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 59120cd..8892d7b 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -1076,6 +1076,8 @@ WebInspector.updateResource = function(identifier, payload)
         this.resourceURLMap[resource.url] = resource;
         if (this.panels.resources)
             this.panels.resources.addResource(resource);
+        if (this.panels.audits)
+            this.panels.audits.resourceStarted(resource);
     }
 
     if (payload.didRequestChange) {
@@ -1120,6 +1122,8 @@ WebInspector.updateResource = function(identifier, payload)
     if (payload.didCompletionChange) {
         resource.failed = payload.failed;
         resource.finished = payload.finished;
+        if (this.panels.audits)
+            this.panels.audits.resourceFinished(resource);
     }
 
     if (payload.didTimingChange) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list