Bug 1222226 - Don't return eRestyleResult_StopWithStyleChange if the old style context is shared. r=dbaron

This commit is contained in:
Cameron McCormack 2015-11-08 11:06:14 +11:00
parent 3e64762ef3
commit 86613926e3
4 changed files with 40 additions and 0 deletions

View File

@ -3956,6 +3956,15 @@ ElementRestyler::RestyleSelf(nsIFrame* aSelf,
// for the other frames sharing the style context.
LOG_RESTYLE_CONTINUE("the old style context is shared");
result = eRestyleResult_Continue;
// It's not safe to return eRestyleResult_StopWithStyleChange,
// as even though we might not have cached structs for inherited
// properties on oldContext (and thus our samePointerStructs
// check later will look OK), oldContext and newContext might
// represent different inherited style data, and some of the
// elements currently sharing oldContext might need to keep it
// rather than get restyled to use newContext.
canStopWithStyleChange = false;
}
// Look at some details of the new style context to see if it would

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<style>
.red { color: red; }
</style>
<div>
<span id="s1">test</span><br />
<span id="s2" class=red>test</span><br />
<span id="s3" class=red>test</span><br />
<span id="s4">test</span><br />
</div>

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<style>
.red { color: red; }
</style>
<script>
document.onreadystatechange = function() {
if (document.readyState == "complete") {
var arr = ["s2","s3"];
arr.forEach(function(n) {
document.getElementById(n).className = "red";
});
}
};
</script>
<div>
<span id="s1">test</span><br />
<span id="s2">test</span><br />
<span id="s3">test</span><br />
<span id="s4">test</span><br />
</div>

View File

@ -1941,3 +1941,4 @@ fuzzy(1,74) fuzzy-if(gtkWidget,6,79) == 1174332-1.html 1174332-1-ref.html
== 1209994-2.html 1209994-2-ref.html
== 1209994-3.html 1209994-3-ref.html
== 1209994-4.html 1209994-4-ref.html
== 1222226-1.html 1222226-1-ref.html