Bug 1395586: layout/style build fixes (to be squashed). r?heycam draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 31 Aug 2017 17:12:13 +0200
changeset 656846 e5d82342f3750d373ae00e4f4948c1d4e305a64c
parent 656845 dd13d47c33cbabe1fba13da03d780ce3090fbbf4
child 656847 118edbe710067c7b81255ff0e2ec5043d3db9b6b
push id77338
push userbmo:emilio@crisal.io
push dateThu, 31 Aug 2017 19:11:35 +0000
reviewersheycam
bugs1395586
milestone57.0a1
Bug 1395586: layout/style build fixes (to be squashed). r?heycam MozReview-Commit-ID: CqIegsDyGSe
layout/style/GeckoStyleContext.cpp
layout/style/ServoStyleSet.cpp
layout/style/nsCSSPropList.h
layout/style/nsComputedDOMStyle.cpp
layout/style/nsRuleNode.cpp
layout/style/nsRuleNode.h
layout/style/nsStyleSet.cpp
layout/style/nsStyleTransformMatrix.cpp
--- a/layout/style/GeckoStyleContext.cpp
+++ b/layout/style/GeckoStyleContext.cpp
@@ -589,20 +589,21 @@ ShouldSuppressLineBreak(const nsStyleCon
       !nsCSSAnonBoxes::IsNonElement(aContext->GetPseudo()) &&
       !RubyUtils::IsRubyPseudo(aContext->GetPseudo())) {
     return false;
   }
   if (aParentContext->ShouldSuppressLineBreak()) {
     // Line break suppressing bit is propagated to any children of
     // line participants, which include inline, contents, and inline
     // ruby boxes.
-    if (aParentDisplay->mDisplay == mozilla::StyleDisplay::Inline ||
-        aParentDisplay->mDisplay == mozilla::StyleDisplay::Contents ||
-        aParentDisplay->mDisplay == mozilla::StyleDisplay::Ruby ||
-        aParentDisplay->mDisplay == mozilla::StyleDisplay::RubyBaseContainer) {
+    auto display = aParentDisplay->Display();
+    if (display == mozilla::StyleDisplay::Inline ||
+        display == mozilla::StyleDisplay::Contents ||
+        display == mozilla::StyleDisplay::Ruby ||
+        display == mozilla::StyleDisplay::RubyBaseContainer) {
       return true;
     }
   }
   // Any descendant of ruby level containers is non-breakable, but
   // the level containers themselves are breakable. We have to check
   // the container display type against all ruby display type here
   // because any of the ruby boxes could be anonymous.
   // Note that, when certain HTML tags, e.g. form controls, have ruby
@@ -616,22 +617,22 @@ ShouldSuppressLineBreak(const nsStyleCon
   //    any, won't be able to break the line its ruby ancestor lays; and
   // 3. their parent frame is always a ruby content frame (due to
   //    anonymous ruby box generation), which makes line layout suppress
   //    any optional line break around this frame.
   // However, there is one special case which is BR tag, because it
   // directly affects the line layout. This case is handled by the BR
   // frame which checks the flag of its parent frame instead of itself.
   if ((aParentDisplay->IsRubyDisplayType() &&
-       aDisplay->mDisplay != mozilla::StyleDisplay::RubyBaseContainer &&
-       aDisplay->mDisplay != mozilla::StyleDisplay::RubyTextContainer) ||
+       aDisplay->Display() != mozilla::StyleDisplay::RubyBaseContainer &&
+       aDisplay->Display() != mozilla::StyleDisplay::RubyTextContainer) ||
       // Since ruby base and ruby text may exist themselves without any
       // non-anonymous frame outside, we should also check them.
-      aDisplay->mDisplay == mozilla::StyleDisplay::RubyBase ||
-      aDisplay->mDisplay == mozilla::StyleDisplay::RubyText) {
+      aDisplay->Display() == mozilla::StyleDisplay::RubyBase ||
+      aDisplay->Display() == mozilla::StyleDisplay::RubyText) {
     return true;
   }
   return false;
 }
 
 void
 GeckoStyleContext::FinishConstruction()
 {
@@ -649,17 +650,17 @@ GeckoStyleContext::SetStyleBits()
 {
   if ((mParent && mParent->HasPseudoElementData()) || IsPseudoElement()) {
     AddStyleBit(NS_STYLE_HAS_PSEUDO_ELEMENT_DATA);
   }
 
   // Set the NS_STYLE_IN_DISPLAY_NONE_SUBTREE bit
   const nsStyleDisplay* disp = StyleDisplay();
   if ((mParent && mParent->IsInDisplayNoneSubtree()) ||
-      disp->mDisplay == mozilla::StyleDisplay::None) {
+      disp->Display() == mozilla::StyleDisplay::None) {
     AddStyleBit(NS_STYLE_IN_DISPLAY_NONE_SUBTREE);
   }
 
   // Mark text combined for text-combine-upright, as needed.
   if (mPseudoTag == nsCSSAnonBoxes::mozText && mParent &&
       mParent->StyleVisibility()->mWritingMode !=
         NS_STYLE_WRITING_MODE_HORIZONTAL_TB &&
       mParent->StyleText()->mTextCombineUpright ==
@@ -671,17 +672,17 @@ GeckoStyleContext::SetStyleBits()
 // Flex & grid containers blockify their children.
 //  "The display value of a flex item is blockified"
 //    https://drafts.csswg.org/css-flexbox-1/#flex-items
 //  "The display value of a grid item is blockified"
 //    https://drafts.csswg.org/css-grid/#grid-items
 static bool
 ShouldBlockifyChildren(const nsStyleDisplay* aStyleDisp)
 {
-  auto displayVal = aStyleDisp->mDisplay;
+  auto displayVal = aStyleDisp->Display();
   return mozilla::StyleDisplay::Flex == displayVal ||
     mozilla::StyleDisplay::InlineFlex == displayVal ||
     mozilla::StyleDisplay::Grid == displayVal ||
     mozilla::StyleDisplay::InlineGrid == displayVal;
 }
 
 #ifdef DEBUG
 void
@@ -781,17 +782,17 @@ GeckoStyleContext::ApplyStyleFixups(bool
   // For an N-line drop initial in a Western script, the cap-height of the
   // letter needs to be (N – 1) times the line-height, plus the cap-height
   // of the surrounding text.
   if (mPseudoTag == nsCSSPseudoElements::firstLetter) {
     const nsStyleTextReset* textReset = StyleTextReset();
     if (textReset->mInitialLetterSize != 0.0f) {
       GeckoStyleContext* containerSC = GetParent();
       const nsStyleDisplay* containerDisp = containerSC->StyleDisplay();
-      while (containerDisp->mDisplay == mozilla::StyleDisplay::Contents) {
+      while (containerDisp->Display() == mozilla::StyleDisplay::Contents) {
         if (!containerSC->GetParent()) {
           break;
         }
         containerSC = containerSC->GetParent();
         containerDisp = containerSC->StyleDisplay();
       }
       nscoord containerLH =
         ReflowInput::CalcLineHeight(nullptr, containerSC, NS_AUTOHEIGHT, 1.0f);
@@ -854,17 +855,17 @@ GeckoStyleContext::ApplyStyleFixups(bool
         nsStyleVisibility* uniqueVisibility = GET_UNIQUE_STYLE_DATA(Visibility);
         uniqueVisibility->mDirection = dir;
       }
     }
   }
 
   // Correct tables.
   const nsStyleDisplay* disp = StyleDisplay();
-  if (disp->mDisplay == mozilla::StyleDisplay::Table) {
+  if (disp->Display() == mozilla::StyleDisplay::Table) {
     // -moz-center and -moz-right are used for HTML's alignment
     // This is covering the <div align="right"><table>...</table></div> case.
     // In this case, we don't want to inherit the text alignment into the table.
     const nsStyleText* text = StyleText();
 
     if (text->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_LEFT ||
         text->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_CENTER ||
         text->mTextAlign == NS_STYLE_TEXT_ALIGN_MOZ_RIGHT)
@@ -905,36 +906,36 @@ GeckoStyleContext::ApplyStyleFixups(bool
       // document's isn't because we lazy-load ua.css there), and the ::backdrop
       // pseudo-element.  This last is explicitly allowed to have any specified
       // display type in the spec, but computes to a blockified display type per
       // various provisions of
       // https://fullscreen.spec.whatwg.org/#new-stacking-layer
       (!mPseudoTag ||
        mPseudoTag == nsCSSAnonBoxes::viewport ||
        mPseudoTag == nsCSSPseudoElements::backdrop)) {
-    auto displayVal = disp->mDisplay;
+    auto displayVal = disp->Display();
     if (displayVal != mozilla::StyleDisplay::Contents) {
-      nsRuleNode::EnsureBlockDisplay(displayVal, true);
+      displayVal = 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 = mozilla::StyleDisplay::Block;
     }
-    if (displayVal != disp->mDisplay) {
+    if (displayVal != disp->Display()) {
       nsStyleDisplay* mutable_display = GET_UNIQUE_STYLE_DATA(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;
+      // matching Display() here.
+      mutable_display->SetOriginalDisplay(displayVal);
+      mutable_display->SetDisplay(displayVal);
     }
   }
 
   // Adjust the "display" values of flex and grid items (but not for raw text
   // or placeholders). CSS3 Flexbox section 4 says:
   //   # The computed 'display' of a flex item is determined
   //   # by applying the table in CSS 2.1 Chapter 9.7.
   // ...which converts inline-level elements to their block-level equivalents.
@@ -943,61 +944,59 @@ GeckoStyleContext::ApplyStyleFixups(bool
   if (!aSkipParentDisplayBasedStyleFixup && mParent) {
     // Skip display:contents ancestors to reach the potential container.
     // (If there are only display:contents ancestors between this node and
     // a flex/grid container ancestor, then this node is a flex/grid item, since
     // its parent *in the frame tree* will be the flex/grid container. So we treat
     // it like a flex/grid item here.)
     GeckoStyleContext* containerContext = GetParent();
     const nsStyleDisplay* containerDisp = containerContext->StyleDisplay();
-    while (containerDisp->mDisplay == mozilla::StyleDisplay::Contents) {
+    while (containerDisp->Display() == mozilla::StyleDisplay::Contents) {
       if (!containerContext->GetParent()) {
         break;
       }
       containerContext = containerContext->GetParent();
       containerDisp = containerContext->StyleDisplay();
     }
     if (ShouldBlockifyChildren(containerDisp) &&
         !nsCSSAnonBoxes::IsNonElement(GetPseudo())) {
       // NOTE: Technically, we shouldn't modify the 'display' value of
       // positioned elements, since they aren't flex/grid items. However,
       // we don't need to worry about checking for that, because if we're
       // positioned, we'll have already been through a call to
       // EnsureBlockDisplay() in nsRuleNode, so this call here won't change
       // anything. So we're OK.
-      auto displayVal = disp->mDisplay;
-      nsRuleNode::EnsureBlockDisplay(displayVal);
-      if (displayVal != disp->mDisplay) {
+      auto blockVal = nsRuleNode::EnsureBlockDisplay(disp->Display());
+      if (blockVal != disp->Display()) {
         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 = GET_UNIQUE_STYLE_DATA(Display);
         disp = mutable_display;
-        mutable_display->mDisplay = displayVal;
+        mutable_display->SetDisplay(blockVal);
       }
     }
   }
 
   // Note: This must come after the blockification above, otherwise we fail
   // the grid-item-blockifying-001.html reftest.
   if (mParent && ::ShouldSuppressLineBreak(this, disp, mParent,
                                            mParent->StyleDisplay())) {
     mBits |= NS_STYLE_SUPPRESS_LINEBREAK;
-    auto displayVal = disp->mDisplay;
-    nsRuleNode::EnsureInlineDisplay(displayVal);
-    if (displayVal != disp->mDisplay) {
+    auto inlineVal = nsRuleNode::EnsureInlineDisplay(disp->Display());
+    if (inlineVal != disp->Display()) {
       nsStyleDisplay* mutable_display = GET_UNIQUE_STYLE_DATA(Display);
       disp = mutable_display;
-      mutable_display->mDisplay = displayVal;
+      mutable_display->SetDisplay(inlineVal);
     }
   }
   // Suppress border/padding of ruby level containers
-  if (disp->mDisplay == mozilla::StyleDisplay::RubyBaseContainer ||
-      disp->mDisplay == mozilla::StyleDisplay::RubyTextContainer) {
+  if (disp->Display() == mozilla::StyleDisplay::RubyBaseContainer ||
+      disp->Display() == mozilla::StyleDisplay::RubyTextContainer) {
     CreateEmptyStyleData(eStyleStruct_Border);
     CreateEmptyStyleData(eStyleStruct_Padding);
   }
   if (disp->IsRubyDisplayType()) {
     // Per CSS Ruby spec section Bidi Reordering, for all ruby boxes,
     // the 'normal' and 'embed' values of 'unicode-bidi' should compute to
     // 'isolate', and 'bidi-override' should compute to 'isolate-override'.
     const nsStyleTextReset* textReset = StyleTextReset();
@@ -1017,32 +1016,32 @@ GeckoStyleContext::ApplyStyleFixups(bool
   /*
    * According to https://drafts.csswg.org/css-writing-modes-3/#block-flow:
    *
    * If a box has a different block flow direction than its containing block:
    *   * If the box has a specified display of inline, its display computes
    *     to inline-block. [CSS21]
    *   ...etc.
    */
-  if (disp->mDisplay == mozilla::StyleDisplay::Inline &&
+  if (disp->Display() == mozilla::StyleDisplay::Inline &&
       !nsCSSAnonBoxes::IsNonElement(mPseudoTag) &&
       mParent) {
     auto cbContext = GetParent();
-    while (cbContext->StyleDisplay()->mDisplay == mozilla::StyleDisplay::Contents) {
+    while (cbContext->StyleDisplay()->Display() == mozilla::StyleDisplay::Contents) {
       cbContext = cbContext->GetParent();
     }
     MOZ_ASSERT(cbContext, "the root context can't have display:contents");
     // 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 !=
           cbContext->StyleVisibility()->mWritingMode) {
       nsStyleDisplay* mutable_display = GET_UNIQUE_STYLE_DATA(Display);
       disp = mutable_display;
-      mutable_display->mOriginalDisplay = mutable_display->mDisplay =
-        mozilla::StyleDisplay::InlineBlock;
+      mutable_display->SetDisplay(StyleDisplay::InlineBlock);
+      mutable_display->SetOriginalDisplay(StyleDisplay::InlineBlock);
     }
   }
 
   // Compute User Interface style, to trigger loads of cursors
   StyleUserInterface();
 #undef GET_UNIQUE_STYLE_DATA
 }
 
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -840,17 +840,17 @@ ServoStyleSet::ProbePseudoElementStyle(E
   // For :before and :after pseudo-elements, having display: none or no
   // 'content' property is equivalent to not having the pseudo-element
   // at all.
   bool isBeforeOrAfter = aType == CSSPseudoElementType::before ||
                          aType == CSSPseudoElementType::after;
   if (isBeforeOrAfter) {
     const nsStyleDisplay* display = computedValues->ComputedData()->GetStyleDisplay();
     const nsStyleContent* content = computedValues->ComputedData()->GetStyleContent();
-    if (display->mDisplay == StyleDisplay::None ||
+    if (display->Display() == StyleDisplay::None ||
         content->ContentCount() == 0) {
       return nullptr;
     }
   }
 
   return computedValues.forget();
 }
 
--- a/layout/style/nsCSSPropList.h
+++ b/layout/style/nsCSSPropList.h
@@ -473,17 +473,17 @@ CSS_PROP_DISPLAY(
 CSS_PROP_DISPLAY(
     backface-visibility,
     backface_visibility,
     BackfaceVisibility,
     CSS_PROPERTY_PARSE_VALUE,
     "",
     VARIANT_HK,
     kBackfaceVisibilityKTable,
-    offsetof(nsStyleDisplay, mBackfaceVisibility),
+    CSS_PROP_NO_OFFSET,
     eStyleAnimType_Discrete)
 CSS_PROP_SHORTHAND(
     background,
     background,
     Background,
     CSS_PROPERTY_PARSE_FUNCTION,
     "")
 CSS_PROP_BACKGROUND(
@@ -1681,17 +1681,17 @@ CSS_PROP_DISPLAY(
     CSS_PROPERTY_PARSE_VALUE |
         // This is allowed because we need to make the placeholder
         // pseudo-element an inline-block in the UA stylesheet. It is a block
         // by default.
         CSS_PROPERTY_APPLIES_TO_PLACEHOLDER,
     "",
     VARIANT_HK,
     kDisplayKTable,
-    offsetof(nsStyleDisplay, mDisplay),
+    CSS_PROP_NO_OFFSET,
     eStyleAnimType_None)
 CSS_PROP_SVGRESET(
     dominant-baseline,
     dominant_baseline,
     DominantBaseline,
     CSS_PROPERTY_PARSE_VALUE,
     "",
     VARIANT_HK,
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -1144,26 +1144,26 @@ nsComputedDOMStyle::DoGetBinding()
 
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetClear()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
-  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mBreakType,
+  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->BreakType(),
                                                nsCSSProps::kClearKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetFloat()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
-  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mFloat,
+  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->Float(),
                                                nsCSSProps::kFloatKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetBottom()
 {
   return GetOffsetWidthFor(eSideBottom);
@@ -1558,44 +1558,44 @@ nsComputedDOMStyle::DoGetPerspective()
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetBackfaceVisibility()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
-      nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mBackfaceVisibility,
+      nsCSSProps::ValueToKeywordEnum(StyleDisplay()->BackfaceVisibility(),
                                      nsCSSProps::kBackfaceVisibilityKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetTransformStyle()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
-      nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mTransformStyle,
+      nsCSSProps::ValueToKeywordEnum(StyleDisplay()->TransformStyle(),
                                      nsCSSProps::kTransformStyleKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetTransform()
 {
   const nsStyleDisplay* display = StyleDisplay();
   return GetTransformValue(display->mSpecifiedTransform);
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetTransformBox()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
-      nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mTransformBox,
+      nsCSSProps::ValueToKeywordEnum(StyleDisplay()->TransformBox(),
                                      nsCSSProps::kTransformBoxKTable));
   return val.forget();
 }
 
 /* static */ already_AddRefed<nsROCSSPrimitiveValue>
 nsComputedDOMStyle::MatrixToCSSValue(const mozilla::gfx::Matrix4x4& matrix)
 {
   bool is3D = !matrix.Is2D();
@@ -3444,63 +3444,63 @@ nsComputedDOMStyle::DoGetMarginRightWidt
   return GetMarginWidthFor(eSideRight);
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetOrient()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
-    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mOrient,
+    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->Orient(),
                                    nsCSSProps::kOrientKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetScrollBehavior()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
-    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mScrollBehavior,
+    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->ScrollBehavior(),
                                    nsCSSProps::kScrollBehaviorKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetScrollSnapType()
 {
   const nsStyleDisplay* display = StyleDisplay();
-  if (display->mScrollSnapTypeX != display->mScrollSnapTypeY) {
+  if (display->ScrollSnapTypeX() != display->ScrollSnapTypeY()) {
     // No value to return.  We can't express this combination of
     // values as a shorthand.
     return nullptr;
   }
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
-    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mScrollSnapTypeX,
+    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->ScrollSnapTypeX(),
                                    nsCSSProps::kScrollSnapTypeKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetScrollSnapTypeX()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
-    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mScrollSnapTypeX,
+    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->ScrollSnapTypeX(),
                                    nsCSSProps::kScrollSnapTypeKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetScrollSnapTypeY()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
-    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mScrollSnapTypeY,
+    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->ScrollSnapTypeY(),
                                    nsCSSProps::kScrollSnapTypeKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::GetScrollSnapPoints(const nsStyleCoord& aCoord)
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
@@ -4405,17 +4405,17 @@ nsComputedDOMStyle::DoGetCursor()
   valueList->AppendCSSValue(val.forget());
   return valueList.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetAppearance()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
-  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mAppearance,
+  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->Appearance(),
                                                nsCSSProps::kAppearanceKTable));
   return val.forget();
 }
 
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetBoxAlign()
 {
@@ -4810,27 +4810,27 @@ nsComputedDOMStyle::DoGetUserSelect()
                                    nsCSSProps::kUserSelectKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetDisplay()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
-  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mDisplay,
+  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->Display(),
                                                nsCSSProps::kDisplayKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetContain()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
-  int32_t mask = StyleDisplay()->mContain;
+  int32_t mask = StyleDisplay()->Contain();
 
   if (mask == 0) {
     val->SetIdent(eCSSKeyword_none);
   } else if (mask & NS_STYLE_CONTAIN_STRICT) {
     NS_ASSERTION(mask == (NS_STYLE_CONTAIN_STRICT | NS_STYLE_CONTAIN_ALL_BITS),
                  "contain: strict should imply contain: layout style paint");
     val->SetIdent(eCSSKeyword_strict);
   } else {
@@ -4844,17 +4844,17 @@ nsComputedDOMStyle::DoGetContain()
 
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetPosition()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
-  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mPosition,
+  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->Position(),
                                                nsCSSProps::kPositionKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetClip()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
@@ -4921,115 +4921,115 @@ nsComputedDOMStyle::DoGetWillChange()
   return valueList.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetOverflow()
 {
   const nsStyleDisplay* display = StyleDisplay();
 
-  if (display->mOverflowX != display->mOverflowY) {
+  if (display->OverflowX() != display->OverflowY()) {
     // No value to return.  We can't express this combination of
     // values as a shorthand.
     return nullptr;
   }
 
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
-  val->SetIdent(nsCSSProps::ValueToKeywordEnum(display->mOverflowX,
+  val->SetIdent(nsCSSProps::ValueToKeywordEnum(display->OverflowX(),
                                                nsCSSProps::kOverflowKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetOverflowX()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
-    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mOverflowX,
+    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->OverflowX(),
                                    nsCSSProps::kOverflowSubKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetOverflowY()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
-    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mOverflowY,
+    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->OverflowY(),
                                    nsCSSProps::kOverflowSubKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetOverflowClipBox()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
   val->SetIdent(
-    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mOverflowClipBox,
+    nsCSSProps::ValueToKeywordEnum(StyleDisplay()->OverflowClipBox(),
                                    nsCSSProps::kOverflowClipBoxKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetResize()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
-  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mResize,
+  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->Resize(),
                                                nsCSSProps::kResizeKTable));
   return val.forget();
 }
 
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetPageBreakAfter()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   const nsStyleDisplay *display = StyleDisplay();
 
-  if (display->mBreakAfter) {
+  if (display->BreakAfter()) {
     val->SetIdent(eCSSKeyword_always);
   } else {
     val->SetIdent(eCSSKeyword_auto);
   }
 
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetPageBreakBefore()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   const nsStyleDisplay *display = StyleDisplay();
 
-  if (display->mBreakBefore) {
+  if (display->BreakBefore()) {
     val->SetIdent(eCSSKeyword_always);
   } else {
     val->SetIdent(eCSSKeyword_auto);
   }
 
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetPageBreakInside()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
-  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mBreakInside,
+  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->BreakInside(),
                                                nsCSSProps::kPageBreakInsideKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetTouchAction()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
-  int32_t intValue = StyleDisplay()->mTouchAction;
+  int32_t intValue = StyleDisplay()->TouchAction();
 
   // None and Auto and Manipulation values aren't allowed
   // to be in conjunction with other values.
   // But there are all checks in CSSParserImpl::ParseTouchAction
   nsAutoString valueStr;
   nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_touch_action, intValue,
     NS_STYLE_TOUCH_ACTION_NONE, NS_STYLE_TOUCH_ACTION_MANIPULATION,
     valueStr);
@@ -5043,17 +5043,17 @@ nsComputedDOMStyle::DoGetHeight()
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   bool calcHeight = false;
 
   if (mInnerFrame) {
     calcHeight = true;
 
     const nsStyleDisplay* displayData = StyleDisplay();
-    if (displayData->mDisplay == mozilla::StyleDisplay::Inline &&
+    if (displayData->Display() == mozilla::StyleDisplay::Inline &&
         !(mInnerFrame->IsFrameOfType(nsIFrame::eReplaced)) &&
         // An outer SVG frame should behave the same as eReplaced in this case
         !mInnerFrame->IsSVGOuterSVGFrame()) {
 
       calcHeight = false;
     }
   }
 
@@ -5087,17 +5087,17 @@ nsComputedDOMStyle::DoGetWidth()
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
 
   bool calcWidth = false;
 
   if (mInnerFrame) {
     calcWidth = true;
 
     const nsStyleDisplay *displayData = StyleDisplay();
-    if (displayData->mDisplay == mozilla::StyleDisplay::Inline &&
+    if (displayData->Display() == mozilla::StyleDisplay::Inline &&
         !(mInnerFrame->IsFrameOfType(nsIFrame::eReplaced)) &&
         // An outer SVG frame should behave the same as eReplaced in this case
         !mInnerFrame->IsSVGOuterSVGFrame()) {
 
       calcWidth = false;
     }
   }
 
@@ -5156,17 +5156,17 @@ nsComputedDOMStyle::ShouldHonorMinSizeAu
 
   // Note: We only need to bother checking one "overflow" subproperty for
   // "visible", because a non-"visible" value in either axis would force the
   // other axis to also be non-"visible" as well.
 
   if (mOuterFrame) {
     nsIFrame* containerFrame = mOuterFrame->GetParent();
     if (containerFrame &&
-        StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE) {
+        StyleDisplay()->OverflowX() == NS_STYLE_OVERFLOW_VISIBLE) {
       if (containerFrame->IsFlexContainerFrame() &&
           (static_cast<nsFlexContainerFrame*>(containerFrame)->IsHorizontal() ==
            (aAxis == eAxisHorizontal))) {
         return true;
       }
       if (containerFrame->IsGridContainerFrame()) {
         return true;
       }
@@ -5214,17 +5214,17 @@ nsComputedDOMStyle::DoGetMixBlendMode()
                                                nsCSSProps::kBlendModeKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetIsolation()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
-  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mIsolation,
+  val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->Isolation(),
                                                nsCSSProps::kIsolationKTable));
   return val.forget();
 }
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::DoGetObjectFit()
 {
   RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
@@ -5261,17 +5261,17 @@ nsComputedDOMStyle::DoGetTop()
 
 already_AddRefed<CSSValue>
 nsComputedDOMStyle::GetOffsetWidthFor(mozilla::Side aSide)
 {
   const nsStyleDisplay* display = StyleDisplay();
 
   AssertFlushedPendingReflows();
 
-  uint8_t position = display->mPosition;
+  uint8_t position = display->Position();
   if (!mOuterFrame) {
     // GetRelativeOffset and GetAbsoluteOffset don't handle elements
     // without frames in any sensible way.  GetStaticOffset, however,
     // is perfect for that case.
     position = NS_STYLE_POSITION_STATIC;
   }
 
   switch (position) {
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -209,26 +209,25 @@ nsRuleNode::ChildrenHashOps = {
 //  - We allow the behavior of "list-item" to be customized.
 //    CSS21 says that position/float do not convert 'list-item' to 'block',
 //    but it explicitly does not define whether 'list-item' should be
 //    converted to block *on the root node*. To allow for flexibility
 //    (so that we don't have to support a list-item root node), this method
 //    lets the caller pick either behavior, using the 'aConvertListItem' arg.
 //    Reference: http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo
 /* static */
-void
-nsRuleNode::EnsureBlockDisplay(StyleDisplay& display,
+StyleDisplay
+nsRuleNode::EnsureBlockDisplay(StyleDisplay display,
                                bool aConvertListItem /* = false */)
 {
   // see if the display value is already a block
   switch (display) {
   case StyleDisplay::ListItem:
     if (aConvertListItem) {
-      display = StyleDisplay::Block;
-      break;
+      return StyleDisplay::Block;
     } // else, fall through to share the 'break' for non-changing display vals
     MOZ_FALLTHROUGH;
   case StyleDisplay::None:
   case StyleDisplay::Contents:
     // never change display:none or display:contents *ever*
   case StyleDisplay::Table:
   case StyleDisplay::Block:
   case StyleDisplay::Flex:
@@ -239,74 +238,74 @@ nsRuleNode::EnsureBlockDisplay(StyleDisp
     // This is equivalent to nsStyleDisplay::IsBlockOutside.  (XXX Maybe we
     // should just call that?)
     // This needs to match the check done in
     // nsCSSFrameConstructor::FindMathMLData for <math>.
     break;
 
   case StyleDisplay::InlineTable:
     // make inline tables into tables
-    display = StyleDisplay::Table;
-    break;
+    return StyleDisplay::Table;
 
   case StyleDisplay::InlineFlex:
     // make inline flex containers into flex containers
-    display = StyleDisplay::Flex;
-    break;
+    return StyleDisplay::Flex;
 
   case StyleDisplay::WebkitInlineBox:
     // make -webkit-inline-box containers into -webkit-box containers
-    display = StyleDisplay::WebkitBox;
-    break;
+    return StyleDisplay::WebkitBox;
 
   case StyleDisplay::InlineGrid:
     // make inline grid containers into grid containers
-    display = StyleDisplay::Grid;
-    break;
+    return StyleDisplay::Grid;
 
   default:
     // make it a block
-    display = StyleDisplay::Block;
-  }
+    return StyleDisplay::Block;
+  }
+
+  return display;
 }
 
 // EnsureInlineDisplay:
 //  - if the display value (argument) is not an inline type
 //    then we set it to a valid inline display value
 /* static */
-void
-nsRuleNode::EnsureInlineDisplay(StyleDisplay& display)
+StyleDisplay
+nsRuleNode::EnsureInlineDisplay(StyleDisplay display)
 {
   // see if the display value is already inline
   switch (display) {
     case StyleDisplay::Block:
     case StyleDisplay::FlowRoot:
-      display = StyleDisplay::InlineBlock;
+      return StyleDisplay::InlineBlock;
       break;
     case StyleDisplay::Table:
-      display = StyleDisplay::InlineTable;
+      return StyleDisplay::InlineTable;
       break;
     case StyleDisplay::Flex:
-      display = StyleDisplay::InlineFlex;
+      return StyleDisplay::InlineFlex;
       break;
     case StyleDisplay::WebkitBox:
-      display = StyleDisplay::WebkitInlineBox;
+      return StyleDisplay::WebkitInlineBox;
       break;
     case StyleDisplay::Grid:
-      display = StyleDisplay::InlineGrid;
+      return StyleDisplay::InlineGrid;
       break;
     case StyleDisplay::MozBox:
-      display = StyleDisplay::MozInlineBox;
+      return StyleDisplay::MozInlineBox;
       break;
     case StyleDisplay::MozStack:
-      display = StyleDisplay::MozInlineStack;
+      return StyleDisplay::MozInlineStack;
       break;
     default:
       break; // Do nothing
   }
+
+  return display;
 }
 
 static nscoord CalcLengthWith(const nsCSSValue& aValue,
                               nscoord aFontSize,
                               const nsStyleFont* aStyleFont,
                               nsStyleContext* aStyleContext,
                               nsPresContext* aPresContext,
                               bool aUseProvidedRootEmSize,
@@ -5621,18 +5620,18 @@ nsRuleNode::ComputeDisplayData(void* aSt
 {
   COMPUTE_START_RESET(Display, display, parentDisplay)
 
   // We may have ended up with aStartStruct's values of mDisplay and
   // mFloat, but those may not be correct if our style data overrides
   // its position or float properties.  Reset to mOriginalDisplay and
   // mOriginalFloat; if it turns out we still need the display/floats
   // adjustments, we'll do them below.
-  display->mDisplay = display->mOriginalDisplay;
-  display->mFloat = display->mOriginalFloat;
+  display->SetDisplay(display->OriginalDisplay());
+  display->SetFloat(display->OriginalFloat());
 
   // Each property's index in this array must match its index in the
   // const array |transitionPropInfo| above.
   TransitionPropData transitionPropData[4];
   TransitionPropData& delay = transitionPropData[0];
   TransitionPropData& duration = transitionPropData[1];
   TransitionPropData& property = transitionPropData[2];
   TransitionPropData& timingFunction = transitionPropData[3];
@@ -6030,45 +6029,55 @@ nsRuleNode::ComputeDisplayData(void* aSt
       if (d.list) {
         d.list = d.list->mNext ? d.list->mNext :
           aRuleData->ValueFor(info.property)->GetListValue();
       }
     }
   }
 
   // display: enum, inherit, initial
-  SetValue(*aRuleData->ValueForDisplay(), display->mDisplay, conditions,
+  mozilla::StyleDisplay displayValue = display->Display();
+  SetValue(*aRuleData->ValueForDisplay(), displayValue, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mDisplay,
+           parentDisplay->Display(),
            StyleDisplay::Inline);
+  display->SetDisplay(displayValue);
 
   // contain: none, enum, inherit, initial
-  SetValue(*aRuleData->ValueForContain(), display->mContain, conditions,
+  uint8_t containValue = display->Contain();
+  SetValue(*aRuleData->ValueForContain(), containValue, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mContain,
+           parentDisplay->Contain(),
            NS_STYLE_CONTAIN_NONE, Unused,
            NS_STYLE_CONTAIN_NONE, Unused, Unused);
+  display->SetContain(containValue);
 
   // scroll-behavior: enum, inherit, initial
-  SetValue(*aRuleData->ValueForScrollBehavior(), display->mScrollBehavior,
+  uint8_t scrollBehavior = display->ScrollBehavior();
+  SetValue(*aRuleData->ValueForScrollBehavior(), scrollBehavior,
            conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mScrollBehavior, NS_STYLE_SCROLL_BEHAVIOR_AUTO);
+           parentDisplay->ScrollBehavior(), NS_STYLE_SCROLL_BEHAVIOR_AUTO);
+  display->SetScrollBehavior(scrollBehavior);
 
   // scroll-snap-type-x: none, enum, inherit, initial
-  SetValue(*aRuleData->ValueForScrollSnapTypeX(), display->mScrollSnapTypeX,
+  uint8_t scrollSnapTypeX = display->ScrollSnapTypeX();
+  SetValue(*aRuleData->ValueForScrollSnapTypeX(), scrollSnapTypeX,
            conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mScrollSnapTypeX, NS_STYLE_SCROLL_SNAP_TYPE_NONE);
+           parentDisplay->ScrollSnapTypeX(), NS_STYLE_SCROLL_SNAP_TYPE_NONE);
+  display->SetScrollSnapTypeX(scrollSnapTypeX);
 
   // scroll-snap-type-y: none, enum, inherit, initial
-  SetValue(*aRuleData->ValueForScrollSnapTypeY(), display->mScrollSnapTypeY,
+  uint8_t scrollSnapTypeY = display->ScrollSnapTypeY();
+  SetValue(*aRuleData->ValueForScrollSnapTypeY(), scrollSnapTypeY,
            conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mScrollSnapTypeY, NS_STYLE_SCROLL_SNAP_TYPE_NONE);
+           parentDisplay->ScrollSnapTypeY(), NS_STYLE_SCROLL_SNAP_TYPE_NONE);
+  display->SetScrollSnapTypeY(scrollSnapTypeY);
 
   // scroll-snap-points-x: none, inherit, initial
   const nsCSSValue& scrollSnapPointsX = *aRuleData->ValueForScrollSnapPointsX();
   switch (scrollSnapPointsX.GetUnit()) {
     case eCSSUnit_Null:
       break;
     case eCSSUnit_Initial:
     case eCSSUnit_Unset:
@@ -6184,38 +6193,44 @@ nsRuleNode::ComputeDisplayData(void* aSt
       } while(item);
       break;
     }
     default:
       NS_NOTREACHED("unexpected unit");
   }
 
   // isolation: enum, inherit, initial
-  SetValue(*aRuleData->ValueForIsolation(), display->mIsolation,
+  uint8_t isolation = display->Isolation();
+  SetValue(*aRuleData->ValueForIsolation(), isolation,
            conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mIsolation, NS_STYLE_ISOLATION_AUTO);
+           parentDisplay->Isolation(), NS_STYLE_ISOLATION_AUTO);
+  display->SetIsolation(isolation);
 
   // -moz-top-layer: enum, inherit, initial
-  SetValue(*aRuleData->ValueForTopLayer(), display->mTopLayer,
+  uint8_t topLayer = display->TopLayer();
+  SetValue(*aRuleData->ValueForTopLayer(), topLayer,
            conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mTopLayer, NS_STYLE_TOP_LAYER_NONE);
+           parentDisplay->TopLayer(), NS_STYLE_TOP_LAYER_NONE);
+  display->SetTopLayer(topLayer);
 
   // Backup original display value for calculation of a hypothetical
   // box (CSS2 10.6.4/10.6.5), in addition to getting our style data right later.
   // See ReflowInput::CalculateHypotheticalBox
-  display->mOriginalDisplay = display->mDisplay;
+  display->SetOriginalDisplay(display->Display());
 
   // appearance: enum, inherit, initial
+  uint8_t appearance = display->Appearance();
   SetValue(*aRuleData->ValueForAppearance(),
-           display->mAppearance, conditions,
+           appearance, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mAppearance,
+           parentDisplay->Appearance(),
            NS_THEME_NONE);
+  display->SetAppearance(appearance);
 
   // binding: url, none, inherit
   const nsCSSValue* bindingValue = aRuleData->ValueForBinding();
   if (eCSSUnit_URL == bindingValue->GetUnit()) {
     mozilla::css::URLValue* url = bindingValue->GetURLStructValue();
     NS_ASSERTION(url, "What's going on here?");
     display->mBinding.Set(url);
   }
@@ -6225,320 +6240,345 @@ nsRuleNode::ComputeDisplayData(void* aSt
     display->mBinding.Set(nullptr);
   }
   else if (eCSSUnit_Inherit == bindingValue->GetUnit()) {
     conditions.SetUncacheable();
     display->mBinding.Set(parentDisplay->mBinding);
   }
 
   // position: enum, inherit, initial
-  SetValue(*aRuleData->ValueForPosition(), display->mPosition, conditions,
+  uint8_t position = display->Position();
+  SetValue(*aRuleData->ValueForPosition(), position, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mPosition,
+           parentDisplay->Position(),
            NS_STYLE_POSITION_STATIC);
+  display->SetPosition(position);
+
   // If an element is put in the top layer, while it is not absolutely
   // positioned, the position value should be computed to 'absolute' per
   // the Fullscreen API spec.
-  if (display->mTopLayer != NS_STYLE_TOP_LAYER_NONE &&
+  if (display->TopLayer() != NS_STYLE_TOP_LAYER_NONE &&
       !display->IsAbsolutelyPositionedStyle()) {
-    display->mPosition = NS_STYLE_POSITION_ABSOLUTE;
+    display->SetPosition(NS_STYLE_POSITION_ABSOLUTE);
     // We cannot cache this struct because otherwise it may be used as
     // an aStartStruct for some other elements.
     conditions.SetUncacheable();
   }
 
   // clear: enum, inherit, initial
-  SetValue(*aRuleData->ValueForClear(), display->mBreakType, conditions,
+  StyleClear breakType = display->BreakType();
+  SetValue(*aRuleData->ValueForClear(), breakType, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mBreakType,
+           parentDisplay->BreakType(),
            StyleClear::None);
 
   // temp fix for bug 24000
   // Map 'auto' and 'avoid' to false, and 'always', 'left', and
   // 'right' to true.
   // "A conforming user agent may interpret the values 'left' and
   // 'right' as 'always'." - CSS2.1, section 13.3.1
   const nsCSSValue* breakBeforeValue = aRuleData->ValueForPageBreakBefore();
   if (eCSSUnit_Enumerated == breakBeforeValue->GetUnit()) {
-    display->mBreakBefore =
-      (NS_STYLE_PAGE_BREAK_AVOID != breakBeforeValue->GetIntValue() &&
-       NS_STYLE_PAGE_BREAK_AUTO  != breakBeforeValue->GetIntValue());
+    display->SetBreakBefore(
+      NS_STYLE_PAGE_BREAK_AVOID != breakBeforeValue->GetIntValue() &&
+      NS_STYLE_PAGE_BREAK_AUTO  != breakBeforeValue->GetIntValue());
   }
   else if (eCSSUnit_Initial == breakBeforeValue->GetUnit() ||
            eCSSUnit_Unset == breakBeforeValue->GetUnit()) {
-    display->mBreakBefore = false;
+    display->SetBreakBefore(false);
   }
   else if (eCSSUnit_Inherit == breakBeforeValue->GetUnit()) {
     conditions.SetUncacheable();
-    display->mBreakBefore = parentDisplay->mBreakBefore;
+    display->SetBreakBefore(parentDisplay->BreakBefore());
   }
 
   const nsCSSValue* breakAfterValue = aRuleData->ValueForPageBreakAfter();
   if (eCSSUnit_Enumerated == breakAfterValue->GetUnit()) {
-    display->mBreakAfter =
-      (NS_STYLE_PAGE_BREAK_AVOID != breakAfterValue->GetIntValue() &&
-       NS_STYLE_PAGE_BREAK_AUTO  != breakAfterValue->GetIntValue());
+    display->SetBreakAfter(
+      NS_STYLE_PAGE_BREAK_AVOID != breakAfterValue->GetIntValue() &&
+      NS_STYLE_PAGE_BREAK_AUTO  != breakAfterValue->GetIntValue());
   }
   else if (eCSSUnit_Initial == breakAfterValue->GetUnit() ||
            eCSSUnit_Unset == breakAfterValue->GetUnit()) {
-    display->mBreakAfter = false;
+    display->SetBreakAfter(false);
   }
   else if (eCSSUnit_Inherit == breakAfterValue->GetUnit()) {
     conditions.SetUncacheable();
-    display->mBreakAfter = parentDisplay->mBreakAfter;
+    display->SetBreakAfter(parentDisplay->BreakAfter());
   }
   // end temp fix
 
   // page-break-inside: enum, inherit, initial
+  uint8_t breakInside = display->BreakInside();
   SetValue(*aRuleData->ValueForPageBreakInside(),
-           display->mBreakInside, conditions,
+           breakInside, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mBreakInside,
+           parentDisplay->BreakInside(),
            NS_STYLE_PAGE_BREAK_AUTO);
+  display->SetBreakInside(breakInside);
 
   // touch-action: none, auto, enum, inherit, initial
-  SetValue(*aRuleData->ValueForTouchAction(), display->mTouchAction,
+  uint8_t touchAction = display->TouchAction();
+  SetValue(*aRuleData->ValueForTouchAction(), touchAction,
            conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mTouchAction,
+           parentDisplay->TouchAction(),
            /* initial */ NS_STYLE_TOUCH_ACTION_AUTO,
            /* auto */ NS_STYLE_TOUCH_ACTION_AUTO,
            /* none */ NS_STYLE_TOUCH_ACTION_NONE, Unused, Unused);
+  display->SetTouchAction(touchAction);
 
   // float: enum, inherit, initial
+  StyleFloat float_ = display->Float();
   SetValue(*aRuleData->ValueForFloat(),
-           display->mFloat, conditions,
+           float_, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mFloat,
+           parentDisplay->Float(),
            StyleFloat::None);
+  display->SetFloat(float_);
   // Save mFloat in mOriginalFloat in case we need it later
-  display->mOriginalFloat = display->mFloat;
+  display->SetOriginalFloat(float_);
 
   // overflow-x: enum, inherit, initial
+  uint8_t overflowX = display->OverflowX();
   SetValue(*aRuleData->ValueForOverflowX(),
-           display->mOverflowX, conditions,
+           overflowX, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mOverflowX,
+           parentDisplay->OverflowX(),
            NS_STYLE_OVERFLOW_VISIBLE);
+  display->SetOverflowX(overflowX);
 
   // overflow-y: enum, inherit, initial
+  uint8_t overflowY = display->OverflowY();
   SetValue(*aRuleData->ValueForOverflowY(),
-           display->mOverflowY, conditions,
+           overflowY, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mOverflowY,
+           parentDisplay->OverflowY(),
            NS_STYLE_OVERFLOW_VISIBLE);
+  display->SetOverflowY(overflowY);
 
   // CSS3 overflow-x and overflow-y require some fixup as well in some
   // cases.  NS_STYLE_OVERFLOW_VISIBLE and NS_STYLE_OVERFLOW_CLIP are
   // meaningful only when used in both dimensions.
-  if (display->mOverflowX != display->mOverflowY &&
-      (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE ||
-       display->mOverflowX == NS_STYLE_OVERFLOW_CLIP ||
-       display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE ||
-       display->mOverflowY == NS_STYLE_OVERFLOW_CLIP)) {
+  if (overflowX != overflowY &&
+      (overflowX == NS_STYLE_OVERFLOW_VISIBLE ||
+       overflowX == NS_STYLE_OVERFLOW_CLIP ||
+       overflowY == NS_STYLE_OVERFLOW_VISIBLE ||
+       overflowY == NS_STYLE_OVERFLOW_CLIP)) {
     // We can't store in the rule tree since a more specific rule might
     // change these conditions.
     conditions.SetUncacheable();
 
     // NS_STYLE_OVERFLOW_CLIP is a deprecated value, so if it's specified
     // in only one dimension, convert it to NS_STYLE_OVERFLOW_HIDDEN.
-    if (display->mOverflowX == NS_STYLE_OVERFLOW_CLIP)
-      display->mOverflowX = NS_STYLE_OVERFLOW_HIDDEN;
-    if (display->mOverflowY == NS_STYLE_OVERFLOW_CLIP)
-      display->mOverflowY = NS_STYLE_OVERFLOW_HIDDEN;
+    if (overflowX == NS_STYLE_OVERFLOW_CLIP)
+      display->SetOverflowX(NS_STYLE_OVERFLOW_HIDDEN);
+    if (overflowY == NS_STYLE_OVERFLOW_CLIP)
+      display->SetOverflowY(NS_STYLE_OVERFLOW_HIDDEN);
 
     // If 'visible' is specified but doesn't match the other dimension, it
     // turns into 'auto'.
-    if (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE)
-      display->mOverflowX = NS_STYLE_OVERFLOW_AUTO;
-    if (display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE)
-      display->mOverflowY = NS_STYLE_OVERFLOW_AUTO;
+    if (overflowX == NS_STYLE_OVERFLOW_VISIBLE)
+      display->SetOverflowX(NS_STYLE_OVERFLOW_AUTO);
+    if (overflowY == NS_STYLE_OVERFLOW_VISIBLE)
+      display->SetOverflowY(NS_STYLE_OVERFLOW_AUTO);
+
+    overflowX = display->OverflowX();
+    overflowY = display->OverflowY();
   }
 
   // When 'contain: paint', update overflow from 'visible' to 'clip'.
   if (display->IsContainPaint()) {
     // XXX This actually sets overflow-[x|y] to -moz-hidden-unscrollable.
-    if (display->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE) {
+    if (overflowX == NS_STYLE_OVERFLOW_VISIBLE) {
       // This uncacheability (and the one below) could be fixed by adding
       // mOriginalOverflowX and mOriginalOverflowY fields, if necessary.
-      display->mOverflowX = NS_STYLE_OVERFLOW_CLIP;
+      display->SetOverflowX(NS_STYLE_OVERFLOW_CLIP);
+      conditions.SetUncacheable();
+    }
+    if (overflowY == NS_STYLE_OVERFLOW_VISIBLE) {
+      display->SetOverflowY(NS_STYLE_OVERFLOW_CLIP);
       conditions.SetUncacheable();
     }
-    if (display->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) {
-      display->mOverflowY = NS_STYLE_OVERFLOW_CLIP;
-      conditions.SetUncacheable();
-    }
-  }
-
-  SetValue(*aRuleData->ValueForOverflowClipBox(), display->mOverflowClipBox,
+  }
+
+  uint8_t overflowClipBox = display->OverflowClipBox();
+  SetValue(*aRuleData->ValueForOverflowClipBox(), overflowClipBox,
            conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mOverflowClipBox,
+           parentDisplay->OverflowClipBox(),
            NS_STYLE_OVERFLOW_CLIP_BOX_PADDING_BOX);
-
-  SetValue(*aRuleData->ValueForResize(), display->mResize, conditions,
+  display->SetOverflowClipBox(overflowClipBox);
+
+  uint8_t resize = display->Resize();
+  SetValue(*aRuleData->ValueForResize(), resize, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mResize,
+           parentDisplay->Resize(),
            NS_STYLE_RESIZE_NONE);
-
-  if (display->mDisplay != StyleDisplay::None) {
+  display->SetResize(resize);
+
+  if (display->Display() != StyleDisplay::None) {
     // CSS2 9.7 specifies display type corrections dealing with 'float'
     // and 'position'.  Since generated content can't be floated or
     // positioned, we can deal with it here.
 
     nsIAtom* pseudo = aContext->GetPseudo();
-    if (pseudo && display->mDisplay == StyleDisplay::Contents) {
+    if (pseudo && display->Display() == StyleDisplay::Contents) {
       // We don't want to create frames for anonymous content using a parent
       // frame that is for content above the root of the anon tree.
       // (XXX what we really should check here is not GetPseudo() but if there's
       //  a 'content' property value that implies anon content but we can't
       //  check that here since that's a different struct(?))
       // We might get display:contents to work for CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS
       // pseudos (:first-letter etc) in the future, but those have a lot of
       // special handling in frame construction so they are also unsupported
       // for now.
-      display->mOriginalDisplay = display->mDisplay = StyleDisplay::Inline;
+      display->SetOriginalDisplay(StyleDisplay::Inline);
+      display->SetDisplay(StyleDisplay::Inline);
       conditions.SetUncacheable();
     }
 
     // Inherit a <fieldset> grid/flex display type into its anon content frame.
     if (pseudo == nsCSSAnonBoxes::fieldsetContent) {
-      MOZ_ASSERT(display->mDisplay == StyleDisplay::Block,
+      MOZ_ASSERT(display->Display() == StyleDisplay::Block,
                  "forms.css should have set 'display:block'");
-      switch (parentDisplay->mDisplay) {
+      switch (parentDisplay->Display()) {
         case StyleDisplay::Grid:
         case StyleDisplay::InlineGrid:
-          display->mDisplay = StyleDisplay::Grid;
+          display->SetDisplay(StyleDisplay::Grid);
           conditions.SetUncacheable();
           break;
         case StyleDisplay::Flex:
         case StyleDisplay::InlineFlex:
-          display->mDisplay = StyleDisplay::Flex;
+          display->SetDisplay(StyleDisplay::Flex);
           conditions.SetUncacheable();
           break;
         default:
           break; // Do nothing
       }
     }
 
     if (nsCSSPseudoElements::firstLetter == pseudo) {
       // a non-floating first-letter must be inline
       // XXX this fix can go away once bug 103189 is fixed correctly
       // Note that we reset mOriginalDisplay to enforce the invariant that it equals mDisplay if we're not positioned or floating.
-      display->mOriginalDisplay = display->mDisplay = StyleDisplay::Inline;
+      display->SetOriginalDisplay(StyleDisplay::Inline);
+      display->SetDisplay(StyleDisplay::Inline);
 
       // We can't cache the data in the rule tree since if a more specific
       // rule has 'float: left' we'll end up with the wrong 'display'
       // property.
       conditions.SetUncacheable();
     }
 
     if (display->IsAbsolutelyPositionedStyle()) {
       // 1) if position is 'absolute' or 'fixed' then display must be
       // block-level and float must be 'none'
-      EnsureBlockDisplay(display->mDisplay);
-      display->mFloat = StyleFloat::None;
+      display->SetDisplay(EnsureBlockDisplay(display->Display()));
+      display->SetFloat(StyleFloat::None);
 
       // Note that it's OK to cache this struct in the ruletree
       // because it's fine as-is for any style context that points to
       // it directly, and any use of it as aStartStruct (e.g. if a
       // more specific rule sets "position: static") will use
       // mOriginalDisplay and mOriginalFloat, which we have carefully
       // not changed.
-    } else if (display->mFloat != StyleFloat::None) {
+    } else if (display->Float() != StyleFloat::None) {
       // 2) if float is not none, and display is not none, then we must
       // set a block-level 'display' type per CSS2.1 section 9.7.
-      EnsureBlockDisplay(display->mDisplay);
+      display->SetDisplay(EnsureBlockDisplay(display->Display()));
 
       // Note that it's OK to cache this struct in the ruletree
       // because it's fine as-is for any style context that points to
       // it directly, and any use of it as aStartStruct (e.g. if a
       // more specific rule sets "float: none") will use
       // mOriginalDisplay, which we have carefully not changed.
     }
 
     if (display->IsContainPaint()) {
       // An element with contain:paint or contain:layout needs to "be a
       // formatting context". For the purposes of the "display" property, that
       // just means we need to promote "display:inline" to "inline-block".
       // XXX We may also need to promote ruby display vals; see bug 1179349.
 
       // It's okay to cache this change in the rule tree for the same
       // reasons as floats in the previous condition.
-      if (display->mDisplay == StyleDisplay::Inline) {
-        display->mDisplay = StyleDisplay::InlineBlock;
+      if (display->Display() == StyleDisplay::Inline) {
+        display->SetDisplay(StyleDisplay::InlineBlock);
       }
     }
   }
 
   SetTransformValue(*aRuleData->ValueForTransform(),
                     display->mSpecifiedTransform, conditions,
                     parentDisplay->mSpecifiedTransform);
 
   /* Convert the nsCSSValueList into a will-change bitfield for fast lookup */
   const nsCSSValue* willChangeValue = aRuleData->ValueForWillChange();
+  uint8_t willChangeBitField = display->WillChangeBitField();
   switch (willChangeValue->GetUnit()) {
   case eCSSUnit_Null:
     break;
 
   case eCSSUnit_List:
   case eCSSUnit_ListDep: {
     display->mWillChange.Clear();
-    display->mWillChangeBitField = 0;
+    willChangeBitField = 0;
     for (const nsCSSValueList* item = willChangeValue->GetListValue();
          item; item = item->mNext)
     {
       nsIAtom* atom = item->mValue.GetAtomValue();
       display->mWillChange.AppendElement(atom);
       if (atom == nsGkAtoms::transform) {
-        display->mWillChangeBitField |= NS_STYLE_WILL_CHANGE_TRANSFORM;
+        willChangeBitField |= NS_STYLE_WILL_CHANGE_TRANSFORM;
       } else if (atom == nsGkAtoms::opacity) {
-        display->mWillChangeBitField |= NS_STYLE_WILL_CHANGE_OPACITY;
+        willChangeBitField |= NS_STYLE_WILL_CHANGE_OPACITY;
       } else if (atom == nsGkAtoms::scrollPosition) {
-        display->mWillChangeBitField |= NS_STYLE_WILL_CHANGE_SCROLL;
+        willChangeBitField |= NS_STYLE_WILL_CHANGE_SCROLL;
       }
 
       nsDependentAtomString buffer(atom);
       nsCSSPropertyID prop =
         nsCSSProps::LookupProperty(buffer, CSSEnabledState::eForAllContent);
       if (prop != eCSSProperty_UNKNOWN &&
           prop != eCSSPropertyExtra_variable) {
         // If the property given is a shorthand, it indicates the expectation
         // for all the longhands the shorthand expands to.
         if (nsCSSProps::IsShorthand(prop)) {
           for (const nsCSSPropertyID* shorthands =
                   nsCSSProps::SubpropertyEntryFor(prop);
                 *shorthands != eCSSProperty_UNKNOWN; ++shorthands) {
-            display->mWillChangeBitField |= GetWillChangeBitFieldFromPropFlags(*shorthands);
+            willChangeBitField |= GetWillChangeBitFieldFromPropFlags(*shorthands);
           }
         } else {
-          display->mWillChangeBitField |= GetWillChangeBitFieldFromPropFlags(prop);
+          willChangeBitField |= GetWillChangeBitFieldFromPropFlags(prop);
         }
       }
     }
     break;
   }
 
   case eCSSUnit_Inherit:
     display->mWillChange.Clear();
     display->mWillChange.AppendElements(parentDisplay->mWillChange);
-    display->mWillChangeBitField = parentDisplay->mWillChangeBitField;
+    willChangeBitField = parentDisplay->WillChangeBitField();
     conditions.SetUncacheable();
     break;
 
   case eCSSUnit_Initial:
   case eCSSUnit_Unset:
   case eCSSUnit_Auto:
     display->mWillChange.Clear();
-    display->mWillChangeBitField = 0;
+    willChangeBitField = 0;
     break;
 
   default:
     MOZ_ASSERT(false, "unrecognized will-change unit");
   }
+  display->SetWillChangeBitField(willChangeBitField);
 
   // vertical-align: enum, length, percent, calc, inherit
   const nsCSSValue* verticalAlignValue = aRuleData->ValueForVerticalAlign();
   if (!SetCoord(*verticalAlignValue, display->mVerticalAlign,
                 parentDisplay->mVerticalAlign,
                 SETCOORD_LPH | SETCOORD_ENUMERATED | SETCOORD_STORE_CALC,
                 aContext, mPresContext, conditions)) {
     if (eCSSUnit_Initial == verticalAlignValue->GetUnit() ||
@@ -6613,42 +6653,50 @@ nsRuleNode::ComputeDisplayData(void* aSt
   }
 
   SetCoord(*aRuleData->ValueForPerspective(),
            display->mChildPerspective, parentDisplay->mChildPerspective,
            SETCOORD_LAH | SETCOORD_INITIAL_NONE | SETCOORD_NONE |
              SETCOORD_UNSET_INITIAL,
            aContext, mPresContext, conditions);
 
+  uint8_t backfaceVisibility = display->BackfaceVisibility();
   SetValue(*aRuleData->ValueForBackfaceVisibility(),
-           display->mBackfaceVisibility, conditions,
+           backfaceVisibility, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mBackfaceVisibility,
+           parentDisplay->BackfaceVisibility(),
            NS_STYLE_BACKFACE_VISIBILITY_VISIBLE);
+  display->SetBackfaceVisibility(backfaceVisibility);
 
   // transform-style: enum, inherit, initial
+  uint8_t transformStyle = display->TransformStyle();
   SetValue(*aRuleData->ValueForTransformStyle(),
-           display->mTransformStyle, conditions,
+           transformStyle, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mTransformStyle,
+           parentDisplay->TransformStyle(),
            NS_STYLE_TRANSFORM_STYLE_FLAT);
+  display->SetTransformStyle(transformStyle);
 
   // transform-box: enum, inherit, initial
+  StyleGeometryBox transformBox = display->TransformBox();
   SetValue(*aRuleData->ValueForTransformBox(),
-           display->mTransformBox, conditions,
+           transformBox, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mTransformBox,
+           parentDisplay->TransformBox(),
            StyleGeometryBox::BorderBox);
+  display->SetTransformBox(transformBox);
 
   // orient: enum, inherit, initial
+  StyleOrient orient = display->Orient();
   SetValue(*aRuleData->ValueForOrient(),
-           display->mOrient, conditions,
+           orient, conditions,
            SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
-           parentDisplay->mOrient,
+           parentDisplay->Orient(),
            StyleOrient::Inline);
+  display->SetOrient(orient);
 
   // shape-outside: none | [ <basic-shape> || <shape-box> ] | <image>
   const nsCSSValue* shapeOutsideValue = aRuleData->ValueForShapeOutside();
   switch (shapeOutsideValue->GetUnit()) {
     case eCSSUnit_Null:
       break;
     case eCSSUnit_None:
     case eCSSUnit_Initial:
--- a/layout/style/nsRuleNode.h
+++ b/layout/style/nsRuleNode.h
@@ -798,19 +798,19 @@ private:
   nsRuleNode(nsPresContext* aPresContext, nsRuleNode* aParent,
              nsIStyleRule* aRule, mozilla::SheetType aLevel, bool aIsImportant);
   ~nsRuleNode();
 
 public:
   // This is infallible; it will never return nullptr.
   static already_AddRefed<nsRuleNode> CreateRootNode(nsPresContext* aPresContext);
 
-  static void EnsureBlockDisplay(mozilla::StyleDisplay& display,
-                                 bool aConvertListItem = false);
-  static void EnsureInlineDisplay(mozilla::StyleDisplay& display);
+  static mozilla::StyleDisplay EnsureBlockDisplay(mozilla::StyleDisplay aDisplay,
+                                                  bool aConvertListItem = false);
+  static mozilla::StyleDisplay EnsureInlineDisplay(mozilla::StyleDisplay display);
 
   static already_AddRefed<nsFontMetrics> GetMetricsFor(nsPresContext* aPresContext,
                                                        bool aIsVertical,
                                                        const nsStyleFont* aStyleFont,
                                                        nscoord aFontSize,
                                                        bool aUseUserFontSet);
 
   static already_AddRefed<nsFontMetrics> GetMetricsFor(nsPresContext* aPresContext,
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -2080,17 +2080,17 @@ nsStyleSet::ProbePseudoElementStyle(Elem
   // 'content' property is equivalent to not having the pseudo-element
   // at all.
   if (result &&
       (pseudoTag == nsCSSPseudoElements::before ||
        pseudoTag == nsCSSPseudoElements::after)) {
     const nsStyleDisplay *display = result->StyleDisplay();
     const nsStyleContent *content = result->StyleContent();
     // XXXldb What is contentCount for |content: ""|?
-    if (display->mDisplay == StyleDisplay::None ||
+    if (display->Display() == StyleDisplay::None ||
         content->ContentCount() == 0) {
       result = nullptr;
     }
   }
 
   return result.forget();
 }
 
--- a/layout/style/nsStyleTransformMatrix.cpp
+++ b/layout/style/nsStyleTransformMatrix.cpp
@@ -54,35 +54,35 @@ TransformReferenceBox::EnsureDimensionsA
   if (mFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT) {
     if (!nsLayoutUtils::SVGTransformBoxEnabled()) {
       mX = -mFrame->GetPosition().x;
       mY = -mFrame->GetPosition().y;
       Size contextSize = nsSVGUtils::GetContextSize(mFrame);
       mWidth = nsPresContext::CSSPixelsToAppUnits(contextSize.width);
       mHeight = nsPresContext::CSSPixelsToAppUnits(contextSize.height);
     } else
-    if (mFrame->StyleDisplay()->mTransformBox == StyleGeometryBox::FillBox) {
+    if (mFrame->StyleDisplay()->TransformBox() == StyleGeometryBox::FillBox) {
       // Percentages in transforms resolve against the SVG bbox, and the
       // transform is relative to the top-left of the SVG bbox.
       nsRect bboxInAppUnits =
         nsLayoutUtils::ComputeGeometryBox(const_cast<nsIFrame*>(mFrame),
                                           StyleGeometryBox::FillBox);
       // The mRect of an SVG nsIFrame is its user space bounds *including*
       // stroke and markers, whereas bboxInAppUnits is its user space bounds
       // including fill only.  We need to note the offset of the reference box
       // from the frame's mRect in mX/mY.
       mX = bboxInAppUnits.x - mFrame->GetPosition().x;
       mY = bboxInAppUnits.y - mFrame->GetPosition().y;
       mWidth = bboxInAppUnits.width;
       mHeight = bboxInAppUnits.height;
     } else {
       // The value 'border-box' is treated as 'view-box' for SVG content.
-      MOZ_ASSERT(mFrame->StyleDisplay()->mTransformBox ==
+      MOZ_ASSERT(mFrame->StyleDisplay()->TransformBox() ==
                    StyleGeometryBox::ViewBox ||
-                 mFrame->StyleDisplay()->mTransformBox ==
+                 mFrame->StyleDisplay()->TransformBox() ==
                    StyleGeometryBox::BorderBox,
                  "Unexpected value for 'transform-box'");
       // Percentages in transforms resolve against the width/height of the
       // nearest viewport (or its viewBox if one is applied), and the
       // transform is relative to {0,0} in current user space.
       mX = -mFrame->GetPosition().x;
       mY = -mFrame->GetPosition().y;
       Size contextSize = nsSVGUtils::GetContextSize(mFrame);