Title: [126001] trunk/Source/WebCore
Revision
126001
Author
[email protected]
Date
2012-08-20 00:21:16 -0700 (Mon, 20 Aug 2012)

Log Message

Web Inspector: toolbar causes 8 reflows upon opening
https://bugs.webkit.org/show_bug.cgi?id=94422

Reviewed by Yury Semikhatsky.

Toolbar's overflow code causes inspector to do 8 reflows upon opening.
Fixing it via introducing batch toolbar update.

* inspector/front-end/Toolbar.js:
(WebInspector.Toolbar):
(WebInspector.Toolbar.prototype.setCoalescingUpdate):
(WebInspector.Toolbar.prototype._updateDropdownButtonAndHideDropdown):
* inspector/front-end/inspector.css:
(body.compact .toolbar-icon):
(body.compact .toolbar-icon.custom-toolbar-icon):
(body.compact .toolbar-item:active .toolbar-icon):
(body.compact .toolbar-label):
(body.compact .toolbar-item.resources .toolbar-icon):
(body.compact .toolbar-item.network .toolbar-icon):
(body.compact .toolbar-item.scripts .toolbar-icon):
(body.compact .toolbar-item.timeline .toolbar-icon):
(body.compact .toolbar-item.profiles .toolbar-icon):
(body.compact .toolbar-item.audits .toolbar-icon):
(body.compact .toolbar-item.console .toolbar-icon):
* inspector/front-end/inspector.js:
(WebInspector.get _setCompactMode):
(WebInspector.windowResize):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126000 => 126001)


--- trunk/Source/WebCore/ChangeLog	2012-08-20 06:51:59 UTC (rev 126000)
+++ trunk/Source/WebCore/ChangeLog	2012-08-20 07:21:16 UTC (rev 126001)
@@ -1,3 +1,33 @@
+2012-08-20  Pavel Feldman  <[email protected]>
+
+        Web Inspector: toolbar causes 8 reflows upon opening
+        https://bugs.webkit.org/show_bug.cgi?id=94422
+
+        Reviewed by Yury Semikhatsky.
+
+        Toolbar's overflow code causes inspector to do 8 reflows upon opening.
+        Fixing it via introducing batch toolbar update.
+
+        * inspector/front-end/Toolbar.js:
+        (WebInspector.Toolbar):
+        (WebInspector.Toolbar.prototype.setCoalescingUpdate):
+        (WebInspector.Toolbar.prototype._updateDropdownButtonAndHideDropdown):
+        * inspector/front-end/inspector.css:
+        (body.compact .toolbar-icon):
+        (body.compact .toolbar-icon.custom-toolbar-icon):
+        (body.compact .toolbar-item:active .toolbar-icon):
+        (body.compact .toolbar-label):
+        (body.compact .toolbar-item.resources .toolbar-icon):
+        (body.compact .toolbar-item.network .toolbar-icon):
+        (body.compact .toolbar-item.scripts .toolbar-icon):
+        (body.compact .toolbar-item.timeline .toolbar-icon):
+        (body.compact .toolbar-item.profiles .toolbar-icon):
+        (body.compact .toolbar-item.audits .toolbar-icon):
+        (body.compact .toolbar-item.console .toolbar-icon):
+        * inspector/front-end/inspector.js:
+        (WebInspector.get _setCompactMode):
+        (WebInspector.windowResize):
+
 2012-08-19  Kentaro Hara  <[email protected]>
 
         [V8] Replace proxy()->windowShell() in ScriptController with windowShell()

Modified: trunk/Source/WebCore/inspector/front-end/Toolbar.js (126000 => 126001)


--- trunk/Source/WebCore/inspector/front-end/Toolbar.js	2012-08-20 06:51:59 UTC (rev 126000)
+++ trunk/Source/WebCore/inspector/front-end/Toolbar.js	2012-08-20 07:21:16 UTC (rev 126001)
@@ -42,16 +42,18 @@
 
     document.getElementById("close-button-left").addEventListener("click", this._onClose, true);
     document.getElementById("close-button-right").addEventListener("click", this._onClose, true);
