Bug 48915

Summary: Web Inspector: show proper image size for cached resources.
Product: WebKit Reporter: Pavel Feldman <pfeldman>
Component: Web Inspector (Deprecated)Assignee: Pavel Feldman <pfeldman>
Status: RESOLVED FIXED    
Severity: Normal CC: apavlov, bweinstein, caseq, joepeck, keishi, loislo, pfeldman, pmuellr, rik, timothy, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed change. simon.fraser: review+

Description Pavel Feldman 2010-11-03 07:15:27 PDT
Patch to follow.
Comment 1 Pavel Feldman 2010-11-03 07:18:01 PDT
Created attachment 72820 [details]
[PATCH] Proposed change.
Comment 2 Andrey Kosyakov 2010-11-03 07:32:24 PDT
Comment on attachment 72820 [details]
[PATCH] Proposed change.

View in context: https://bugs.webkit.org/attachment.cgi?id=72820&action=review

> WebCore/inspector/front-end/ImageView.js:79
> +                var resourceSize = this.resource.resourceSize;

Wouldn't it be more readable with a ternary operator?

> WebCore/inspector/front-end/ImageView.js:101
> +    _base64ToSize: function(content)

This is rather generic, I would consider moving this to utilities.js or making it a member of Resource.

> WebCore/inspector/front-end/ImageView.js:105
> +        var size = (content.length || 0) * 3 / 4;

content.length || 0 seems to be redundant considering the above line.

> WebCore/inspector/front-end/ImageView.js:107
> +            size--;

ditto.
Comment 3 Simon Fraser (smfr) 2010-11-03 11:21:55 PDT
Comment on attachment 72820 [details]
[PATCH] Proposed change.

View in context: https://bugs.webkit.org/attachment.cgi?id=72820&action=review

> WebCore/ChangeLog:9
> +        https://bugs.webkit.org/show_bug.cgi?id=48915
> +
> +        * inspector/front-end/ExtensionServer.js:
> +        (WebInspector.ExtensionServer.prototype._onGetResourceContent):

I'd like to see some explanation of what the problem was and how you fixed it here.
Comment 4 Pavel Feldman 2010-11-03 11:23:57 PDT
(In reply to comment #3)
> (From update of attachment 72820 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=72820&action=review
> 
> > WebCore/ChangeLog:9
> > +        https://bugs.webkit.org/show_bug.cgi?id=48915
> > +
> > +        * inspector/front-end/ExtensionServer.js:
> > +        (WebInspector.ExtensionServer.prototype._onGetResourceContent):
> 
> I'd like to see some explanation of what the problem was and how you fixed it here.

The problem was that resourceSize for cached resources is 0 and I calculate it from the actual image object instead. And height is a drive-by fix via using naturalHeight.
Comment 5 Pavel Feldman 2010-11-03 11:38:34 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ...
        M       WebCore/ChangeLog
        M       WebCore/inspector/front-end/ExtensionServer.js
        M       WebCore/inspector/front-end/ImageView.js
        M       WebCore/inspector/front-end/NetworkPanel.js
        M       WebCore/inspector/front-end/Resource.js
        M       WebCore/inspector/front-end/ResourceManager.js
        M       WebCore/inspector/front-end/SourceView.js
Committed r71254