Commit 4da04d1d authored by apavlov@chromium.org's avatar apavlov@chromium.org

Web Inspector: [Styles] Styles not updated when there is a heavy stream of DOM updates

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

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Update the Styles pane even if there is a pending rebuild update for the same current node.

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

LayoutTests:

* inspector/styles/force-pseudo-state.html:
* inspector/styles/force-pseudo-state-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@128407 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 07c91e13
2012-09-12 Alexander Pavlov <apavlov@chromium.org>
Web Inspector: [Styles] Styles not updated when there is a heavy stream of DOM updates
https://bugs.webkit.org/show_bug.cgi?id=96482
Reviewed by Vsevolod Vlasov.
* inspector/styles/force-pseudo-state.html:
* inspector/styles/force-pseudo-state-expected.txt:
2012-09-12 Stephanie Lewis <slewis@apple.com>
css3/filters/custom/filter-fallback-to-software.html fails.
......@@ -8,11 +8,11 @@ element.style { ()
======== Matched CSS Rules ========
[expanded]
div:active, a:active { (force-pseudo-state.html:69)
div:active, a:active { (force-pseudo-state.html:12)
font-weight: bold;
[expanded]
div:hover, a:hover { (force-pseudo-state.html:61)
div:hover, a:hover { (force-pseudo-state.html:4)
color: red;
[expanded]
......@@ -39,11 +39,11 @@ element.style { ()
======== Matched CSS Rules ========
[expanded]
div:active, a:active { (force-pseudo-state.html:69)
div:active, a:active { (force-pseudo-state.html:12)
font-weight: bold;
[expanded]
div:focus, a:focus { (force-pseudo-state.html:65)
div:focus, a:focus { (force-pseudo-state.html:8)
border: 1px solid green;
border-top-color: green;
border-top-style: solid;
......
<html>
<head>
<style>
div:hover, a:hover {
color: red;
}
div:focus, a:focus {
border: 1px solid green;
}
div:active, a:active {
font-weight: bold;
}
</style>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/elements-test.js"></script>
<script>
......@@ -31,9 +45,14 @@ function test()
InspectorTest.addResult("");
InspectorTest.addResult("DIV with :hover and :active");
dumpData();
InspectorTest.waitForStyles("div", hoverCallback, true);
WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "hover", false);
WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "focus", true);
InspectorTest.waitForStyles("div", divSelected2, true);
function hoverCallback()
{
InspectorTest.waitForStyles("div", divSelected2, true);
WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "focus", true);
}
}
function divSelected2()
......@@ -41,9 +60,14 @@ function test()
InspectorTest.addResult("");
InspectorTest.addResult("DIV with :active and :focus");
dumpData();
InspectorTest.waitForStyles("div", focusCallback, true);
WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "focus", false);
WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "active", false);
InspectorTest.waitForStyles("div", divSelected3, true);
function focusCallback()
{
InspectorTest.waitForStyles("div", divSelected3, true);
WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "active", false);
}
}
function divSelected3(node)
......@@ -52,27 +76,10 @@ function test()
InspectorTest.addResult("DIV with no forced state");
dumpData();
InspectorTest.completeTest();
return;
}
}
</script>
<style>
div:hover, a:hover {
color: red;
}
div:focus, a:focus {
border: 1px solid green;
}
div:active, a:active {
font-weight: bold;
}
</style>
</head>
<body id="mainBody" class="main1 main2 mainpage" onload="runTest()" style="font-weight: normal; width: 85%; background-image: url(bar.png)">
<p>
Tests that forced element state is reflected in the DOM tree and Styles pane.
......
2012-09-12 Alexander Pavlov <apavlov@chromium.org>
Web Inspector: [Styles] Styles not updated when there is a heavy stream of DOM updates
https://bugs.webkit.org/show_bug.cgi?id=96482
Reviewed by Vsevolod Vlasov.
Update the Styles pane even if there is a pending rebuild update for the same current node.
* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane.prototype._rebuildUpdate):
2012-09-12 Chris Fleizach <cfleizach@apple.com>
AX: svg:image not accessible
......@@ -234,17 +234,14 @@ WebInspector.StylesSidebarPane.prototype = {
}
},
/**
* @param {function()=} userCallback
*/
_rebuildUpdate: function(userCallback)
_rebuildUpdate: function()
{
if (this._rebuildUpdateInProgress) {
this._lastNodeForInnerRebuild = this.node;
return;
}
var node = this._validateNode(userCallback);
var node = this._validateNode();
if (!node)
return;
......@@ -256,10 +253,13 @@ WebInspector.StylesSidebarPane.prototype = {
{
delete this._rebuildUpdateInProgress;
if (this._lastNodeForInnerRebuild) {
var lastNodeForRebuild = this._lastNodeForInnerRebuild;
if (lastNodeForRebuild) {
delete this._lastNodeForInnerRebuild;
this._rebuildUpdate(userCallback);
return;
if (lastNodeForRebuild !== this.node) {
this._rebuildUpdate();
return;
}
}
if (matchedResult && this.node === node) {
......@@ -268,8 +268,12 @@ WebInspector.StylesSidebarPane.prototype = {
resultStyles.inherited = matchedResult.inherited;
this._innerRebuildUpdate(node, resultStyles);
}
if (userCallback)
userCallback();
if (lastNodeForRebuild) {
// lastNodeForRebuild is the same as this.node - another rebuild has been requested.
this._rebuildUpdate();
return;
}
}
function inlineCallback(inlineStyle, attributesStyle)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment