[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

pfeldman at chromium.org pfeldman at chromium.org
Wed Dec 22 15:26:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9fd683a1b649d3db0c38db889e681f10a5f1f1b3
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 3 18:38:18 2010 +0000

    2010-11-03  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Simon Fraser.
    
            Web Inspector: show proper image size for cached resources.
            https://bugs.webkit.org/show_bug.cgi?id=48915
    
            * inspector/front-end/ExtensionServer.js:
            (WebInspector.ExtensionServer.prototype._onGetResourceContent):
            * inspector/front-end/ImageView.js:
            (WebInspector.ImageView.prototype.contentTabSelected.onImageLoad):
            (WebInspector.ImageView.prototype.contentTabSelected):
            (WebInspector.ImageView.prototype._base64ToSize):
            * inspector/front-end/NetworkPanel.js:
            (WebInspector.NetworkDataGridNode.prototype._refreshNameCell):
            * inspector/front-end/Resource.js:
            (WebInspector.Resource.prototype.set finished):
            (WebInspector.Resource.prototype.get content):
            (WebInspector.Resource.prototype.requestContent):
            (WebInspector.Resource.prototype._innerRequestContent):
            * inspector/front-end/ResourceManager.js:
            (WebInspector.ResourceManager.requestContent):
            * inspector/front-end/SourceView.js:
            (WebInspector.SourceView.prototype.setupSourceFrameIfNeeded):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71254 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e44e2af..9b551ea 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-11-03  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Simon Fraser.
+
+        Web Inspector: show proper image size for cached resources.
+        https://bugs.webkit.org/show_bug.cgi?id=48915
+
+        * inspector/front-end/ExtensionServer.js:
+        (WebInspector.ExtensionServer.prototype._onGetResourceContent):
+        * inspector/front-end/ImageView.js:
+        (WebInspector.ImageView.prototype.contentTabSelected.onImageLoad):
+        (WebInspector.ImageView.prototype.contentTabSelected):
+        (WebInspector.ImageView.prototype._base64ToSize):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkDataGridNode.prototype._refreshNameCell):
+        * inspector/front-end/Resource.js:
+        (WebInspector.Resource.prototype.set finished):
+        (WebInspector.Resource.prototype.get content):
+        (WebInspector.Resource.prototype.requestContent):
+        (WebInspector.Resource.prototype._innerRequestContent):
+        * inspector/front-end/ResourceManager.js:
+        (WebInspector.ResourceManager.requestContent):
+        * inspector/front-end/SourceView.js:
+        (WebInspector.SourceView.prototype.setupSourceFrameIfNeeded):
+
 2010-11-03  Noam Rosenthal  <noam.rosenthal at nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/inspector/front-end/ExtensionServer.js b/WebCore/inspector/front-end/ExtensionServer.js
index 729ab81..6ffa33a 100644
--- a/WebCore/inspector/front-end/ExtensionServer.js
+++ b/WebCore/inspector/front-end/ExtensionServer.js
@@ -332,7 +332,7 @@ WebInspector.ExtensionServer.prototype = {
             if (!resource)
                 response.push(this._status.E_NOTFOUND(id));
             else
-                resource.getContent(onContentAvailable.bind(this, id));
+                resource.requestContent(onContentAvailable.bind(this, id));
         }
         if (response.length === ids.length)
             this._dispatchCallback(message.requestId, port, response);
diff --git a/WebCore/inspector/front-end/ImageView.js b/WebCore/inspector/front-end/ImageView.js
index 130584f..f70fad6 100644
--- a/WebCore/inspector/front-end/ImageView.js
+++ b/WebCore/inspector/front-end/ImageView.js
@@ -67,14 +67,20 @@ WebInspector.ImageView.prototype = {
         {
             imagePreviewElement.setAttribute("src", this.resource.contentURL);
         }
-        this.resource.getContent(onResourceContent.bind(this));
+        this.resource.requestContent(onResourceContent.bind(this));
 
 
         function onImageLoad()
         {
+            var content = this.resource.content;
+            if (content)
+                var resourceSize = this._base64ToSize(content);
+            else
+                var resourceSize = this.resource.resourceSize;
+
             var imageProperties = [
-                { name: WebInspector.UIString("Dimensions"), value: WebInspector.UIString("%d × %d", imagePreviewElement.naturalWidth, imagePreviewElement.height) },
-                { name: WebInspector.UIString("File size"), value: Number.bytesToString(this.resource.resourceSize, WebInspector.UIString) },
+                { name: WebInspector.UIString("Dimensions"), value: WebInspector.UIString("%d × %d", imagePreviewElement.naturalWidth, imagePreviewElement.naturalHeight) },
+                { name: WebInspector.UIString("File size"), value: Number.bytesToString(resourceSize, WebInspector.UIString) },
                 { name: WebInspector.UIString("MIME type"), value: this.resource.mimeType }
             ];
     
@@ -90,6 +96,18 @@ WebInspector.ImageView.prototype = {
             this._container.appendChild(infoListElement);
         }
         imagePreviewElement.addEventListener("load", onImageLoad.bind(this), false);
+    },
+
+    _base64ToSize: function(content)
+    {
+        if (!content.length)
+            return 0;
+        var size = (content.length || 0) * 3 / 4;
+        if (content.length > 0 && content[content.length - 1] === "=")
+            size--;
+        if (content.length > 1 && content[content.length - 2] === "=")
+            size--;
+        return size;
     }
 }
 
