Changeset 33525 in webkit


Ignore:
Timestamp:
May 16, 2008 1:46:57 PM (16 years ago)
Author:
timothy@apple.com
Message:

Adds an error and warning count indicator at the bottom right in the
Inspector's status bar.

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

Initial implementation by Adam Roben.
Reviewed by Sam Weinig.

Test: manual-tests/inspector/error-warning-count.html

  • English.lproj/localizedStrings.js: Added new strings.
  • manual-tests/inspector/error-warning-count.html: Added.
  • page/inspector/Console.js:

(WebInspector.Console.prototype.show): Don't do anything if visible.
(WebInspector.Console.prototype.hide): Don't do anything if hidden.
Temporally set properties and classes to mimic the post-animation
values so panels like Elements in their updateStatusBarItems call will
size things to fit the final location.

  • page/inspector/ElementsPanel.js:

(WebInspector.ElementsPanel.prototype.updateBreadcrumbSizes):
Account for the #error-warning-count width when sizing breadcrumbs.

  • page/inspector/Resource.js:

(WebInspector.Resource.prototype.set errors): Update the global error count.
(WebInspector.Resource.prototype.set warnings): Update the global warning count.

  • page/inspector/inspector.css: Make .hidden's display property

!important to ensure things really hide, and added styling for the new

  • page/inspector/inspector.html: Added an #error-warning-count div

in the #anchored-status-bar-items div.

  • page/inspector/inspector.js:

(WebInspector.get errors): Added.
(WebInspector.set errors): Added. Calls _updateErrorAndWarningCounts.
(WebInspector.get warnings): Added.
(WebInspector.set warnings): Added. Calls _updateErrorAndWarningCounts.
(WebInspector._updateErrorAndWarningCounts): Added. Update the
(WebInspector.loaded): Add a click event listener to the
_updateErrorAndWarningCounts to display the initial error/warning counts.

