Bug 1315632 - stylo: Leave old style on frames when nsChangeHint_ReconstructFrame was generated. r?emilio
MozReview-Commit-ID: 4rtsOwwZFkS
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -135,17 +135,21 @@ ServoRestyleManager::RecreateStyleContex
// Add the new change hint to the list of elements to process if
// we need to do any work.
if (changeHint) {
aChangeListToProcess.AppendChange(primaryFrame, element, changeHint);
}
// The frame reconstruction step (if needed) will ask for the descendants'
// style correctly. If not needed, we're done too.
- if (!primaryFrame) {
+ //
+ // Note that we must leave the old style on an existing frame that is
+ // about to be reframed, since some frame constructor code wants to
+ // inspect the old style to work out what to do.
+ if (!primaryFrame || (changeHint & nsChangeHint_ReconstructFrame)) {
aContent->UnsetIsDirtyForServo();
return;
}
// Hold the old style context alive, because it could become a dangling
// pointer during the replacement. In practice it's not a huge deal (on
// GetNextContinuationWithSameStyle the pointer is not dereferenced, only
// compared), but better not playing with dangling pointers if not needed.
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1315632-1-ref.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<style>
+.y { color: green; }
+</style>
+<div class=y>hello</div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1315632-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<style>
+.x { position: absolute; color: red; }
+.y { color: green; }
+</style>
+<div class=x>hello</div>
+<script>
+document.body.offsetHeight;
+document.querySelector(".x").className = "y";
+document.body.offsetHeight;
+</script>
--- a/layout/reftests/bugs/reftest-stylo.list
+++ b/layout/reftests/bugs/reftest-stylo.list
@@ -2367,13 +2367,14 @@ random-if(!winWidget) == 1273154-1.html
# depends on Windows font
random-if(!winWidget) == 1273154-2.html 1273154-2.html
# depends on Windows font
== 1274368-1.html 1274368-1.html
== 1276161-1a.html 1276161-1a.html
== 1276161-1b.html 1276161-1b.html
== 1276161-1a.html 1276161-1a.html
== 1275411-1.html 1275411-1.html
+== 1315632-1.html 1315632-1-ref.html
HTTP == 652991-1a.html 652991-1a.html
HTTP == 652991-1b.html 652991-1b.html
HTTP == 652991-2.html 652991-2.html
HTTP == 652991-3.html 652991-3.html
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1968,14 +1968,15 @@ random-if(!winWidget) == 1273154-2.html
== 1275411-1.html 1275411-1-ref.html
== 1288255.html 1288255-ref.html
fuzzy(8,1900) == 1291528.html 1291528-ref.html
# Buttons in 2 pages have different position and the rendering result can be
# different, but they should use the same button style and the background color
# should be same. |fuzzy()| here allows the difference in border, but not
# background color.
fuzzy(255,1000) skip-if(!cocoaWidget) == 1294102-1.html 1294102-1-ref.html
+== 1315632-1.html 1315632-1-ref.html
HTTP == 652991-1a.html 652991-1-ref.html
HTTP == 652991-1b.html 652991-1-ref.html
HTTP == 652991-2.html 652991-2-ref.html
HTTP == 652991-3.html 652991-3-ref.html
HTTP == 652991-4.html 652991-4-ref.html