diff --git a/WebCore/inspector/front-end/NetworkPanel.js b/WebCore/inspector/front-end/NetworkPanel.js
index 6fd61a9..bf04596 100644
--- a/WebCore/inspector/front-end/NetworkPanel.js
+++ b/WebCore/inspector/front-end/NetworkPanel.js
@@ -1482,7 +1482,7 @@ WebInspector.NetworkDataGridNode.prototype = {
                 previewImage.src = this._resource.contentURL;
             }
             if (Preferences.useDataURLForResourceImageIcons)
-                this._resource.getContent(onResourceContent.bind(this));
+                this._resource.requestContent(onResourceContent.bind(this));
             else
                 previewImage.src = this._resource.url;
 
diff --git a/WebCore/inspector/front-end/Resource.js b/WebCore/inspector/front-end/Resource.js
index 72f867f..24af165 100644
--- a/WebCore/inspector/front-end/Resource.js
+++ b/WebCore/inspector/front-end/Resource.js
@@ -255,7 +255,7 @@ WebInspector.Resource.prototype = {
             this._checkWarnings();
             this.dispatchEventToListeners("finished");
             if (this._pendingContentCallbacks.length)
-                this._requestContent();
+                this._innerRequestContent();
         }
     },
 
@@ -616,12 +616,17 @@ WebInspector.Resource.prototype = {
             WebInspector.console.addMessage(msg);
     },
 
+    get content()
+    {
+        return this._content;
+    },
+
     set content(content)
     {
         this._content = content;
     },
 
-    getContent: function(callback)
+    requestContent: function(callback)
     {
         if (this._content) {
             callback(this._content, this._contentEncoded);
@@ -629,7 +634,7 @@ WebInspector.Resource.prototype = {
         }
         this._pendingContentCallbacks.push(callback);
         if (this.finished)
-            this._requestContent();
+            this._innerRequestContent();
     },
 
     get contentURL()
@@ -642,7 +647,7 @@ WebInspector.Resource.prototype = {
         return "data:" + this.mimeType + (this._contentEncoded ? ";base64," : ",") + this._content;
     },
 
-    _requestContent: function()
+    _innerRequestContent: function()
     {
         if (this._contentRequested)
             return;
@@ -658,7 +663,7 @@ WebInspector.Resource.prototype = {
             this._pendingContentCallbacks.length = 0;
             delete this._contentRequested;
         }
-        WebInspector.ResourceManager.getContent(this, this._contentEncoded, onResourceContent.bind(this));
+        WebInspector.ResourceManager.requestContent(this, this._contentEncoded, onResourceContent.bind(this));
     }
 }
 
diff --git a/WebCore/inspector/front-end/ResourceManager.js b/WebCore/inspector/front-end/ResourceManager.js
index f594d8b..409ad31 100644
--- a/WebCore/inspector/front-end/ResourceManager.js
+++ b/WebCore/inspector/front-end/ResourceManager.js
@@ -469,7 +469,7 @@ WebInspector.ResourceManager.existingResourceViewForResource = function(resource
     return resource._resourcesView;
 }
 
-WebInspector.ResourceManager.getContent = function(resource, base64Encode, callback)
+WebInspector.ResourceManager.requestContent = function(resource, base64Encode, callback)
 {
     InspectorBackend.resourceContent(resource.loader.frameId, resource.url, base64Encode, callback);
 }
diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js
index bfdc058..c7a35f7 100644
--- a/WebCore/inspector/front-end/SourceView.js
+++ b/WebCore/inspector/front-end/SourceView.js
@@ -84,7 +84,7 @@ WebInspector.SourceView.prototype = {
         this.attach();
 
         delete this._frameNeedsSetup;
-        this.resource.getContent(this._contentLoaded.bind(this));
+        this.resource.requestContent(this._contentLoaded.bind(this));
     },
 
     hasContentTab: function()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list