Location:
trunk/WebCore
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r33524 r33525  
    174174        * page/mac/AccessibilityObjectWrapper.mm:
    175175        (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
     176
     1772008-05-15  Timothy Hatcher  <timothy@apple.com>
     178
     179        Adds an error and warning count indicator at the bottom right in the
     180        Inspector's status bar.
     181
     182        https://bugs.webkit.org/show_bug.cgi?id=18650
     183
     184        Initial implementation by Adam Roben.
     185        Reviewed by Sam Weinig.
     186
     187        Test: manual-tests/inspector/error-warning-count.html
     188
     189        * English.lproj/localizedStrings.js: Added new strings.
     190        * manual-tests/inspector/error-warning-count.html: Added.
     191        * page/inspector/Console.js:
     192        (WebInspector.Console.prototype.show): Don't do anything if visible.
     193        (WebInspector.Console.prototype.hide): Don't do anything if hidden.
     194        Temporally set properties and classes to mimic the post-animation
     195        values so panels like Elements in their updateStatusBarItems call will
     196        size things to fit the final location.
     197        * page/inspector/ElementsPanel.js:
     198        (WebInspector.ElementsPanel.prototype.updateBreadcrumbSizes):
     199        Account for the #error-warning-count width when sizing breadcrumbs.
     200        * page/inspector/Resource.js:
     201        (WebInspector.Resource.prototype.set errors): Update the global error count.
     202        (WebInspector.Resource.prototype.set warnings): Update the global warning count.
     203        * page/inspector/inspector.css: Make .hidden's display property
     204        !important to ensure things really hide, and added styling for the new
     205        #error-warning-count element.
     206        * page/inspector/inspector.html: Added an #error-warning-count div
     207        in the #anchored-status-bar-items div.
     208        * page/inspector/inspector.js:
     209        (WebInspector.get errors): Added.
     210        (WebInspector.set errors): Added. Calls _updateErrorAndWarningCounts.
     211        (WebInspector.get warnings): Added.
     212        (WebInspector.set warnings): Added. Calls _updateErrorAndWarningCounts.
     213        (WebInspector._updateErrorAndWarningCounts): Added. Update the
     214        #error-warning-count div with the current error/warning count.
     215        (WebInspector.loaded): Add a click event listener to the
     216        #error-warning-count element that will show the Console. Call
     217        _updateErrorAndWarningCounts to display the initial error/warning counts.
    176218
    1772192008-05-15  Timothy Hatcher  <timothy@apple.com>
  • trunk/WebCore/page/inspector/Console.js

    r33454 r33525  
    5959    show: function()
    6060    {
    61         if (this._animating)
     61        if (this._animating || this.visible)
    6262            return;
    6363
     
    9898    hide: function()
    9999    {
    100         if (this._animating)
     100        if (this._animating || !this.visible)
    101101            return;
    102102
     
    113113
    114114        var anchoredItems = document.getElementById("anchored-status-bar-items");
     115
     116        // Temporally set properties and classes to mimic the post-animation values so panels
     117        // like Elements in their updateStatusBarItems call will size things to fit the final location.
     118        document.getElementById("main-status-bar").style.setProperty("padding-left", (anchoredItems.offsetWidth - 1) + "px");
     119        document.body.removeStyleClass("console-visible");
     120        if ("updateStatusBarItems" in WebInspector.currentPanel)
     121            WebInspector.currentPanel.updateStatusBarItems();
     122        document.body.addStyleClass("console-visible");
    115123
    116124        var animations = [
     
    126134            mainStatusBar.style.removeProperty("padding-left");
    127135            document.body.removeStyleClass("console-visible");
    128             if ("updateStatusBarItems" in WebInspector.currentPanel)
    129                 WebInspector.currentPanel.updateStatusBarItems();
    130136            delete this._animating;
    131137        }
  • trunk/WebCore/page/inspector/ElementsPanel.js

    r33508 r33525  
    598598        {
    599599            var rightPadding = 20;
     600            var errorWarningElement = document.getElementById("error-warning-count");
     601            if (!WebInspector.console.visible && errorWarningElement)
     602                rightPadding += errorWarningElement.offsetWidth;
    600603            return ((crumbs.totalOffsetLeft + crumbs.offsetWidth + rightPadding) < window.innerWidth);
    601604        }
  • trunk/WebCore/page/inspector/Resource.js

    r33411 r33525  
    444444        if (this._errors === x)
    445445            return;
     446
     447        var difference = x - this._errors;
     448        WebInspector.errors += difference;
     449
    446450        this._errors = x;
    447451    },
     
    458462        if (this._warnings === x)
    459463            return;
     464
     465        var difference = x - this._warnings;
     466        WebInspector.warnings += difference;
     467
    460468        this._warnings = x;
    461469    },
  • trunk/WebCore/page/inspector/inspector.css

    r33445 r33525  
    5252
    5353.hidden {
    54     display: none;
     54    display: none !important;
    5555}
    5656
     
    340340#clear-console-status-bar-item:active {
    341341    background-position: 32px 0;
     342}
     343
     344#error-warning-count {
     345    position: absolute;
     346    right: 16px;
     347    top: 0;
     348    cursor: pointer;
     349    padding: 6px 2px;
     350    font-size: 10px;
     351    height: 19px;
     352}
     353
     354#error-warning-count:hover {
     355    border-bottom: 1px solid rgb(96, 96, 96);
     356}
     357
     358#error-count::before {
     359    content: url(Images/errorIcon.png);
     360    width: 10px;
     361    height: 10px;
     362    vertical-align: -1px;
     363    margin-right: 2px;
     364}
     365
     366#error-count + #warning-count {
     367    margin-left: 6px;
     368}
     369
     370#warning-count::before {
     371    content: url(Images/warningIcon.png);
     372    width: 10px;
     373    height: 10px;
     374    vertical-align: -1px;
     375    margin-right: 2px;
    342376}
    343377
  • trunk/WebCore/page/inspector/inspector.html

    r33410 r33525  
    7979        <div id="searchResultsResizer" class="hidden"></div>
    8080        <div id="main-panels" class="focusable focused"></div>
    81         <div id="main-status-bar" class="status-bar"><div id="anchored-status-bar-items"><button id="dock-status-bar-item" class="status-bar-item toggled"></button><button id="console-status-bar-item" class="status-bar-item"></button></div></div>
     81        <div id="main-status-bar" class="status-bar"><div id="anchored-status-bar-items"><button id="dock-status-bar-item" class="status-bar-item toggled"></button><button id="console-status-bar-item" class="status-bar-item"></button><div id="error-warning-count" class="hidden"></div></div></div>
    8282    </div>
    8383    <div id="console">
  • trunk/WebCore/page/inspector/inspector.js

    r33508 r33525  
    182182            WebInspector.animateStyle(animations, 250, animationFinished);
    183183        }
     184    },
     185
     186    get errors()
     187    {
     188        return this._errors || 0;
     189    },
     190
     191    set errors(x)
     192    {
     193        x = Math.max(x, 0);
     194
     195        if (this._errors === x)
     196            return;
     197        this._errors = x;
     198        this._updateErrorAndWarningCounts();
     199    },
     200
     201    get warnings()
     202    {
     203        return this._warnings || 0;
     204    },
     205
     206    set warnings(x)
     207    {
     208        x = Math.max(x, 0);
     209
     210        if (this._warnings === x)
     211            return;
     212        this._warnings = x;
     213        this._updateErrorAndWarningCounts();
     214    },
     215
     216    _updateErrorAndWarningCounts: function()
     217    {
     218        var errorWarningElement = document.getElementById("error-warning-count");
     219        if (!errorWarningElement)
     220            return;
     221
     222        if (!this.errors && !this.warnings) {
     223            errorWarningElement.addStyleClass("hidden");
     224            return;
     225        }
     226
     227        errorWarningElement.removeStyleClass("hidden");
     228
     229        errorWarningElement.removeChildren();
     230
     231        if (this.errors) {
     232            var errorElement = document.createElement("span");
     233            errorElement.id = "error-count";
     234            errorElement.textContent = this.errors;
     235            errorWarningElement.appendChild(errorElement);
     236        }
     237
     238        if (this.warnings) {
     239            var warningsElement = document.createElement("span");
     240            warningsElement.id = "warning-count";
     241            warningsElement.textContent = this.warnings;
     242            errorWarningElement.appendChild(warningsElement);
     243        }
     244
     245        if (this.errors) {
     246            if (this.warnings) {
     247                if (this.errors == 1) {
     248                    if (this.warnings == 1)
     249                        errorWarningElement.title = WebInspector.UIString("%d error, %d warning", this.errors, this.warnings);
     250                    else
     251                        errorWarningElement.title = WebInspector.UIString("%d error, %d warnings", this.errors, this.warnings);
     252                } else if (this.warnings == 1)
     253                    errorWarningElement.title = WebInspector.UIString("%d errors, %d warning", this.errors, this.warnings);
     254                else
     255                    errorWarningElement.title = WebInspector.UIString("%d errors, %d warnings", this.errors, this.warnings);
     256            } else if (this.errors == 1)
     257                errorWarningElement.title = WebInspector.UIString("%d error", this.errors);
     258            else
     259                errorWarningElement.title = WebInspector.UIString("%d errors", this.errors);
     260        } else if (this.warnings == 1)
     261            errorWarningElement.title = WebInspector.UIString("%d warning", this.warnings);
     262        else if (this.warnings)
     263            errorWarningElement.title = WebInspector.UIString("%d warnings", this.warnings);
     264        else
     265            errorWarningElement.title = null;
    184266    }
    185267}
     
    258340    else
    259341        dockToggleButton.title = WebInspector.UIString("Dock to main window.");
     342
     343    var errorWarningCount = document.getElementById("error-warning-count");
     344    errorWarningCount.addEventListener("click", this.console.show.bind(this.console), false);
     345    this._updateErrorAndWarningCounts();
    260346
    261347    document.getElementById("search-toolbar-label").textContent = WebInspector.UIString("Search");
Note: See TracChangeset for help on using the changeset viewer.