Changeset 57206 in webkit


Ignore:
Timestamp:
Apr 7, 2010 6:10:59 AM (14 years ago)
Author:
apavlov@chromium.org
Message:

2010-04-07 Alexander Pavlov <apavlov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: Provide a placeholder for resources with no content available
https://bugs.webkit.org/show_bug.cgi?id=37142

  • English.lproj/localizedStrings.js:
  • inspector/front-end/ImageView.js: (WebInspector.ImageView): (WebInspector.ImageView.prototype.contentTabSelected):
  • inspector/front-end/ResourceView.js: (WebInspector.ResourceView.prototype._innerSelectContentTab): (WebInspector.ResourceView.prototype.contentTabSelected):
  • inspector/front-end/inspector.css: (.resource-content-unavailable):
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57205 r57206  
     12010-04-07  Alexander Pavlov  <apavlov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Provide a placeholder for resources with no content available
     6        https://bugs.webkit.org/show_bug.cgi?id=37142
     7
     8        * English.lproj/localizedStrings.js:
     9        * inspector/front-end/ImageView.js:
     10        (WebInspector.ImageView):
     11        (WebInspector.ImageView.prototype.contentTabSelected):
     12        * inspector/front-end/ResourceView.js:
     13        (WebInspector.ResourceView.prototype._innerSelectContentTab):
     14        (WebInspector.ResourceView.prototype.contentTabSelected):
     15        * inspector/front-end/inspector.css:
     16        (.resource-content-unavailable):
     17
    1182010-04-07  Simon Hausmann  <simon.hausmann@nokia.com>
    219
  • trunk/WebCore/inspector/front-end/ImageView.js

    r55466 r57206  
    3232
    3333    this.element.addStyleClass("image");
    34 
    35     var container = document.createElement("div");
    36     container.className = "image";
    37     this.contentElement.appendChild(container);
    38 
    39     this.imagePreviewElement = document.createElement("img");
    40     this.imagePreviewElement.addStyleClass("resource-image-view");
    41     this.imagePreviewElement.setAttribute("src", this.resource.url);
    42 
    43     container.appendChild(this.imagePreviewElement);
    44 
    45     container = document.createElement("div");
    46     container.className = "info";
    47     this.contentElement.appendChild(container);
    48 
    49     var imageNameElement = document.createElement("h1");
    50     imageNameElement.className = "title";
    51     imageNameElement.textContent = this.resource.displayName;
    52     container.appendChild(imageNameElement);
    53 
    54     var infoListElement = document.createElement("dl");
    55     infoListElement.className = "infoList";
    56 
    57     var imageProperties = [
    58         { name: WebInspector.UIString("Dimensions"), value: WebInspector.UIString("%d × %d", this.imagePreviewElement.naturalWidth, this.imagePreviewElement.height) },
    59         { name: WebInspector.UIString("File size"), value: Number.bytesToString(this.resource.resourceSize, WebInspector.UIString.bind(WebInspector)) },
    60         { name: WebInspector.UIString("MIME type"), value: this.resource.mimeType }
    61     ];
    62 
    63     var listHTML = '';
    64     for (var i = 0; i < imageProperties.length; ++i)
    65         listHTML += "<dt>" + imageProperties[i].name + "</dt><dd>" + imageProperties[i].value + "</dd>";
    66 
    67     infoListElement.innerHTML = listHTML;
    68     container.appendChild(infoListElement);
    6934}
    7035
    7136WebInspector.ImageView.prototype = {
    72    
     37    contentTabSelected: function()
     38    {
     39        if (this._container)
     40            return;
     41        this._container = document.createElement("div");
     42        this._container.className = "image";
     43        this.contentElement.appendChild(this._container);
     44
     45        this.imagePreviewElement = document.createElement("img");
     46        this.imagePreviewElement.addStyleClass("resource-image-view");
     47        this.imagePreviewElement.setAttribute("src", this.resource.url);
     48
     49        this._container.appendChild(this.imagePreviewElement);
     50
     51        this._container = document.createElement("div");
     52        this._container.className = "info";
     53        this.contentElement.appendChild(this._container);
     54
     55        var imageNameElement = document.createElement("h1");
     56        imageNameElement.className = "title";
     57        imageNameElement.textContent = this.resource.displayName;
     58        this._container.appendChild(imageNameElement);
     59
     60        var infoListElement = document.createElement("dl");
     61        infoListElement.className = "infoList";
     62
     63        var imageProperties = [
     64            { name: WebInspector.UIString("Dimensions"), value: WebInspector.UIString("%d × %d", this.imagePreviewElement.naturalWidth, this.imagePreviewElement.height) },
     65            { name: WebInspector.UIString("File size"), value: Number.bytesToString(this.resource.resourceSize, WebInspector.UIString.bind(WebInspector)) },
     66            { name: WebInspector.UIString("MIME type"), value: this.resource.mimeType }
     67        ];
     68
     69        var listHTML = '';
     70        for (var i = 0; i < imageProperties.length; ++i)
     71            listHTML += "<dt>" + imageProperties[i].name + "</dt><dd>" + imageProperties[i].value + "</dd>";
     72
     73        infoListElement.innerHTML = listHTML;
     74        this._container.appendChild(infoListElement);
     75    }
    7376}
    7477
  • trunk/WebCore/inspector/front-end/ResourceView.js

    r55536 r57206  
    184184        if ("resize" in this)
    185185            this.resize();
    186         if ("contentTabSelected" in this)
    187             this.contentTabSelected();
     186        this.contentTabSelected();
     187    },
     188
     189    contentTabSelected: function()
     190    {
     191        if (!this._contentPlaceholderElement) {
     192            this._contentPlaceholderElement = document.createElement("div");
     193            this._contentPlaceholderElement.className = "resource-content-unavailable";
     194            this._contentPlaceholderElement.textContent = WebInspector.UIString("No Content Available");
     195            this.contentElement.appendChild(this._contentPlaceholderElement);
     196        }
    188197    },
    189198
  • trunk/WebCore/inspector/front-end/inspector.css

    r57003 r57206  
    39573957}
    39583958
     3959.resource-content-unavailable {
     3960    color: rgb(50%, 50%, 50%);
     3961    font-style: italic;
     3962    font-size: 14px;
     3963    text-align: center;
     3964    padding: 32px;
     3965}
Note: See TracChangeset for help on using the changeset viewer.