Changeset 27999 in webkit


Ignore:
Timestamp:
Nov 24, 2007 11:18:45 AM (16 years ago)
Author:
timothy@apple.com
Message:

Reviewed by Adam Roben.

Bug 16112: Some Web Inspector UI elements use offsetWidth and offsetHeight before the stylesheet loads
http://bugs.webkit.org/show_bug.cgi?id=16112

In the places where we use offsetWidth and offsetHeight before
the stylesheet loads there is now a check. If the body's
offsetWidth is not greater than zero, then set a timeout
to do the updates requiring the stylesheet later.

The three places this happened:

  • DOM tree selection highlight would show up at the wrong height when using Inspect Element to open the inspector.
  • DOM tree breadcrumbs would not collapse when using Inspect Element to open the inspector.
  • Network Timeline divider lines would not show when opening directly into the timeline.
  • page/inspector/DocumentPanel.js: Check if the stylesheet loaded.
  • page/inspector/NetworkPanel.js: Ditto.
  • page/inspector/inspector.html: Include the stylesheet before any scripts, this will help get it loaded sooner.
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r27998 r27999  
     12007-11-24  Timothy Hatcher  <timothy@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Bug 16112: Some Web Inspector UI elements use offsetWidth and offsetHeight before the stylesheet loads
     6        http://bugs.webkit.org/show_bug.cgi?id=16112
     7
     8        In the places where we use offsetWidth and offsetHeight before
     9        the stylesheet loads there is now a check. If the body's
     10        offsetWidth is not greater than zero, then set a timeout
     11        to do the updates requiring the stylesheet later.
     12
     13        The three places this happened:
     14        - DOM tree selection highlight would show up at the wrong height
     15          when using Inspect Element to open the inspector.
     16        - DOM tree breadcrumbs would not collapse when using Inspect Element
     17          to open the inspector.
     18        - Network Timeline divider lines would not show when opening directly
     19          into the timeline.
     20
     21        * page/inspector/DocumentPanel.js: Check if the stylesheet loaded.
     22        * page/inspector/NetworkPanel.js: Ditto.
     23        * page/inspector/inspector.html: Include the stylesheet before
     24          any scripts, this will help get it loaded sooner.
     25
    1262007-11-24  Kevin Ollivier  <kevino@theolliviers.com>
    227
  • trunk/WebCore/page/inspector/DocumentPanel.js

    r27893 r27999  
    4040    domView.show = function() {
    4141        InspectorController.highlightDOMNode(panel.focusedDOMNode);
    42         panel.updateBreadcrumbSizes();
     42        panel.updateBreadcrumb();
    4343        panel.updateTreeSelection();
    4444    };
     
    185185    updateBreadcrumb: function()
    186186    {
     187        if (!this.visible)
     188            return;
     189
    187190        var crumbs = this.views.dom.innerCrumbsElement;
    188191
     
    377380    updateBreadcrumbSizes: function(focusedCrumb)
    378381    {
     382        if (!this.visible)
     383            return;
     384
     385        if (document.body.offsetWidth <= 0) {
     386            // The stylesheet hasn't loaded yet, so we need to update later.
     387            var panel = this;
     388            setTimeout(function() { panel.updateBreadcrumbSizes() }, 0);
     389            return;
     390        }
     391
    379392        var crumbs = this.views.dom.innerCrumbsElement;
    380393        if (!crumbs.childNodes.length)
     
    383396        var crumbsContainer = this.views.dom.crumbsElement;
    384397        if (crumbsContainer.offsetWidth <= 0 || crumbs.offsetWidth <= 0)
    385             return; // The cumbs are not visible yet, do nothing.
     398            return;
    386399
    387400        // A Zero index is the right most child crumb in the breadcrumb.
     
    741754            return;
    742755
     756        if (document.body.offsetWidth <= 0) {
     757            // The stylesheet hasn't loaded yet, so we need to update later.
     758            var element = this;
     759            setTimeout(function() { element.updateSelection() }, 0);
     760            return;
     761        }
     762
    743763        if (!this.selectionElement) {
    744764            this.selectionElement = document.createElement("div");
     
    798818    {
    799819        this.treeOutline.panel.focusedDOMNode = this.representedObject;
    800 
    801         // Call updateSelection twice to make sure the height is correct,
    802         // the first time might have a bad height because we are in a weird tree state
    803820        this.updateSelection();
    804 
    805         var element = this;
    806         setTimeout(function() { element.updateSelection() }, 0);
    807821    },
    808822
  • trunk/WebCore/page/inspector/NetworkPanel.js

    r27996 r27999  
    301301        }
    302302
     303        if (document.body.offsetWidth <= 0) {
     304            // The stylesheet hasn't loaded yet, so we need to update later.
     305            var panel = this;
     306            setTimeout(function () { panel.updateTimelineDividersIfNeeded() }, 0);
     307            return;
     308        }
     309
    303310        var dividerCount = Math.round(this.dividersElement.offsetWidth / 64);
    304311        var timeSlice = this.totalDuration / dividerCount;
    305        
     312
    306313        if (this.lastDividerTimeSlice === timeSlice)
    307314            return;
  • trunk/WebCore/page/inspector/inspector.html

    r27883 r27999  
    3030<head>
    3131    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
     32    <link rel="stylesheet" type="text/css" href="inspector.css" />
    3233    <script type="text/javascript" src="utilities.js"></script>
    3334    <script type="text/javascript" src="treeoutline.js"></script>
     
    5051    <script type="text/javascript" src="ImagePanel.js"></script>
    5152    <script type="text/javascript" src="NetworkPanel.js"></script>
    52     <link rel="stylesheet" type="text/css" href="inspector.css" />
    5353</head>
    5454<body class="detached">
Note: See TracChangeset for help on using the changeset viewer.