Bug 1227917 - Update |disp| after we've (potentially) cloned the Display struct so that subsequent tests of 'display' use the new value. r=jfkthame
authorMats Palmgren <mats@mozilla.com>
Wed, 25 Nov 2015 04:27:00 +0100
changeset 274242 01d95c93748c86fc5781d54428b80f41699c9c7d
parent 274241 7c9da18db90c17a96cf7c998ed10e4b1d4348bcb
child 274243 ad83a815314e76ccad3ded95f271643d8975088a
push id68527
push usercbook@mozilla.com
push dateThu, 26 Nov 2015 09:13:55 +0000
treeherdermozilla-inbound@01d95c93748c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1227917
milestone45.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 1227917 - Update |disp| after we've (potentially) cloned the Display struct so that subsequent tests of 'display' use the new value. r=jfkthame
layout/style/nsStyleContext.cpp
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -649,18 +649,19 @@ nsStyleContext::ApplyStyleFixups(bool aS
       nsRuleNode::EnsureBlockDisplay(displayVal, true);
     } else {
       // http://dev.w3.org/csswg/css-display/#transformations
       // "... a display-outside of 'contents' computes to block-level
       //  on the root element."
       displayVal = NS_STYLE_DISPLAY_BLOCK;
     }
     if (displayVal != disp->mDisplay) {
-      nsStyleDisplay *mutable_display =
+      nsStyleDisplay* mutable_display =
         static_cast<nsStyleDisplay*>(GetUniqueStyleData(eStyleStruct_Display));
+      disp = mutable_display;
 
       // If we're in this code, then mOriginalDisplay doesn't matter
       // for purposes of the cascade (because this nsStyleDisplay
       // isn't living in the ruletree anyway), and for determining
       // hypothetical boxes it's better to have mOriginalDisplay
       // matching mDisplay here.
       mutable_display->mOriginalDisplay = mutable_display->mDisplay =
         displayVal;
@@ -713,30 +714,32 @@ nsStyleContext::ApplyStyleFixups(bool aS
         // EnsureBlockDisplay() in nsRuleNode, so this call here won't change
         // anything. So we're OK.
         nsRuleNode::EnsureBlockDisplay(displayVal);
         if (displayVal != disp->mDisplay) {
           NS_ASSERTION(!disp->IsAbsolutelyPositionedStyle(),
                        "We shouldn't be changing the display value of "
                        "positioned content (and we should have already "
                        "converted its display value to be block-level...)");
-          nsStyleDisplay *mutable_display =
+          nsStyleDisplay* mutable_display =
             static_cast<nsStyleDisplay*>(GetUniqueStyleData(eStyleStruct_Display));
+          disp = mutable_display;
           mutable_display->mDisplay = displayVal;
         }
       }
     }
 
     if (::ShouldSuppressLineBreak(disp, containerContext, containerDisp)) {
       mBits |= NS_STYLE_SUPPRESS_LINEBREAK;
       uint8_t displayVal = disp->mDisplay;
       nsRuleNode::EnsureInlineDisplay(displayVal);
       if (displayVal != disp->mDisplay) {
-        nsStyleDisplay *mutable_display =
+        nsStyleDisplay* mutable_display =
           static_cast<nsStyleDisplay*>(GetUniqueStyleData(eStyleStruct_Display));
+        disp = mutable_display;
         mutable_display->mDisplay = displayVal;
       }
     }
   }
 
   // Set the NS_STYLE_IN_DISPLAY_NONE_SUBTREE bit
   if ((mParent && mParent->IsInDisplayNoneSubtree()) ||
       disp->mDisplay == NS_STYLE_DISPLAY_NONE) {
@@ -776,18 +779,19 @@ nsStyleContext::ApplyStyleFixups(bool aS
    *     to inline-block. [CSS21]
    *   ...etc.
    */
   if (disp->mDisplay == NS_STYLE_DISPLAY_INLINE && mParent) {
     // We don't need the full mozilla::WritingMode value (incorporating dir
     // and text-orientation) here; just the writing-mode property is enough.
     if (StyleVisibility()->mWritingMode !=
         mParent->StyleVisibility()->mWritingMode) {
-      nsStyleDisplay *mutable_display =
+      nsStyleDisplay* mutable_display =
         static_cast<nsStyleDisplay*>(GetUniqueStyleData(eStyleStruct_Display));
+      disp = mutable_display;
       mutable_display->mOriginalDisplay = mutable_display->mDisplay =
         NS_STYLE_DISPLAY_INLINE_BLOCK;
     }
   }
 
   // Compute User Interface style, to trigger loads of cursors
   StyleUserInterface();
 }