Web Inspector: [REGRESSION] Slow continuous DOM traversal with Up/Down keys
authorapavlov@chromium.org <apavlov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 16:40:15 +0000 (16:40 +0000)
committerapavlov@chromium.org <apavlov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 16:40:15 +0000 (16:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77643

Reviewed by Pavel Feldman.

Source/WebCore:

Test: inspector/styles/updates-during-dom-traversal.html

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

LayoutTests:

* inspector/styles/updates-during-dom-traversal-expected.txt: Added.
* inspector/styles/updates-during-dom-traversal.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106560 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/styles/updates-during-dom-traversal-expected.txt [new file with mode: 0644]
LayoutTests/inspector/styles/updates-during-dom-traversal.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/StylesSidebarPane.js

index 8083ed9..5a3399a 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-02  Alexander Pavlov  <apavlov@chromium.org>
+
+        Web Inspector: [REGRESSION] Slow continuous DOM traversal with Up/Down keys
+        https://bugs.webkit.org/show_bug.cgi?id=77643
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/styles/updates-during-dom-traversal-expected.txt: Added.
+        * inspector/styles/updates-during-dom-traversal.html: Added.
+
 2012-02-02  Tony Gentilcore  <tonyg@chromium.org>
 
         fast/speech/bubble-position.html fails on mac
diff --git a/LayoutTests/inspector/styles/updates-during-dom-traversal-expected.txt b/LayoutTests/inspector/styles/updates-during-dom-traversal-expected.txt
new file mode 100644 (file)
index 0000000..e99fec2
--- /dev/null
@@ -0,0 +1,4 @@
+Tests that style updates are throttled during DOM traversal. Bug 77643.
+
+OK: updates throttled
+
diff --git a/LayoutTests/inspector/styles/updates-during-dom-traversal.html b/LayoutTests/inspector/styles/updates-during-dom-traversal.html
new file mode 100644 (file)
index 0000000..b601afd
--- /dev/null
@@ -0,0 +1,55 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/elements-test.js"></script>
+<script>
+
+function test()
+{
+    var updateCount = 0;
+    var keydownCount = 5;
+    WebInspector.showPanel("elements");
+
+    InspectorTest.selectNodeAndWaitForStyles("inspected", selectCallback);
+    function selectCallback()
+    {
+        InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_rebuildUpdate", sniffUpdate, true);
+        var element = WebInspector.panels.elements.treeOutline.element;
+        for (var i = 0; i < keydownCount; ++i)
+            element.dispatchEvent(InspectorTest.createKeyEvent("Up"));
+
+        InspectorTest.runAfterPendingDispatches(completeCallback);
+    }
+
+    function completeCallback()
+    {
+        if (updateCount >= keydownCount)
+            InspectorTest.addResult("ERROR: got " + updateCount + " updates for " + keydownCount + " consecutive keydowns");
+        else
+            InspectorTest.addResult("OK: updates throttled");
+        InspectorTest.completeTest();
+    }
+
+    function sniffUpdate()
+    {
+        ++updateCount;
+    }
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests that style updates are throttled during DOM traversal. <a href="https://bugs.webkit.org/show_bug.cgi?id=77643">Bug 77643</a>.
+</p>
+
+<div></div>
+<div></div>
+<div></div>
+<div></div>
+<div></div>
+<div id="inspected"></div>
+
+</body>
+</html>
index dd633b5..16cb54b 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-02  Alexander Pavlov  <apavlov@chromium.org>
+
+        Web Inspector: [REGRESSION] Slow continuous DOM traversal with Up/Down keys
+        https://bugs.webkit.org/show_bug.cgi?id=77643
+
+        Reviewed by Pavel Feldman.
+
+        Test: inspector/styles/updates-during-dom-traversal.html
+
+        * inspector/front-end/StylesSidebarPane.js:
+        (WebInspector.StylesSidebarPane.prototype._executeRebuildUpdate):
+
 2012-02-02  Claudio Saavedra  <csaavedra@igalia.com> and Martin Robinson  <mrobinson@igalia.com>
 
         [GTK] WebKitWebView won't work in a GtkOffscreenWindow
index 884f2fc..080570c 100644 (file)
@@ -231,7 +231,7 @@ WebInspector.StylesSidebarPane.prototype = {
 
         function stylesCallback(matchedResult)
         {
-            if (matchedResult) {
+            if (matchedResult && this.node === node) {
                 resultStyles.matchedCSSRules = matchedResult.matchedCSSRules;
                 resultStyles.pseudoElements = matchedResult.pseudoElements;
                 resultStyles.inherited = matchedResult.inherited;