Changeset 31910 in webkit


Ignore:
Timestamp:
Apr 15, 2008 10:24:22 AM (16 years ago)
Author:
timothy@apple.com
Message:

Fixes the regression where the error and warning counts did not show up in the Resources
sidebar next to resources.

https://bugs.webkit.org/show_bug.cgi?id=18494

Reviewed by Adam Roben.

  • page/inspector/ResourcesPanel.js:

(WebInspector.ResourcesPanel.prototype.addMessageToResource): Increment errors or warnings
on the resource. Set the bubbleText to the total of the errors and warnings. Add a error
or warning class to the bubble.
(WebInspector.ResourcesPanel.prototype.clearMessages): Zero out the errors and warnings
properties on each resource. Set the bubbleText back to an empty string.

  • page/inspector/SidebarTreeElement.js:

(WebInspector.SidebarTreeElement): Create a statusElement.
(WebInspector.SidebarTreeElement.prototype.get bubbleText): Return _bubbleText.
(WebInspector.SidebarTreeElement.prototype.set bubbleText): Create bubbleElement if needed.
Assign the value to _bubbleText and bubbleElement.textContent.
(WebInspector.SidebarTreeElement.prototype.onattach): Append statusElement to _listItemNode.

  • page/inspector/inspector.css: Style rules for bubbles and status elements.
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r31909 r31910  
     12008-04-15  Timothy Hatcher  <timothy@apple.com>
     2
     3        Fixes the regression where the error and warning counts did not show up in the Resources
     4        sidebar next to resources.
     5
     6        https://bugs.webkit.org/show_bug.cgi?id=18494
     7
     8        Reviewed by Adam Roben.
     9
     10        * page/inspector/ResourcesPanel.js:
     11        (WebInspector.ResourcesPanel.prototype.addMessageToResource): Increment errors or warnings
     12        on the resource. Set the bubbleText to the total of the errors and warnings. Add a error
     13        or warning class to the bubble.
     14        (WebInspector.ResourcesPanel.prototype.clearMessages): Zero out the errors and warnings
     15        properties on each resource. Set the bubbleText back to an empty string.
     16        * page/inspector/SidebarTreeElement.js:
     17        (WebInspector.SidebarTreeElement): Create a statusElement.
     18        (WebInspector.SidebarTreeElement.prototype.get bubbleText): Return _bubbleText.
     19        (WebInspector.SidebarTreeElement.prototype.set bubbleText): Create bubbleElement if needed.
     20        Assign the value to _bubbleText and bubbleElement.textContent.
     21        (WebInspector.SidebarTreeElement.prototype.onattach): Append statusElement to _listItemNode.
     22        * page/inspector/inspector.css: Style rules for bubbles and status elements.
     23
    1242008-04-15  Timothy Hatcher  <timothy@apple.com>
    225
  • trunk/WebCore/page/inspector/ResourcesPanel.js

    r31909 r31910  
    266266            return;
    267267
     268        var bubbleClass;
     269        switch (msg.level) {
     270        case WebInspector.ConsoleMessage.MessageLevel.Warning:
     271            ++resource.warnings;
     272            bubbleClass = "warning";
     273            break;
     274        case WebInspector.ConsoleMessage.MessageLevel.Error:
     275            ++resource.errors;
     276            bubbleClass = "error";
     277            break;
     278        }
     279
     280        resource._resourcesTreeElement.bubbleText = (resource.warnings + resource.errors);
     281
     282        if (bubbleClass)
     283            resource._resourcesTreeElement.bubbleElement.addStyleClass(bubbleClass);
     284
    268285        var view = this._resourceView(resource);
    269286        if (view.addMessage)
     
    276293        for (var i = 0; i < resourcesLength; ++i) {
    277294            var resource = this._resources[i];
     295            resource.warnings = 0;
     296            resource.errors = 0;
     297
     298            resource._resourcesTreeElement.bubbleText = "";
     299            resource._resourcesTreeElement.bubbleElement.removeStyleClass("error");
     300            resource._resourcesTreeElement.bubbleElement.removeStyleClass("warning");
     301
    278302            var view = resource._resourcesView;
    279303            if (!view || !view.clearMessages)
  • trunk/WebCore/page/inspector/SidebarTreeElement.js

    r31736 r31910  
    5555    }
    5656
     57    this.statusElement = document.createElement("div");
     58    this.statusElement.className = "status";
     59
    5760    this.titlesElement = document.createElement("div");
    5861    this.titlesElement.className = "titles";
     
    9497    },
    9598
     99    get bubbleText()
     100    {
     101        return this._bubbleText;
     102    },
     103
     104    set bubbleText(x)
     105    {
     106        if (!this.bubbleElement) {
     107            this.bubbleElement = document.createElement("div");
     108            this.bubbleElement.className = "bubble";
     109            this.statusElement.appendChild(this.bubbleElement);
     110        }
     111
     112        this._bubbleText = x;
     113        this.bubbleElement.textContent = x;
     114    },
     115
    96116    refreshTitles: function()
    97117    {
     
    126146        var iconElement = document.createElement("img");
    127147        iconElement.className = "icon";
     148
    128149        this._listItemNode.appendChild(iconElement);
    129 
     150        this._listItemNode.appendChild(this.statusElement);
    130151        this._listItemNode.appendChild(this.titlesElement);
    131152    },
  • trunk/WebCore/page/inspector/inspector.css

    r31885 r31910  
    16421642}
    16431643
     1644.sidebar-tree-item .status {
     1645    float: right;
     1646    height: 16px;
     1647    margin-top: 10px;
     1648    margin-left: 4px;
     1649    line-height: 1em;
     1650}
     1651
     1652.sidebar-tree-item .status:empty {
     1653    display: none;
     1654}
     1655
     1656.sidebar-tree-item .status .bubble {
     1657    display: inline-block;
     1658    height: 14px;
     1659    min-width: 16px;
     1660    margin-top: 1px;
     1661    background-color: rgb(128, 151, 189);
     1662    vertical-align: middle;
     1663    white-space: nowrap;
     1664    padding: 1px 4px;
     1665    text-align: center;
     1666    font-size: 11px;
     1667    font-family: Helvetia, Arial, sans-serif;
     1668    font-weight: bold;
     1669    text-shadow: none;
     1670    color: white;
     1671    -webkit-border-radius: 7px;
     1672}
     1673
     1674.sidebar-tree-item .status .bubble:empty {
     1675    display: none;
     1676}
     1677
     1678.sidebar-tree-item.selected .status .bubble {
     1679    background-color: white !important;
     1680    color: rgb(132, 154, 190) !important;
     1681}
     1682
     1683.focused .sidebar-tree-item.selected .status .bubble {
     1684    color: rgb(36, 98, 172) !important;
     1685}
     1686
     1687body.inactive .sidebar-tree-item.selected .status .bubble {
     1688    color: rgb(159, 159, 159) !important;
     1689}
     1690
    16441691.sidebar-tree.small .sidebar-tree-item, .sidebar-tree .children.small .sidebar-tree-item, .sidebar-tree-item.small {
    16451692    height: 20px;
    1646     .sidebar-tree-itemne-height: 18px;
     1693    line-height: 18px;
    16471694}
    16481695
     
    16501697    width: 16px;
    16511698    height: 16px;
     1699}
     1700
     1701.sidebar-tree.small .sidebar-tree-item .status, .sidebar-tree .children.small .sidebar-tree-item .status, .sidebar-tree-item.small .status {
     1702    margin-top: 2px;
    16521703}
    16531704
     
    18071858    content: url(Images/resourceDocumentIconSmall.png);
    18081859}
     1860
     1861.resource-sidebar-tree-item .bubble.warning {
     1862    background-color: rgb(232, 164, 0);
     1863}
     1864
     1865.resource-sidebar-tree-item .bubble.error {
     1866    background-color: rgb(216, 35, 35);
     1867}
Note: See TracChangeset for help on using the changeset viewer.