Bug 1315632 - stylo: Leave old style on frames when nsChangeHint_ReconstructFrame was generated. r=emilio
authorCameron McCormack <cam@mcc.id.au>
Mon, 07 Nov 2016 18:15:32 +0800
changeset 321367 c3a6dadbb885b0c0d42d28e07d026e31be8b6665
parent 321366 d25f3fd704e01f7974961043033c3c27d20cffaa
child 321368 7ac1ed5691cff25456127589fa3d40a52048d50e
push id33959
push usercmccormack@mozilla.com
push dateMon, 07 Nov 2016 13:59:40 +0000
treeherderautoland@c3a6dadbb885 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1315632
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1315632 - stylo: Leave old style on frames when nsChangeHint_ReconstructFrame was generated. r=emilio MozReview-Commit-ID: 4rtsOwwZFkS
layout/base/ServoRestyleManager.cpp
layout/reftests/bugs/1315632-1-ref.html
layout/reftests/bugs/1315632-1.html
layout/reftests/bugs/reftest-stylo.list
layout/reftests/bugs/reftest.list
--- 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