Commit 7a51b165 authored by rune@opera.com's avatar rune@opera.com

Skip traversing wholeSubtree subtrees with clean invalidation bits.

During style invalidation we need to continue to traverse a subtree that is
marked with SubtreeStyleChange to clear any remaining invalidation bits.
But, when the childNeedsInvalidation bit is not set, there should be no
bits left to clear in the subtree. Hence, we can skip traversing that
subtree.

R=esprehn@chromium.org,chrishtr@chromium.org
BUG=381062

Review URL: https://codereview.chromium.org/317133002

git-svn-id: svn://svn.chromium.org/blink/trunk@175564 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e684d7bc
Check that all children of inner are recalculated.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS getComputedStyle(innerDivs[i], null).backgroundColor is transparent
PASS getComputedStyle(innerDivs[i], null).backgroundColor is transparent
PASS getComputedStyle(innerDivs[i], null).backgroundColor is transparent
PASS internals.updateStyleAndReturnAffectedElementCount() is 5
PASS getComputedStyle(innerDivs[i], null).backgroundColor is green
PASS getComputedStyle(innerDivs[i], null).backgroundColor is green
PASS getComputedStyle(innerDivs[i], null).backgroundColor is green
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<style>
.b .c { background-color: pink }
.a * { background-color: green }
</style>
<div id="outer">
<div id="inner">
<div>
<div></div>
<div></div>
</div>
</div>
</div>
<script>
description("Check that all children of inner are recalculated.");
var transparent = "rgba(0, 0, 0, 0)";
var green = "rgb(0, 128, 0)";
var inner = document.getElementById("inner");
var outer = document.getElementById("outer");
var innerDivs = inner.querySelectorAll("div");
for (var i=0; i < innerDivs.length; i++)
shouldBe("getComputedStyle(innerDivs[i], null).backgroundColor", "transparent");
document.body.offsetTop; // Force style recalc.
outer.className = "b";
inner.className = "a";
if (window.internals)
shouldBe("internals.updateStyleAndReturnAffectedElementCount()", "5");
for (var i=0; i < innerDivs.length; i++)
shouldBe("getComputedStyle(innerDivs[i], null).backgroundColor", "green");
</script>
......@@ -43,7 +43,7 @@ private:
void pushInvalidationSet(const DescendantInvalidationSet&);
bool matchesCurrentInvalidationSets(Element&);
bool hasInvalidationSets() const { return m_invalidationSets.size(); }
bool hasInvalidationSets() const { return !wholeSubtreeInvalid() && m_invalidationSets.size(); }
bool wholeSubtreeInvalid() const { return m_wholeSubtreeInvalid; }
void setWholeSubtreeInvalid() { m_wholeSubtreeInvalid = true; }
......
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