Title: [107201] trunk
Revision
107201
Author
[email protected]
Date
2012-02-09 01:51:29 -0800 (Thu, 09 Feb 2012)

Log Message

Web Inspector: hovering over element with :hover style halts inspector
https://bugs.webkit.org/show_bug.cgi?id=78086

Reviewed by Pavel Feldman.

Source/WebCore:

Test: inspector/styles/updates-throttled.html

* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane.prototype._executeRebuildUpdate):
(WebInspector.StylesSidebarPane.prototype._innerUpdate.computedStyleCallback):
(WebInspector.StylesSidebarPane.prototype._innerUpdate):

LayoutTests:

* inspector/styles/updates-throttled-expected.txt: Added.
* inspector/styles/updates-throttled.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (107200 => 107201)


--- trunk/LayoutTests/ChangeLog	2012-02-09 09:50:06 UTC (rev 107200)
+++ trunk/LayoutTests/ChangeLog	2012-02-09 09:51:29 UTC (rev 107201)
@@ -1,3 +1,13 @@
+2012-02-08  Alexander Pavlov  <[email protected]>
+
+        Web Inspector: hovering over element with :hover style halts inspector
+        https://bugs.webkit.org/show_bug.cgi?id=78086
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/styles/updates-throttled-expected.txt: Added.
+        * inspector/styles/updates-throttled.html: Added.
+
 2012-02-09  Matt Falkenhagen  <[email protected]>
 
         Improve http-equiv content-language parsing

Added: trunk/LayoutTests/inspector/styles/updates-throttled-expected.txt (0 => 107201)


--- trunk/LayoutTests/inspector/styles/updates-throttled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/updates-throttled-expected.txt	2012-02-09 09:51:29 UTC (rev 107201)
@@ -0,0 +1,4 @@
+Tests that Styles sidebar DOM rebuilds are throttled during consecutive updates. Bug 78086.
+
+OK: rebuilds throttled
+
Property changes on: trunk/LayoutTests/inspector/styles/updates-throttled-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/styles/updates-throttled.html (0 => 107201)


--- trunk/LayoutTests/inspector/styles/updates-throttled.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/styles/updates-throttled.html	2012-02-09 09:51:29 UTC (rev 107201)
@@ -0,0 +1,50 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+    var UPDATE_COUNT = 5;
+    var rebuildCount = 0;
+    WebInspector.showPanel("elements");
+
+    InspectorTest.selectNodeAndWaitForStyles("inspected", selectCallback);
+    function selectCallback()
+    {
+        InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_rebuildUpdate", sniffRebuild, true);
+        var stylesPane = WebInspector.panels.elements.sidebarPanes.styles;
+        for (var i = 0; i < UPDATE_COUNT; ++i)
+            stylesPane.update(stylesPane.node, true);
+
+        InspectorTest.runAfterPendingDispatches(completeCallback);
+    }
+
+    function completeCallback()
+    {
+        if (rebuildCount >= UPDATE_COUNT)
+            InspectorTest.addResult("ERROR: got " + rebuildCount + " rebuilds for " + UPDATE_COUNT + " consecutive updates");
+        else
+            InspectorTest.addResult("OK: rebuilds throttled");
+        InspectorTest.completeTest();
+    }
+
+    function sniffRebuild()
+    {
+        ++rebuildCount;
+    }
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests that Styles sidebar DOM rebuilds are throttled during consecutive updates. <a href="" 78086</a>.
+</p>
+
+<div id="inspected"></div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/styles/updates-throttled.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (107200 => 107201)


--- trunk/Source/WebCore/ChangeLog	2012-02-09 09:50:06 UTC (rev 107200)
+++ trunk/Source/WebCore/ChangeLog	2012-02-09 09:51:29 UTC (rev 107201)
@@ -1,3 +1,17 @@
+2012-02-08  Alexander Pavlov  <[email protected]>
+
+        Web Inspector: hovering over element with :hover style halts inspector
+        https://bugs.webkit.org/show_bug.cgi?id=78086
+
+        Reviewed by Pavel Feldman.
+
+        Test: inspector/styles/updates-throttled.html
+
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylesSidebarPane.prototype._executeRebuildUpdate):
+        (WebInspector.StylesSidebarPane.prototype._innerUpdate.computedStyleCallback):
+        (WebInspector.StylesSidebarPane.prototype._innerUpdate):
+
 2012-02-09  Kentaro Hara  <[email protected]>
 
         Unreviewed. Fix build failure caused by r107191.

Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (107200 => 107201)


--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2012-02-09 09:50:06 UTC (rev 107200)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js	2012-02-09 09:51:29 UTC (rev 107201)
@@ -232,6 +232,14 @@
 
         function stylesCallback(matchedResult)
         {
+            delete this._innerUpdateInProgress;
+
+            if (this._lastNodeForInnerUpdate) {
+                delete this._lastNodeForInnerUpdate;
+                this._innerUpdate(false, null, callback);
+                return;
+            }
+
             if (matchedResult && this.node === node) {
                 resultStyles.matchedCSSRules = matchedResult.matchedCSSRules;
                 resultStyles.pseudoElements = matchedResult.pseudoElements;
@@ -270,6 +278,11 @@
      */
     _innerUpdate: function(refresh, editedSection, userCallback)
     {
+        if (this._innerUpdateInProgress) {
+            this._lastNodeForInnerUpdate = this.node;
+            return;
+        }
+
         var node = this.node;
         if (!node) {
             this._sectionsContainer.removeChildren();
@@ -282,12 +295,23 @@
 
         function computedStyleCallback(computedStyle)
         {
+            delete this._innerUpdateInProgress;
+
+            if (this._lastNodeForInnerUpdate) {
+                delete this._lastNodeForInnerUpdate;
+                this._innerUpdate(refresh, editedSection, userCallback);
+                return;
+            }
+
             if (this.node === node && computedStyle)
                 this._refreshUpdate(node, computedStyle, editedSection);
+
             if (userCallback)
                 userCallback();
         }
 
+        this._innerUpdateInProgress = true;
+
         if (refresh)
             WebInspector.cssModel.getComputedStyleAsync(node.id, this._forcedPseudoClasses, computedStyleCallback.bind(this));
         else
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to