+    this._coalescingLevel = 0;
 }
 
 WebInspector.Toolbar.prototype = {
-    set compact(compact)
+    /**
+     * @param {boolean} enabled
+     */
+    setCoalescingUpdate: function(enabled)
     {
-        if (compact)
-            this.element.addStyleClass("toolbar-small");
-        else
-            this.element.removeStyleClass("toolbar-small");
-        this._updateDropdownButtonAndHideDropdown();
+        this._coalescingLevel += enabled ? 1 : -1;
+        if (!this._coalescingLevel)
+            this._updateDropdownButtonAndHideDropdown();
     },
 
     resize: function()
@@ -177,6 +179,8 @@
 
     _updateDropdownButtonAndHideDropdown: function()
     {
+        if (this._coalescingLevel)
+            return;
         this._setDropdownVisible(false);
 
         var toolbar = document.getElementById("toolbar");

Modified: trunk/Source/WebCore/inspector/front-end/inspector.css (126000 => 126001)


--- trunk/Source/WebCore/inspector/front-end/inspector.css	2012-08-20 06:51:59 UTC (rev 126000)
+++ trunk/Source/WebCore/inspector/front-end/inspector.css	2012-08-20 07:21:16 UTC (rev 126001)
@@ -111,14 +111,14 @@
     background-image: url(Images/toolbarIcons.png);
 }
 
-.toolbar-small .toolbar-icon {
+body.compact .toolbar-icon {
     width: 24px;
     height: 24px;
     vertical-align: middle;
     background-image: url(Images/toolbarIconsSmall.png);
 }
 
-.toolbar-small .toolbar-icon.custom-toolbar-icon {
+body.compact .toolbar-icon.custom-toolbar-icon {
     background-position-x: -32px;
 }
 
@@ -126,7 +126,7 @@
     background-position-y: 32px;
 }
 
-.toolbar-small .toolbar-item:active .toolbar-icon {
+body.compact .toolbar-item:active .toolbar-icon {
     background-position-y: 24px;
 }
 
@@ -140,7 +140,7 @@
     text-shadow: none;
 }
 
-.toolbar-small .toolbar-label {
+body.compact .toolbar-label {
     display: inline-block;
     margin-left: 3px;
     position: relative;
@@ -395,7 +395,7 @@
     background-position-x: -32px;
 }
 
-.toolbar-small .toolbar-item.resources .toolbar-icon {
+body.compact .toolbar-item.resources .toolbar-icon {
     background-position-x: -24px;
 }
 
@@ -403,7 +403,7 @@
     background-position-x: -64px;
 }
 
-.toolbar-small .toolbar-item.network .toolbar-icon {
+body.compact .toolbar-item.network .toolbar-icon {
     background-position-x: -48px;
 }
 
@@ -411,7 +411,7 @@
     background-position-x: -96px;
 }
 
-.toolbar-small .toolbar-item.scripts .toolbar-icon {
+body.compact .toolbar-item.scripts .toolbar-icon {
     background-position-x: -72px;
 }
 
@@ -419,7 +419,7 @@
     background-position-x: -128px;
 }
 
-.toolbar-small .toolbar-item.timeline .toolbar-icon {
+body.compact .toolbar-item.timeline .toolbar-icon {
     background-position-x: -96px;
 }
 
@@ -427,7 +427,7 @@
     background-position-x: -160px;
 }
 
-.toolbar-small .toolbar-item.profiles .toolbar-icon {
+body.compact .toolbar-item.profiles .toolbar-icon {
     background-position-x: -120px;
 }
 
@@ -435,7 +435,7 @@
     background-position-x: -192px;
 }
 
-.toolbar-small .toolbar-item.audits .toolbar-icon {
+body.compact .toolbar-item.audits .toolbar-icon {
     background-position-x: -144px;
 }
 
@@ -443,7 +443,7 @@
     background-position-x: -224px;
 }
 
-.toolbar-small .toolbar-item.console .toolbar-icon {
+body.compact .toolbar-item.console .toolbar-icon {
     background-position-x: -168px;
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (126000 => 126001)


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2012-08-20 06:51:59 UTC (rev 126000)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2012-08-20 07:21:16 UTC (rev 126001)
@@ -256,14 +256,7 @@
             body.addStyleClass("compact");
         else
             body.removeStyleClass("compact");
-
-        // This may be called before doLoadedDone, hence the bulk of inspector objects may
-        // not be created yet.
-        if (WebInspector.toolbar)
-            WebInspector.toolbar.compact = x;
-
-        if (WebInspector.drawer)
-            WebInspector.drawer.resize();
+        WebInspector.windowResize();
     },
 
     _updateErrorAndWarningCounts: function()
@@ -520,12 +513,14 @@
 
     this._createGlobalStatusBarItems();
 
-    this.toolbar = new WebInspector.Toolbar();
     WebInspector._installDockToRight();
 
+    this.toolbar = new WebInspector.Toolbar();
+    this.toolbar.setCoalescingUpdate(true);
     var panelDescriptors = this._panelDescriptors();
     for (var i = 0; i < panelDescriptors.length; ++i)
         WebInspector.inspectorView.addPanel(panelDescriptors[i]);
+    this.toolbar.setCoalescingUpdate(false);
 
     this.addMainEventListeners(document);
     WebInspector.registerLinkifierPlugin(this._profilesLinkifier.bind(this));
@@ -640,10 +635,14 @@
 
 WebInspector.windowResize = function(event)
 {
-    WebInspector.inspectorView.doResize();
-    WebInspector.drawer.resize();
-    WebInspector.toolbar.resize();
-    WebInspector.settingsController.resize();
+    if (WebInspector.inspectorView)
+        WebInspector.inspectorView.doResize();
+    if (WebInspector.drawer)
+        WebInspector.drawer.resize();
+    if (WebInspector.toolbar)
+        WebInspector.toolbar.resize();
+    if (WebInspector.settingsController)
+        WebInspector.settingsController.resize();
 }
 
 WebInspector.setDockingUnavailable = function(unavailable)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to