Bug 1190635. Don't early-return for an mHeight change, since width changes can add extra change hints. r=heycam
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 04 Aug 2015 16:41:50 +1200
changeset 287755 458994e3fcc9929233dfd4dfa5b1f244e2c8c732
parent 287754 01576b408ea703f6abba09d8e38628723df18c75
child 287756 1164ec23627381ff9ce7747f8e5441560e7e5b82
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1190635
milestone42.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 1190635. Don't early-return for an mHeight change, since width changes can add extra change hints. r=heycam Don't return early for an mWidth change either.
layout/reftests/bugs/1190635-1-ref.html
layout/reftests/bugs/1190635-1.html
layout/reftests/bugs/reftest.list
layout/style/nsStyleStruct.cpp
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1190635-1-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML>
+<body style="width:500px; border:2px solid black;">
+<div style="width:300px; height:300px; background:yellow; float:left;"></div>
+<div style="width:300px; height:400px;">
+  <span style="display:inline-block; outline:3px solid cyan">
+    <span style="display:inline-block; width:300px; height:100px; outline:5px solid red" id="d"></span>
+  </span>
+</div>
+</body>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/1190635-1.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<body style="width:500px; border:2px solid black;">
+<div style="width:300px; height:300px; background:yellow; float:left;"></div>
+<div style="width:300px; height:400px;">
+  <span style="display:inline-block; outline:3px solid cyan">
+    <span style="display:inline-block; width:0; height:0; outline:5px solid red" id="d"></span>
+  </span>
+</div>
+<script>
+window.addEventListener("MozReftestInvalidate", function() {
+  d.style.width = "300px";
+  d.style.height = "100px";
+  document.documentElement.removeAttribute("class");
+});
+</script>
+</body>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1926,8 +1926,9 @@ skip-if(B2G||Mulet) == 1150021-1.xul 115
 == 1151145-1.html 1151145-1-ref.html
 == 1151306-1.html 1151306-1-ref.html
 == 1153845-1.html 1153845-1-ref.html
 == 1155828-1.html 1155828-1-ref.html
 == 1156129-1.html 1156129-1-ref.html
 == 1169331-1.html 1169331-1-ref.html
 == 1179078-1.html 1179078-1-ref.html
 fuzzy(1,74) fuzzy-if(gtkWidget,6,79) == 1174332-1.html 1174332-1-ref.html
+== 1190635-1.html 1190635-1-ref.html
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1595,47 +1595,44 @@ nsChangeHint nsStylePosition::CalcDiffer
 
   if (mHeight != aOther.mHeight ||
       mMinHeight != aOther.mMinHeight ||
       mMaxHeight != aOther.mMaxHeight) {
     // Height changes can affect descendant intrinsic sizes due to replaced
     // elements with percentage heights in descendants which also have
     // percentage heights. This is handled via nsChangeHint_UpdateComputedBSize
     // which clears intrinsic sizes for frames that have such replaced elements.
-    return NS_CombineHint(hint, nsChangeHint_NeedReflow |
+    NS_UpdateHint(hint, nsChangeHint_NeedReflow |
         nsChangeHint_UpdateComputedBSize |
         nsChangeHint_ReflowChangesSizeOrPosition);
   }
 
   if (mWidth != aOther.mWidth ||
       mMinWidth != aOther.mMinWidth ||
       mMaxWidth != aOther.mMaxWidth) {
     // None of our width differences can affect descendant intrinsic
     // sizes and none of them need to force children to reflow.
-    return
-      NS_CombineHint(hint,
-                     NS_SubtractHint(nsChangeHint_AllReflowHints,
-                                     NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
-                                                    nsChangeHint_NeedDirtyReflow)));
+    NS_UpdateHint(hint, NS_SubtractHint(nsChangeHint_AllReflowHints,
+                                        NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
+                                                       nsChangeHint_NeedDirtyReflow)));
   }
 
-  // If width and height have not changed, but any of the offsets have changed,
-  // then return the respective hints so that we would hopefully be able to
-  // avoid reflowing.
+  // If any of the offsets have changed, then return the respective hints
+  // so that we would hopefully be able to avoid reflowing.
   // Note that it is possible that we'll need to reflow when processing
   // restyles, but we don't have enough information to make a good decision
   // right now.
   // Don't try to handle changes between "auto" and non-auto efficiently;
   // that's tricky to do and will hardly ever be able to avoid a reflow.
   if (mOffset != aOther.mOffset) {
     if (IsAutonessEqual(mOffset, aOther.mOffset)) {
       NS_UpdateHint(hint, nsChangeHint(nsChangeHint_RecomputePosition |
                                        nsChangeHint_UpdateParentOverflow));
     } else {
-      return NS_CombineHint(hint, nsChangeHint_AllReflowHints);
+      NS_UpdateHint(hint, nsChangeHint_AllReflowHints);
     }
   }
   return hint;
 }
 
 /* static */ bool
 nsStylePosition::WidthCoordDependsOnContainer(const nsStyleCoord &aCoord)
 {