bug 735577 - pt 3.2 - update the rest of layout code to use the new accessors on nsHTMLReflowState. r=smontagu
authorJonathan Kew <jkew@mozilla.com>
Fri, 27 Dec 2013 17:59:21 +0000
changeset 177824 c73264fcffc344dbede024b64667dc31a9ac9043
parent 177823 bcba7f58a8e759e8ce85af0d5a707b81783fc362
child 177825 10592ba2f6950f6473d6d443c6f340fbc4d6621e
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmontagu
bugs735577
milestone29.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 735577 - pt 3.2 - update the rest of layout code to use the new accessors on nsHTMLReflowState. r=smontagu
layout/base/RestyleManager.cpp
layout/base/nsPresShell.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsFieldSetFrame.cpp
layout/forms/nsHTMLButtonControlFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsMeterFrame.cpp
layout/forms/nsNumberControlFrame.cpp
layout/forms/nsProgressFrame.cpp
layout/forms/nsRangeFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/generic/nsAbsoluteContainingBlock.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockReflowContext.cpp
layout/generic/nsBlockReflowState.cpp
layout/generic/nsBlockReflowState.h
layout/generic/nsBulletFrame.cpp
layout/generic/nsCanvasFrame.cpp
layout/generic/nsColumnSetFrame.cpp
layout/generic/nsContainerFrame.cpp
layout/generic/nsFirstLetterFrame.cpp
layout/generic/nsFlexContainerFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsHTMLCanvasFrame.cpp
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsHTMLReflowState.h
layout/generic/nsImageFrame.cpp
layout/generic/nsInlineFrame.cpp
layout/generic/nsLeafFrame.cpp
layout/generic/nsLineLayout.cpp
layout/generic/nsObjectFrame.cpp
layout/generic/nsPageFrame.cpp
layout/generic/nsSimplePageSequence.cpp
layout/generic/nsSplittableFrame.cpp
layout/generic/nsSubDocumentFrame.cpp
layout/generic/nsTextFrame.cpp
layout/generic/nsVideoFrame.cpp
layout/generic/nsViewportFrame.cpp
layout/svg/SVGTextFrame.cpp
layout/svg/nsSVGForeignObjectFrame.cpp
layout/svg/nsSVGOuterSVGFrame.cpp
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableFrame.cpp
layout/tables/nsTableOuterFrame.cpp
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowGroupFrame.cpp
layout/tables/nsTableRowGroupFrame.h
layout/xul/nsBoxFrame.cpp
layout/xul/nsLeafBoxFrame.cpp
layout/xul/nsScrollbarFrame.cpp
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -390,70 +390,70 @@ RestyleManager::RecomputePosition(nsIFra
   parentFrame->RemoveStateBits(~nsFrameState(0));
   parentFrame->AddStateBits(savedState);
 
   NS_WARN_IF_FALSE(parentSize.width != NS_INTRINSICSIZE &&
                    parentSize.height != NS_INTRINSICSIZE,
                    "parentSize should be valid");
   parentReflowState.SetComputedWidth(std::max(parentSize.width, 0));
   parentReflowState.SetComputedHeight(std::max(parentSize.height, 0));
-  parentReflowState.mComputedMargin.SizeTo(0, 0, 0, 0);
+  parentReflowState.ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
 
-  parentReflowState.mComputedPadding = parentFrame->GetUsedPadding();
-  parentReflowState.mComputedBorderPadding =
+  parentReflowState.ComputedPhysicalPadding() = parentFrame->GetUsedPadding();
+  parentReflowState.ComputedPhysicalBorderPadding() =
     parentFrame->GetUsedBorderAndPadding();
   nsSize availSize(parentSize.width, NS_INTRINSICSIZE);
 
   ViewportFrame* viewport = do_QueryFrame(parentFrame);
   nsSize cbSize = viewport ?
     viewport->AdjustReflowStateAsContainingBlock(&parentReflowState).Size()
     : aFrame->GetContainingBlock()->GetSize();
   const nsMargin& parentBorder =
     parentReflowState.mStyleBorder->GetComputedBorder();
   cbSize -= nsSize(parentBorder.LeftRight(), parentBorder.TopBottom());
   nsHTMLReflowState reflowState(aFrame->PresContext(), parentReflowState,
                                 aFrame, availSize, cbSize.width,
                                 cbSize.height);
   nsSize computedSize(reflowState.ComputedWidth(), reflowState.ComputedHeight());
-  computedSize.width += reflowState.mComputedBorderPadding.LeftRight();
+  computedSize.width += reflowState.ComputedPhysicalBorderPadding().LeftRight();
   if (computedSize.height != NS_INTRINSICSIZE) {
-    computedSize.height += reflowState.mComputedBorderPadding.TopBottom();
+    computedSize.height += reflowState.ComputedPhysicalBorderPadding().TopBottom();
   }
   nsSize size = aFrame->GetSize();
   // The RecomputePosition hint is not used if any offset changed between auto
   // and non-auto. If computedSize.height == NS_INTRINSICSIZE then the new
   // element height will be its intrinsic height, and since 'top' and 'bottom''s
   // auto-ness hasn't changed, the old height must also be its intrinsic
   // height, which we can assume hasn't changed (or reflow would have
   // been triggered).
   if (computedSize.width == size.width &&
       (computedSize.height == NS_INTRINSICSIZE || computedSize.height == size.height)) {
     // If we're solving for 'left' or 'top', then compute it here, in order to
     // match the reflow code path.
-    if (NS_AUTOOFFSET == reflowState.mComputedOffsets.left) {
-      reflowState.mComputedOffsets.left = cbSize.width -
-                                          reflowState.mComputedOffsets.right -
-                                          reflowState.mComputedMargin.right -
+    if (NS_AUTOOFFSET == reflowState.ComputedPhysicalOffsets().left) {
+      reflowState.ComputedPhysicalOffsets().left = cbSize.width -
+                                          reflowState.ComputedPhysicalOffsets().right -
+                                          reflowState.ComputedPhysicalMargin().right -
                                           size.width -
-                                          reflowState.mComputedMargin.left;
+                                          reflowState.ComputedPhysicalMargin().left;
     }
 
-    if (NS_AUTOOFFSET == reflowState.mComputedOffsets.top) {
-      reflowState.mComputedOffsets.top = cbSize.height -
-                                         reflowState.mComputedOffsets.bottom -
-                                         reflowState.mComputedMargin.bottom -
+    if (NS_AUTOOFFSET == reflowState.ComputedPhysicalOffsets().top) {
+      reflowState.ComputedPhysicalOffsets().top = cbSize.height -
+                                         reflowState.ComputedPhysicalOffsets().bottom -
+                                         reflowState.ComputedPhysicalMargin().bottom -
                                          size.height -
-                                         reflowState.mComputedMargin.top;
+                                         reflowState.ComputedPhysicalMargin().top;
     }
 
     // Move the frame
-    nsPoint pos(parentBorder.left + reflowState.mComputedOffsets.left +
-                reflowState.mComputedMargin.left,
-                parentBorder.top + reflowState.mComputedOffsets.top +
-                reflowState.mComputedMargin.top);
+    nsPoint pos(parentBorder.left + reflowState.ComputedPhysicalOffsets().left +
+                reflowState.ComputedPhysicalMargin().left,
+                parentBorder.top + reflowState.ComputedPhysicalOffsets().top +
+                reflowState.ComputedPhysicalMargin().top);
     aFrame->SetPosition(pos);
 
     return true;
   }
 
   // Fall back to a reflow
   StyleChangeReflow(aFrame, nsChangeHint_NeedReflow);
   return false;
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -8038,27 +8038,27 @@ PresShell::DoReflow(nsIFrame* target, bo
     if (hasUnconstrainedHeight || mLastRootReflowHadUnconstrainedHeight) {
       reflowState.mFlags.mVResize = true;
     }
 
     mLastRootReflowHadUnconstrainedHeight = hasUnconstrainedHeight;
   }
 
   // fix the computed height
-  NS_ASSERTION(reflowState.mComputedMargin == nsMargin(0, 0, 0, 0),
+  NS_ASSERTION(reflowState.ComputedPhysicalMargin() == nsMargin(0, 0, 0, 0),
                "reflow state should not set margin for reflow roots");
   if (size.height != NS_UNCONSTRAINEDSIZE) {
     nscoord computedHeight =
-      size.height - reflowState.mComputedBorderPadding.TopBottom();
+      size.height - reflowState.ComputedPhysicalBorderPadding().TopBottom();
     computedHeight = std::max(computedHeight, 0);
     reflowState.SetComputedHeight(computedHeight);
   }
   NS_ASSERTION(reflowState.ComputedWidth() ==
                  size.width -
-                   reflowState.mComputedBorderPadding.LeftRight(),
+                   reflowState.ComputedPhysicalBorderPadding().LeftRight(),
                "reflow state computed incorrect width");
 
   mPresContext->ReflowStarted(aInterruptible);
   mIsReflowing = true;
 
   nsReflowStatus status;
   nsHTMLReflowMetrics desiredSize;
   target->Reflow(mPresContext, desiredSize, reflowState, status);
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -405,26 +405,26 @@ nsComboboxControlFrame::ReflowDropdown(n
   if (!aReflowState.ShouldReflowAllKids() &&
       !NS_SUBTREE_DIRTY(mDropdownFrame)) {
     return NS_OK;
   }
 
   // XXXbz this will, for small-height dropdowns, have extra space on the right
   // edge for the scrollbar we don't show... but that's the best we can do here
   // for now.
-  nsSize availSize(aReflowState.availableWidth, NS_UNCONSTRAINEDSIZE);
+  nsSize availSize(aReflowState.AvailableWidth(), NS_UNCONSTRAINEDSIZE);
   nsHTMLReflowState kidReflowState(aPresContext, aReflowState, mDropdownFrame,
                                    availSize);
 
   // If the dropdown's intrinsic width is narrower than our specified width,
   // then expand it out.  We want our border-box width to end up the same as
   // the dropdown's so account for both sets of mComputedBorderPadding.
   nscoord forcedWidth = aReflowState.ComputedWidth() +
-    aReflowState.mComputedBorderPadding.LeftRight() -
-    kidReflowState.mComputedBorderPadding.LeftRight();
+    aReflowState.ComputedPhysicalBorderPadding().LeftRight() -
+    kidReflowState.ComputedPhysicalBorderPadding().LeftRight();
   kidReflowState.SetComputedWidth(std::max(kidReflowState.ComputedWidth(),
                                          forcedWidth));
 
   // ensure we start off hidden
   if (GetStateBits() & NS_FRAME_FIRST_REFLOW) {
     nsView* view = mDropdownFrame->GetView();
     nsViewManager* viewManager = view->GetViewManager();
     viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
@@ -1250,17 +1250,17 @@ nsComboboxDisplayFrame::Reflow(nsPresCon
   nsHTMLReflowState state(aReflowState);
   if (state.ComputedHeight() == NS_INTRINSICSIZE) {
     // Note that the only way we can have a computed height here is if the
     // combobox had a specified height.  If it didn't, size based on what our
     // rows look like, for lack of anything better.
     state.SetComputedHeight(mComboBox->mListControlFrame->GetHeightOfARow());
   }
   nscoord computedWidth = mComboBox->mDisplayWidth -
-    state.mComputedBorderPadding.LeftRight();
+    state.ComputedPhysicalBorderPadding().LeftRight();
   if (computedWidth < 0) {
     computedWidth = 0;
   }
   state.SetComputedWidth(computedWidth);
 
   return nsBlockFrame::Reflow(aPresContext, aDesiredSize, state, aStatus);
 }
 
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -449,33 +449,33 @@ nsFieldSetFrame::Reflow(nsPresContext*  
     reflowInner = inner && NS_SUBTREE_DIRTY(inner);
     reflowLegend = legend && NS_SUBTREE_DIRTY(legend);
   }
 
   // We don't allow fieldsets to break vertically. If we did, we'd
   // need logic here to push and pull overflow frames.
   // Since we're not applying our padding in this frame, we need to add it here
   // to compute the available width for our children.
-  nsSize availSize(aReflowState.ComputedWidth() + aReflowState.mComputedPadding.LeftRight(),
+  nsSize availSize(aReflowState.ComputedWidth() + aReflowState.ComputedPhysicalPadding().LeftRight(),
                    NS_UNCONSTRAINEDSIZE);
   NS_ASSERTION(!inner ||
       nsLayoutUtils::IntrinsicForContainer(aReflowState.rendContext,
                                            inner,
                                            nsLayoutUtils::MIN_WIDTH) <=
                availSize.width,
                "Bogus availSize.width; should be bigger");
   NS_ASSERTION(!legend ||
       nsLayoutUtils::IntrinsicForContainer(aReflowState.rendContext,
                                            legend,
                                            nsLayoutUtils::MIN_WIDTH) <=
                availSize.width,
                "Bogus availSize.width; should be bigger");
 
   // get our border and padding
-  nsMargin border = aReflowState.mComputedBorderPadding - aReflowState.mComputedPadding;
+  nsMargin border = aReflowState.ComputedPhysicalBorderPadding() - aReflowState.ComputedPhysicalPadding();
 
   // Figure out how big the legend is if there is one. 
   // get the legend's margin
   nsMargin legendMargin(0,0,0,0);
   // reflow the legend only if needed
   Maybe<nsHTMLReflowState> legendReflowState;
   if (legend) {
     legendReflowState.construct(aPresContext, aReflowState, legend, availSize);
@@ -522,38 +522,38 @@ nsFieldSetFrame::Reflow(nsPresContext*  
   }
 
   // reflow the content frame only if needed
   if (reflowInner) {
     nsHTMLReflowState kidReflowState(aPresContext, aReflowState, inner,
                                      availSize, -1, -1, nsHTMLReflowState::CALLER_WILL_INIT);
     // Override computed padding, in case it's percentage padding
     kidReflowState.Init(aPresContext, -1, -1, nullptr,
-                        &aReflowState.mComputedPadding);
+                        &aReflowState.ComputedPhysicalPadding());
     // Our child is "height:100%" but we actually want its height to be reduced
     // by the amount of content-height the legend is eating up, unless our
     // height is unconstrained (in which case the child's will be too).
     if (aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE) {
       kidReflowState.SetComputedHeight(
          std::max(0, aReflowState.ComputedHeight() - mLegendSpace));
     }
 
-    if (aReflowState.mComputedMinHeight > 0) {
-      kidReflowState.mComputedMinHeight =
-        std::max(0, aReflowState.mComputedMinHeight - mLegendSpace);
+    if (aReflowState.ComputedMinHeight() > 0) {
+      kidReflowState.ComputedMinHeight() =
+        std::max(0, aReflowState.ComputedMinHeight() - mLegendSpace);
     }
 
-    if (aReflowState.mComputedMaxHeight != NS_UNCONSTRAINEDSIZE) {
-      kidReflowState.mComputedMaxHeight =
-        std::max(0, aReflowState.mComputedMaxHeight - mLegendSpace);
+    if (aReflowState.ComputedMaxHeight() != NS_UNCONSTRAINEDSIZE) {
+      kidReflowState.ComputedMaxHeight() =
+        std::max(0, aReflowState.ComputedMaxHeight() - mLegendSpace);
     }
 
     nsHTMLReflowMetrics kidDesiredSize(aDesiredSize.mFlags);
     // Reflow the frame
-    NS_ASSERTION(kidReflowState.mComputedMargin == nsMargin(0,0,0,0),
+    NS_ASSERTION(kidReflowState.ComputedPhysicalMargin() == nsMargin(0,0,0,0),
                  "Margins on anonymous fieldset child not supported!");
     nsPoint pt(border.left, border.top + mLegendSpace);
     ReflowChild(inner, aPresContext, kidDesiredSize, kidReflowState,
                 pt.x, pt.y, 0, aStatus);
 
     FinishReflowChild(inner, aPresContext, &kidReflowState, 
                       kidDesiredSize, pt.x, pt.y, 0);
     NS_FRAME_TRACE_REFLOW_OUT("FieldSet::Reflow", aStatus);
@@ -570,17 +570,17 @@ nsFieldSetFrame::Reflow(nsPresContext*  
   if (availSize.width > contentRect.width) {
     contentRect.width = availSize.width;
   }
 
   if (legend) {
     // the legend is postioned horizontally within the inner's content rect
     // (so that padding on the fieldset affects the legend position).
     nsRect innerContentRect = contentRect;
-    innerContentRect.Deflate(aReflowState.mComputedPadding);
+    innerContentRect.Deflate(aReflowState.ComputedPhysicalPadding());
     // if the inner content rect is larger than the legend, we can align the legend
     if (innerContentRect.width > mLegendRect.width) {
       int32_t align = static_cast<nsLegendFrame*>
         (legend->GetContentInsertionFrame())->GetAlign();
 
       switch (align) {
         case NS_STYLE_TEXT_ALIGN_RIGHT:
           mLegendRect.x = innerContentRect.XMost() - mLegendRect.width;
@@ -592,17 +592,17 @@ nsFieldSetFrame::Reflow(nsPresContext*  
         default:
           mLegendRect.x = innerContentRect.x;
           break;
       }
     } else {
       // otherwise make place for the legend
       mLegendRect.x = innerContentRect.x;
       innerContentRect.width = mLegendRect.width;
-      contentRect.width = mLegendRect.width + aReflowState.mComputedPadding.LeftRight();
+      contentRect.width = mLegendRect.width + aReflowState.ComputedPhysicalPadding().LeftRight();
     }
 
     // place the legend
     nsRect actualLegendRect(mLegendRect);
     actualLegendRect.Deflate(legendMargin);
     nsPoint actualLegendPos(actualLegendRect.TopLeft());
     legendReflowState.ref().ApplyRelativePositioning(&actualLegendPos);
     legend->SetPosition(actualLegendPos);
@@ -613,17 +613,17 @@ nsFieldSetFrame::Reflow(nsPresContext*  
   // Return our size and our result
   if (aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {
     aDesiredSize.height = mLegendSpace + 
                           border.TopBottom() +
                           (inner ? inner->GetRect().height : 0);
   } else {
     nscoord min = border.TopBottom() + mLegendRect.height;
     aDesiredSize.height =
-      aReflowState.ComputedHeight() + aReflowState.mComputedBorderPadding.TopBottom();
+      aReflowState.ComputedHeight() + aReflowState.ComputedPhysicalBorderPadding().TopBottom();
     if (aDesiredSize.height < min)
       aDesiredSize.height = min;
   }
   aDesiredSize.width = contentRect.width + border.LeftRight();
   aDesiredSize.SetOverflowAreasToDesiredBounds();
   if (legend)
     ConsiderChildOverflow(aDesiredSize.mOverflowAreas, legend);
   if (inner)
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -252,27 +252,27 @@ nsHTMLButtonControlFrame::ReflowButtonCo
   // from the regular border.
   availSize.width -= focusPadding.LeftRight();
   
   // See whether out availSize's width is big enough.  If it's smaller than our
   // intrinsic min width, that means that the kid wouldn't really fit; for a
   // better look in such cases we adjust the available width and our left
   // offset to allow the kid to spill left into our padding.
   nscoord xoffset = focusPadding.left +
-    aButtonReflowState.mComputedBorderPadding.left;
+    aButtonReflowState.ComputedPhysicalBorderPadding().left;
   nscoord extrawidth = GetMinWidth(aButtonReflowState.rendContext) -
     aButtonReflowState.ComputedWidth();
   if (extrawidth > 0) {
     nscoord extraleft = extrawidth / 2;
     nscoord extraright = extrawidth - extraleft;
     NS_ASSERTION(extraright >=0, "How'd that happen?");
     
     // Do not allow the extras to be bigger than the relevant padding
-    extraleft = std::min(extraleft, aButtonReflowState.mComputedPadding.left);
-    extraright = std::min(extraright, aButtonReflowState.mComputedPadding.right);
+    extraleft = std::min(extraleft, aButtonReflowState.ComputedPhysicalPadding().left);
+    extraright = std::min(extraright, aButtonReflowState.ComputedPhysicalPadding().right);
     xoffset -= extraleft;
     availSize.width += extraleft + extraright;
   }
   availSize.width = std::max(availSize.width,0);
   
   // Give child a clone of the button's reflow state, with height/width reduced
   // by focusPadding, so that descendants with height:100% don't protrude.
   nsHTMLReflowState adjustedButtonReflowState =
@@ -282,17 +282,17 @@ nsHTMLButtonControlFrame::ReflowButtonCo
                                         adjustedButtonReflowState,
                                         aFirstKid, availSize);
 
   nsReflowStatus contentsReflowStatus;
   nsHTMLReflowMetrics contentsDesiredSize;
   ReflowChild(aFirstKid, aPresContext,
               contentsDesiredSize, contentsReflowState,
               xoffset,
-              focusPadding.top + aButtonReflowState.mComputedBorderPadding.top,
+              focusPadding.top + aButtonReflowState.ComputedPhysicalBorderPadding().top,
               0, contentsReflowStatus);
   MOZ_ASSERT(NS_FRAME_IS_COMPLETE(contentsReflowStatus),
              "We gave button-contents frame unconstrained available height, "
              "so it should be complete");
 
   // Compute the button's content-box height:
   nscoord buttonContentBoxHeight = 0;
   if (aButtonReflowState.ComputedHeight() != NS_INTRINSICSIZE) {
@@ -306,50 +306,50 @@ nsHTMLButtonControlFrame::ReflowButtonCo
 
     // Make sure we obey min/max-height in the case when we're doing intrinsic
     // sizing (we get it for free when we have a non-intrinsic
     // aButtonReflowState.ComputedHeight()).  Note that we do this before
     // adjusting for borderpadding, since mComputedMaxHeight and
     // mComputedMinHeight are content heights.
     buttonContentBoxHeight =
       NS_CSS_MINMAX(buttonContentBoxHeight,
-                    aButtonReflowState.mComputedMinHeight,
-                    aButtonReflowState.mComputedMaxHeight);
+                    aButtonReflowState.ComputedMinHeight(),
+                    aButtonReflowState.ComputedMaxHeight());
   }
 
   // Center child vertically in the button
   // (technically, inside of the button's focus-padding area)
   nscoord extraSpace =
     buttonContentBoxHeight - focusPadding.TopBottom() -
     contentsDesiredSize.height;
 
   nscoord yoffset = std::max(0, extraSpace / 2);
 
   // Adjust yoffset to be in terms of the button's frame-rect, instead of
   // its focus-padding rect:
-  yoffset += focusPadding.top + aButtonReflowState.mComputedBorderPadding.top;
+  yoffset += focusPadding.top + aButtonReflowState.ComputedPhysicalBorderPadding().top;
 
   // Place the child
   FinishReflowChild(aFirstKid, aPresContext,
                     &contentsReflowState, contentsDesiredSize,
                     xoffset, yoffset, 0);
 
   // Make sure we have a useful 'ascent' value for the child
   if (contentsDesiredSize.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE) {
     contentsDesiredSize.ascent = aFirstKid->GetBaseline();
   }
 
   // OK, we're done with the child frame.
   // Use what we learned to populate the button frame's reflow metrics.
   //  * Button's height & width are content-box size + border-box contribution:
   aButtonDesiredSize.width = aButtonReflowState.ComputedWidth() +
-    aButtonReflowState.mComputedBorderPadding.LeftRight();
+    aButtonReflowState.ComputedPhysicalBorderPadding().LeftRight();
 
   aButtonDesiredSize.height = buttonContentBoxHeight +
-    aButtonReflowState.mComputedBorderPadding.TopBottom();
+    aButtonReflowState.ComputedPhysicalBorderPadding().TopBottom();
 
   //  * Button's ascent is its child's ascent, plus the child's y-offset
   // within our frame:
   aButtonDesiredSize.ascent = contentsDesiredSize.ascent + yoffset;
 
   aButtonDesiredSize.SetOverflowAreasToDesiredBounds();
 }
 
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -546,17 +546,17 @@ nsListControlFrame::ReflowAsDropdown(nsP
     nsPoint translation;
     nscoord above, below;
     combobox->GetAvailableDropdownSpace(&above, &below, &translation);
     if (above <= 0 && below <= 0) {
       state.SetComputedHeight(heightOfARow);
       mNumDisplayRows = 1;
       mDropdownCanGrow = GetNumberOfRows() > 1;
     } else {
-      nscoord bp = aReflowState.mComputedBorderPadding.TopBottom();
+      nscoord bp = aReflowState.ComputedPhysicalBorderPadding().TopBottom();
       nscoord availableHeight = std::max(above, below) - bp;
       nscoord newHeight;
       uint32_t rows;
       if (visibleHeight <= availableHeight) {
         // The dropdown fits in the available height.
         rows = GetNumberOfRows();
         mNumDisplayRows = clamped<uint32_t>(rows, 1, kMaxDropDownRows);
         if (mNumDisplayRows == rows) {
--- a/layout/forms/nsMeterFrame.cpp
+++ b/layout/forms/nsMeterFrame.cpp
@@ -109,19 +109,19 @@ NS_IMETHODIMP nsMeterFrame::Reflow(nsPre
   }
 
   nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
   NS_ASSERTION(barFrame, "The meter frame should have a child with a frame!");
 
   ReflowBarFrame(barFrame, aPresContext, aReflowState, aStatus);
 
   aDesiredSize.width = aReflowState.ComputedWidth() +
-                       aReflowState.mComputedBorderPadding.LeftRight();
+                       aReflowState.ComputedPhysicalBorderPadding().LeftRight();
   aDesiredSize.height = aReflowState.ComputedHeight() +
-                        aReflowState.mComputedBorderPadding.TopBottom();
+                        aReflowState.ComputedPhysicalBorderPadding().TopBottom();
 
   aDesiredSize.SetOverflowAreasToDesiredBounds();
   ConsiderChildOverflow(aDesiredSize.mOverflowAreas, barFrame);
   FinishAndStoreOverflow(&aDesiredSize);
 
   aStatus = NS_FRAME_COMPLETE;
 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
@@ -136,18 +136,18 @@ nsMeterFrame::ReflowBarFrame(nsIFrame*  
                              nsReflowStatus&          aStatus)
 {
   bool vertical = StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL;
   nsHTMLReflowState reflowState(aPresContext, aReflowState, aBarFrame,
                                 nsSize(aReflowState.ComputedWidth(),
                                        NS_UNCONSTRAINEDSIZE));
   nscoord size = vertical ? aReflowState.ComputedHeight()
                           : aReflowState.ComputedWidth();
-  nscoord xoffset = aReflowState.mComputedBorderPadding.left;
-  nscoord yoffset = aReflowState.mComputedBorderPadding.top;
+  nscoord xoffset = aReflowState.ComputedPhysicalBorderPadding().left;
+  nscoord yoffset = aReflowState.ComputedPhysicalBorderPadding().top;
 
   // NOTE: Introduce a new function getPosition in the content part ?
   HTMLMeterElement* meterElement = static_cast<HTMLMeterElement*>(mContent);
 
   double max = meterElement->Max();
   double min = meterElement->Min();
   double value = meterElement->Value();
 
@@ -160,29 +160,29 @@ nsMeterFrame::ReflowBarFrame(nsIFrame*  
     xoffset += aReflowState.ComputedWidth() - size;
   }
 
   // The bar position is *always* constrained.
   if (vertical) {
     // We want the bar to begin at the bottom.
     yoffset += aReflowState.ComputedHeight() - size;
 
-    size -= reflowState.mComputedMargin.TopBottom() +
-            reflowState.mComputedBorderPadding.TopBottom();
+    size -= reflowState.ComputedPhysicalMargin().TopBottom() +
+            reflowState.ComputedPhysicalBorderPadding().TopBottom();
     size = std::max(size, 0);
     reflowState.SetComputedHeight(size);
   } else {
-    size -= reflowState.mComputedMargin.LeftRight() +
-            reflowState.mComputedBorderPadding.LeftRight();
+    size -= reflowState.ComputedPhysicalMargin().LeftRight() +
+            reflowState.ComputedPhysicalBorderPadding().LeftRight();
     size = std::max(size, 0);
     reflowState.SetComputedWidth(size);
   }
 
-  xoffset += reflowState.mComputedMargin.left;
-  yoffset += reflowState.mComputedMargin.top;
+  xoffset += reflowState.ComputedPhysicalMargin().left;
+  yoffset += reflowState.ComputedPhysicalMargin().top;
 
   nsHTMLReflowMetrics barDesiredSize;
   ReflowChild(aBarFrame, aPresContext, barDesiredSize, reflowState, xoffset,
               yoffset, 0, aStatus);
   FinishReflowChild(aBarFrame, aPresContext, &reflowState, barDesiredSize,
                     xoffset, yoffset, 0);
 }
 
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -94,19 +94,19 @@ nsNumberControlFrame::Reflow(nsPresConte
   }
 
   nscoord computedHeight = aReflowState.ComputedHeight();
   if (computedHeight == NS_AUTOHEIGHT) {
     computedHeight =
       outerWrapperFrame ? outerWrapperFrame->GetSize().height : 0;
   }
   aDesiredSize.width = aReflowState.ComputedWidth() +
-                         aReflowState.mComputedBorderPadding.LeftRight();
+                         aReflowState.ComputedPhysicalBorderPadding().LeftRight();
   aDesiredSize.height = computedHeight +
-                          aReflowState.mComputedBorderPadding.TopBottom();
+                          aReflowState.ComputedPhysicalBorderPadding().TopBottom();
 
   if (outerWrapperFrame) {
     aDesiredSize.ascent = wrappersDesiredSize.ascent +
                             outerWrapperFrame->GetPosition().y;
   }
 
   aDesiredSize.SetOverflowAreasToDesiredBounds();
 
@@ -132,20 +132,20 @@ nsNumberControlFrame::
   // for our anonymous content:
   nscoord inputFrameContentBoxWidth = aParentReflowState.ComputedWidth();
 
   nsHTMLReflowState wrapperReflowState(aPresContext, aParentReflowState,
                                        aOuterWrapperFrame,
                                        nsSize(inputFrameContentBoxWidth,
                                               NS_UNCONSTRAINEDSIZE));
 
-  nscoord xoffset = aParentReflowState.mComputedBorderPadding.left +
-                      wrapperReflowState.mComputedMargin.left;
-  nscoord yoffset = aParentReflowState.mComputedBorderPadding.top +
-                      wrapperReflowState.mComputedMargin.top;
+  nscoord xoffset = aParentReflowState.ComputedPhysicalBorderPadding().left +
+                      wrapperReflowState.ComputedPhysicalMargin().left;
+  nscoord yoffset = aParentReflowState.ComputedPhysicalBorderPadding().top +
+                      wrapperReflowState.ComputedPhysicalMargin().top;
 
   nsReflowStatus childStatus;
   nsresult rv = ReflowChild(aOuterWrapperFrame, aPresContext,
                             aWrappersDesiredSize, wrapperReflowState,
                             xoffset, yoffset, 0, childStatus);
   NS_ENSURE_SUCCESS(rv, rv);
   MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(childStatus),
              "We gave our child unconstrained height, so it should be complete");
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -114,19 +114,19 @@ NS_IMETHODIMP nsProgressFrame::Reflow(ns
   }
 
   nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
   NS_ASSERTION(barFrame, "The progress frame should have a child with a frame!");
 
   ReflowBarFrame(barFrame, aPresContext, aReflowState, aStatus);
 
   aDesiredSize.width = aReflowState.ComputedWidth() +
-                       aReflowState.mComputedBorderPadding.LeftRight();
+                       aReflowState.ComputedPhysicalBorderPadding().LeftRight();
   aDesiredSize.height = aReflowState.ComputedHeight() +
-                        aReflowState.mComputedBorderPadding.TopBottom();
+                        aReflowState.ComputedPhysicalBorderPadding().TopBottom();
 
   aDesiredSize.SetOverflowAreasToDesiredBounds();
   ConsiderChildOverflow(aDesiredSize.mOverflowAreas, barFrame);
   FinishAndStoreOverflow(&aDesiredSize);
 
   aStatus = NS_FRAME_COMPLETE;
 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
@@ -141,18 +141,18 @@ nsProgressFrame::ReflowBarFrame(nsIFrame
                                 nsReflowStatus&          aStatus)
 {
   bool vertical = StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL;
   nsHTMLReflowState reflowState(aPresContext, aReflowState, aBarFrame,
                                 nsSize(aReflowState.ComputedWidth(),
                                        NS_UNCONSTRAINEDSIZE));
   nscoord size = vertical ? aReflowState.ComputedHeight()
                           : aReflowState.ComputedWidth();
-  nscoord xoffset = aReflowState.mComputedBorderPadding.left;
-  nscoord yoffset = aReflowState.mComputedBorderPadding.top;
+  nscoord xoffset = aReflowState.ComputedPhysicalBorderPadding().left;
+  nscoord yoffset = aReflowState.ComputedPhysicalBorderPadding().top;
 
   double position = static_cast<HTMLProgressElement*>(mContent)->Position();
 
   // Force the bar's size to match the current progress.
   // When indeterminate, the progress' size will be 100%.
   if (position >= 0.0) {
     size *= position;
   }
@@ -168,35 +168,35 @@ nsProgressFrame::ReflowBarFrame(nsIFrame
   //   shown as native: the bar size is forced to 100%.
   // Otherwise (when the progress is indeterminate and the bar appearance isn't
   // native), the bar size isn't fixed and can be set by the author.
   if (position != -1 || ShouldUseNativeStyle()) {
     if (vertical) {
       // We want the bar to begin at the bottom.
       yoffset += aReflowState.ComputedHeight() - size;
 
-      size -= reflowState.mComputedMargin.TopBottom() +
-              reflowState.mComputedBorderPadding.TopBottom();
+      size -= reflowState.ComputedPhysicalMargin().TopBottom() +
+              reflowState.ComputedPhysicalBorderPadding().TopBottom();
       size = std::max(size, 0);
       reflowState.SetComputedHeight(size);
     } else {
-      size -= reflowState.mComputedMargin.LeftRight() +
-              reflowState.mComputedBorderPadding.LeftRight();
+      size -= reflowState.ComputedPhysicalMargin().LeftRight() +
+              reflowState.ComputedPhysicalBorderPadding().LeftRight();
       size = std::max(size, 0);
       reflowState.SetComputedWidth(size);
     }
   } else if (vertical) {
     // For vertical progress bars, we need to position the bar specificly when
     // the width isn't constrained (position == -1 and !ShouldUseNativeStyle())
     // because aReflowState.ComputedHeight() - size == 0.
     yoffset += aReflowState.ComputedHeight() - reflowState.ComputedHeight();
   }
 
-  xoffset += reflowState.mComputedMargin.left;
-  yoffset += reflowState.mComputedMargin.top;
+  xoffset += reflowState.ComputedPhysicalMargin().left;
+  yoffset += reflowState.ComputedPhysicalMargin().top;
 
   nsHTMLReflowMetrics barDesiredSize;
   ReflowChild(aBarFrame, aPresContext, barDesiredSize, reflowState, xoffset,
               yoffset, 0, aStatus);
   FinishReflowChild(aBarFrame, aPresContext, &reflowState, barDesiredSize,
                     xoffset, yoffset, 0);
 }
 
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -266,19 +266,19 @@ nsRangeFrame::Reflow(nsPresContext*     
     nsFormControlFrame::RegUnRegAccessKey(this, true);
   }
 
   nscoord computedHeight = aReflowState.ComputedHeight();
   if (computedHeight == NS_AUTOHEIGHT) {
     computedHeight = 0;
   }
   aDesiredSize.width = aReflowState.ComputedWidth() +
-                       aReflowState.mComputedBorderPadding.LeftRight();
+                       aReflowState.ComputedPhysicalBorderPadding().LeftRight();
   aDesiredSize.height = computedHeight +
-                        aReflowState.mComputedBorderPadding.TopBottom();
+                        aReflowState.ComputedPhysicalBorderPadding().TopBottom();
 
   nsresult rv =
     ReflowAnonymousContent(aPresContext, aDesiredSize, aReflowState);
   NS_ENSURE_SUCCESS(rv, rv);
 
   aDesiredSize.SetOverflowAreasToDesiredBounds();
 
   nsIFrame* trackFrame = mTrackDiv->GetPrimaryFrame();
@@ -335,24 +335,24 @@ nsRangeFrame::ReflowAnonymousContent(nsP
 
     // Find the x/y position of the track frame such that it will be positioned
     // as described above. These coordinates are with respect to the
     // nsRangeFrame's border-box.
     nscoord trackX = rangeFrameContentBoxWidth / 2;
     nscoord trackY = rangeFrameContentBoxHeight / 2;
 
     // Account for the track's border and padding (we ignore its margin):
-    trackX -= trackReflowState.mComputedBorderPadding.left +
+    trackX -= trackReflowState.ComputedPhysicalBorderPadding().left +
                 trackReflowState.ComputedWidth() / 2;
-    trackY -= trackReflowState.mComputedBorderPadding.top +
+    trackY -= trackReflowState.ComputedPhysicalBorderPadding().top +
                 trackReflowState.ComputedHeight() / 2;
 
     // Make relative to our border box instead of our content box:
-    trackX += aReflowState.mComputedBorderPadding.left;
-    trackY += aReflowState.mComputedBorderPadding.top;
+    trackX += aReflowState.ComputedPhysicalBorderPadding().left;
+    trackY += aReflowState.ComputedPhysicalBorderPadding().top;
 
     nsReflowStatus frameStatus;
     nsHTMLReflowMetrics trackDesiredSize;
     nsresult rv = ReflowChild(trackFrame, aPresContext, trackDesiredSize,
                               trackReflowState, trackX, trackY, 0, frameStatus);
     NS_ENSURE_SUCCESS(rv, rv);
     MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(frameStatus),
                "We gave our child unconstrained height, so it should be complete");
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -484,36 +484,36 @@ nsTextControlFrame::Reflow(nsPresContext
 
   // make sure that the form registers itself on the initial/first reflow
   if (mState & NS_FRAME_FIRST_REFLOW) {
     nsFormControlFrame::RegUnRegAccessKey(this, true);
   }
 
   // set values of reflow's out parameters
   aDesiredSize.width = aReflowState.ComputedWidth() +
-                       aReflowState.mComputedBorderPadding.LeftRight();
+                       aReflowState.ComputedPhysicalBorderPadding().LeftRight();
   aDesiredSize.height = aReflowState.ComputedHeight() +
-                        aReflowState.mComputedBorderPadding.TopBottom();
+                        aReflowState.ComputedPhysicalBorderPadding().TopBottom();
 
   // computation of the ascent wrt the input height
   nscoord lineHeight = aReflowState.ComputedHeight();
   float inflation = nsLayoutUtils::FontSizeInflationFor(this);
   if (!IsSingleLineTextControl()) {
     lineHeight = nsHTMLReflowState::CalcLineHeight(StyleContext(), 
                                                   NS_AUTOHEIGHT, inflation);
   }
   nsRefPtr<nsFontMetrics> fontMet;
   nsresult rv = nsLayoutUtils::GetFontMetricsForFrame(this, 
                                                       getter_AddRefs(fontMet), 
                                                       inflation);
   NS_ENSURE_SUCCESS(rv, rv);
   // now adjust for our borders and padding
   aDesiredSize.ascent = 
         nsLayoutUtils::GetCenteredFontBaseline(fontMet, lineHeight) 
-        + aReflowState.mComputedBorderPadding.top;
+        + aReflowState.ComputedPhysicalBorderPadding().top;
 
   // overflow handling
   aDesiredSize.SetOverflowAreasToDesiredBounds();
   // perform reflow on all kids
   nsIFrame* kid = mFrames.FirstChild();
   while (kid) {
     ReflowTextControlChild(kid, aPresContext, aReflowState, aStatus, aDesiredSize);
     kid = kid->GetNextSibling();
@@ -540,32 +540,32 @@ nsTextControlFrame::ReflowTextControlChi
   availSize.width = std::max(availSize.width, 0);
   availSize.height = std::max(availSize.height, 0);
   
   nsHTMLReflowState kidReflowState(aPresContext, aReflowState, 
                                    aKid, availSize);
 
   // Set computed width and computed height for the child
   nscoord width = availSize.width;
-  width -= kidReflowState.mComputedMargin.LeftRight() +
-              kidReflowState.mComputedBorderPadding.LeftRight();
+  width -= kidReflowState.ComputedPhysicalMargin().LeftRight() +
+              kidReflowState.ComputedPhysicalBorderPadding().LeftRight();
   width = std::max(width, 0);
   kidReflowState.SetComputedWidth(width);
 
   nscoord height = availSize.height;
-  height -= kidReflowState.mComputedMargin.TopBottom() +
-              kidReflowState.mComputedBorderPadding.TopBottom();
+  height -= kidReflowState.ComputedPhysicalMargin().TopBottom() +
+              kidReflowState.ComputedPhysicalBorderPadding().TopBottom();
   height = std::max(height, 0);       
   kidReflowState.SetComputedHeight(height); 
 
   // compute the offsets
-  nscoord xOffset = aReflowState.mComputedBorderPadding.left
-                      + kidReflowState.mComputedMargin.left;
-  nscoord yOffset = aReflowState.mComputedBorderPadding.top
-                      + kidReflowState.mComputedMargin.top;
+  nscoord xOffset = aReflowState.ComputedPhysicalBorderPadding().left
+                      + kidReflowState.ComputedPhysicalMargin().left;
+  nscoord yOffset = aReflowState.ComputedPhysicalBorderPadding().top
+                      + kidReflowState.ComputedPhysicalMargin().top;
 
   // reflow the child
   nsHTMLReflowMetrics desiredSize;  
   ReflowChild(aKid, aPresContext, desiredSize, kidReflowState, 
               xOffset, yOffset, 0, aStatus);
 
   // place the child
   FinishReflowChild(aKid, aPresContext, &kidReflowState, 
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -360,101 +360,101 @@ nsAbsoluteContainingBlock::ReflowAbsolut
     if (aKidFrame) {
       nsAutoString name;
       aKidFrame->GetFrameName(name);
       printf("%s ", NS_LossyConvertUTF16toASCII(name).get());
     }
 
     char width[16];
     char height[16];
-    PrettyUC(aReflowState.availableWidth, width);
-    PrettyUC(aReflowState.availableHeight, height);
+    PrettyUC(aReflowState.AvailableWidth(), width);
+    PrettyUC(aReflowState.AvailableHeight(), height);
     printf(" a=%s,%s ", width, height);
     PrettyUC(aReflowState.ComputedWidth(), width);
     PrettyUC(aReflowState.ComputedHeight(), height);
     printf("c=%s,%s \n", width, height);
   }
   AutoNoisyIndenter indent(nsBlockFrame::gNoisy);
 #endif // DEBUG
 
   nscoord availWidth = aContainingBlock.width;
   if (availWidth == -1) {
     NS_ASSERTION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
                  "Must have a useful width _somewhere_");
     availWidth =
-      aReflowState.ComputedWidth() + aReflowState.mComputedPadding.LeftRight();
+      aReflowState.ComputedWidth() + aReflowState.ComputedPhysicalPadding().LeftRight();
   }
 
   nsHTMLReflowMetrics kidDesiredSize;
   nsHTMLReflowState kidReflowState(aPresContext, aReflowState, aKidFrame,
                                    nsSize(availWidth, NS_UNCONSTRAINEDSIZE),
                                    aContainingBlock.width,
                                    aContainingBlock.height);
 
   // Send the WillReflow() notification and position the frame
   aKidFrame->WillReflow(aPresContext);
 
   // Get the border values
   const nsMargin& border = aReflowState.mStyleBorder->GetComputedBorder();
 
-  bool constrainHeight = (aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE)
+  bool constrainHeight = (aReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE)
     && aConstrainHeight
        // Don't split if told not to (e.g. for fixed frames)
     && (aDelegatingFrame->GetType() != nsGkAtoms::inlineFrame)
        //XXX we don't handle splitting frames for inline absolute containing blocks yet
-    && (aKidFrame->GetRect().y <= aReflowState.availableHeight);
+    && (aKidFrame->GetRect().y <= aReflowState.AvailableHeight());
        // Don't split things below the fold. (Ideally we shouldn't *have*
        // anything totally below the fold, but we can't position frames
        // across next-in-flow breaks yet.
   if (constrainHeight) {
-    kidReflowState.availableHeight = aReflowState.availableHeight - border.top
-                                     - kidReflowState.mComputedMargin.top;
-    if (NS_AUTOOFFSET != kidReflowState.mComputedOffsets.top)
-      kidReflowState.availableHeight -= kidReflowState.mComputedOffsets.top;
+    kidReflowState.AvailableHeight() = aReflowState.AvailableHeight() - border.top
+                                     - kidReflowState.ComputedPhysicalMargin().top;
+    if (NS_AUTOOFFSET != kidReflowState.ComputedPhysicalOffsets().top)
+      kidReflowState.AvailableHeight() -= kidReflowState.ComputedPhysicalOffsets().top;
   }
 
   // Do the reflow
   nsresult rv = aKidFrame->Reflow(aPresContext, kidDesiredSize, kidReflowState, aStatus);
 
   // If we're solving for 'left' or 'top', then compute it now that we know the
   // width/height
-  if ((NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) ||
-      (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top)) {
+  if ((NS_AUTOOFFSET == kidReflowState.ComputedPhysicalOffsets().left) ||
+      (NS_AUTOOFFSET == kidReflowState.ComputedPhysicalOffsets().top)) {
     nscoord aContainingBlockWidth = aContainingBlock.width;
     nscoord aContainingBlockHeight = aContainingBlock.height;
 
     if (-1 == aContainingBlockWidth) {
       // Get the containing block width/height
       kidReflowState.ComputeContainingBlockRectangle(aPresContext,
                                                      &aReflowState,
                                                      aContainingBlockWidth,
                                                      aContainingBlockHeight);
     }
 
-    if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.left) {
-      NS_ASSERTION(NS_AUTOOFFSET != kidReflowState.mComputedOffsets.right,
+    if (NS_AUTOOFFSET == kidReflowState.ComputedPhysicalOffsets().left) {
+      NS_ASSERTION(NS_AUTOOFFSET != kidReflowState.ComputedPhysicalOffsets().right,
                    "Can't solve for both left and right");
-      kidReflowState.mComputedOffsets.left = aContainingBlockWidth -
-                                             kidReflowState.mComputedOffsets.right -
-                                             kidReflowState.mComputedMargin.right -
+      kidReflowState.ComputedPhysicalOffsets().left = aContainingBlockWidth -
+                                             kidReflowState.ComputedPhysicalOffsets().right -
+                                             kidReflowState.ComputedPhysicalMargin().right -
                                              kidDesiredSize.width -
-                                             kidReflowState.mComputedMargin.left;
+                                             kidReflowState.ComputedPhysicalMargin().left;
     }
-    if (NS_AUTOOFFSET == kidReflowState.mComputedOffsets.top) {
-      kidReflowState.mComputedOffsets.top = aContainingBlockHeight -
-                                            kidReflowState.mComputedOffsets.bottom -
-                                            kidReflowState.mComputedMargin.bottom -
+    if (NS_AUTOOFFSET == kidReflowState.ComputedPhysicalOffsets().top) {
+      kidReflowState.ComputedPhysicalOffsets().top = aContainingBlockHeight -
+                                            kidReflowState.ComputedPhysicalOffsets().bottom -
+                                            kidReflowState.ComputedPhysicalMargin().bottom -
                                             kidDesiredSize.height -
-                                            kidReflowState.mComputedMargin.top;
+                                            kidReflowState.ComputedPhysicalMargin().top;
     }
   }
 
   // Position the child relative to our padding edge
-  nsRect  rect(border.left + kidReflowState.mComputedOffsets.left + kidReflowState.mComputedMargin.left,
-               border.top + kidReflowState.mComputedOffsets.top + kidReflowState.mComputedMargin.top,
+  nsRect  rect(border.left + kidReflowState.ComputedPhysicalOffsets().left + kidReflowState.ComputedPhysicalMargin().left,
+               border.top + kidReflowState.ComputedPhysicalOffsets().top + kidReflowState.ComputedPhysicalMargin().top,
                kidDesiredSize.width, kidDesiredSize.height);
 
   // Offset the frame rect by the given origin of the absolute containing block.
   // If the frame is auto-positioned on both sides of an axis, it will be
   // positioned based on its containing block and we don't need to offset.
   if (aContainingBlock.TopLeft() != nsPoint(0, 0)) {
     if (!(kidReflowState.mStylePosition->mOffset.GetLeftUnit() == eStyleUnit_Auto &&
           kidReflowState.mStylePosition->mOffset.GetRightUnit() == eStyleUnit_Auto)) {
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -868,17 +868,17 @@ CalculateContainingBlockSizeForAbsolutes
   // code won't know how to calculate the containing block height
   // because it's calculated bottom up. So we use our own computed
   // size as the dimensions.
   nsIFrame* frame = aReflowState.frame;
 
   nsSize cbSize(aFrameSize);
     // Containing block is relative to the padding edge
   const nsMargin& border =
-    aReflowState.mComputedBorderPadding - aReflowState.mComputedPadding;
+    aReflowState.ComputedPhysicalBorderPadding() - aReflowState.ComputedPhysicalPadding();
   cbSize.width -= border.LeftRight();
   cbSize.height -= border.TopBottom();
 
   if (frame->GetParent()->GetContent() == frame->GetContent() &&
       frame->GetParent()->GetType() != nsGkAtoms::canvasFrame) {
     // We are a wrapped frame for the content (and the wrapper is not the
     // canvas frame, whose size is not meaningful here).
     // Use the container's dimensions, if they have been precomputed.
@@ -912,21 +912,21 @@ CalculateContainingBlockSizeForAbsolutes
         if (!lastButOneRS->mFlags.mAssumingVScrollbar) {
           scrollbars.left = scrollbars.right = 0;
         }
       }
       // We found a reflow state for the outermost wrapping frame, so use
       // its computed metrics if available
       if (aLastRS->ComputedWidth() != NS_UNCONSTRAINEDSIZE) {
         cbSize.width = std::max(0,
-          aLastRS->ComputedWidth() + aLastRS->mComputedPadding.LeftRight() - scrollbars.LeftRight());
+          aLastRS->ComputedWidth() + aLastRS->ComputedPhysicalPadding().LeftRight() - scrollbars.LeftRight());
       }
       if (aLastRS->ComputedHeight() != NS_UNCONSTRAINEDSIZE) {
         cbSize.height = std::max(0,
-          aLastRS->ComputedHeight() + aLastRS->mComputedPadding.TopBottom() - scrollbars.TopBottom());
+          aLastRS->ComputedHeight() + aLastRS->ComputedPhysicalPadding().TopBottom() - scrollbars.TopBottom());
       }
     }
   }
 
   return cbSize;
 }
 
 NS_IMETHODIMP
@@ -937,17 +937,17 @@ nsBlockFrame::Reflow(nsPresContext*     
 {
   DO_GLOBAL_REFLOW_COUNT("nsBlockFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
 #ifdef DEBUG
   if (gNoisyReflow) {
     IndentBy(stdout, gNoiseIndent);
     ListTag(stdout);
     printf(": begin reflow availSize=%d,%d computedSize=%d,%d\n",
-           aReflowState.availableWidth, aReflowState.availableHeight,
+           aReflowState.AvailableWidth(), aReflowState.AvailableHeight(),
            aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
   }
   AutoNoisyIndenter indent(gNoisy);
   PRTime start = 0; // Initialize these variablies to silence the compiler.
   int32_t ctc = 0;        // We only use these if they are set (gLameReflowMetrics).
   if (gLameReflowMetrics) {
     start = PR_Now();
     ctc = nsLineBox::GetCtorCount();
@@ -956,32 +956,32 @@ nsBlockFrame::Reflow(nsPresContext*     
 
   const nsHTMLReflowState *reflowState = &aReflowState;
   nscoord consumedHeight = GetConsumedHeight();
   nscoord effectiveComputedHeight = GetEffectiveComputedHeight(aReflowState,
                                                                consumedHeight);
   Maybe<nsHTMLReflowState> mutableReflowState;
   // If we have non-auto height, we're clipping our kids and we fit,
   // make sure our kids fit too.
-  if (aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE &&
+  if (aReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE &&
       aReflowState.ComputedHeight() != NS_AUTOHEIGHT &&
       ShouldApplyOverflowClipping(this, aReflowState.mStyleDisplay)) {
-    nsMargin heightExtras = aReflowState.mComputedBorderPadding;
+    nsMargin heightExtras = aReflowState.ComputedPhysicalBorderPadding();
     if (GetSkipSides() & NS_SIDE_TOP) {
       heightExtras.top = 0;
     } else {
       // Bottom margin never causes us to create continuations, so we
       // don't need to worry about whether it fits in its entirety.
-      heightExtras.top += aReflowState.mComputedMargin.top;
+      heightExtras.top += aReflowState.ComputedPhysicalMargin().top;
     }
 
     if (effectiveComputedHeight + heightExtras.TopBottom() <=
-        aReflowState.availableHeight) {
+        aReflowState.AvailableHeight()) {
       mutableReflowState.construct(aReflowState);
-      mutableReflowState.ref().availableHeight = NS_UNCONSTRAINEDSIZE;
+      mutableReflowState.ref().AvailableHeight() = NS_UNCONSTRAINEDSIZE;
       reflowState = mutableReflowState.addr();
     }
   }
 
   // See comment below about oldSize. Use *only* for the
   // abs-pos-containing-block-size-change optimization!
   nsSize oldSize = GetSize();
 
@@ -1087,17 +1087,17 @@ nsBlockFrame::Reflow(nsPresContext*     
   NS_ASSERTION(NS_SUCCEEDED(rv), "reflow dirty lines failed");
   if (NS_FAILED(rv)) return rv;
 
   NS_MergeReflowStatusInto(&state.mReflowStatus, ocStatus);
   NS_MergeReflowStatusInto(&state.mReflowStatus, fcStatus);
 
   // If we end in a BR with clear and affected floats continue,
   // we need to continue, too.
-  if (NS_UNCONSTRAINEDSIZE != reflowState->availableHeight &&
+  if (NS_UNCONSTRAINEDSIZE != reflowState->AvailableHeight() &&
       NS_FRAME_IS_COMPLETE(state.mReflowStatus) &&
       state.mFloatManager->ClearContinues(FindTrailingClear())) {
     NS_FRAME_SET_INCOMPLETE(state.mReflowStatus);
   }
 
   if (!NS_FRAME_IS_FULLY_COMPLETE(state.mReflowStatus)) {
     if (HasOverflowLines() || HasPushedFloats()) {
       state.mReflowStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
@@ -1126,17 +1126,17 @@ nsBlockFrame::Reflow(nsPresContext*     
         mLines.front() != mLines.back() &&
         mLines.begin().next()->IsBlock()))) {
     // Reflow the bullet
     nsHTMLReflowMetrics metrics;
     // XXX Use the entire line when we fix bug 25888.
     nsLayoutUtils::LinePosition position;
     bool havePosition = nsLayoutUtils::GetFirstLinePosition(this, &position);
     nscoord lineTop = havePosition ? position.mTop
-                                   : reflowState->mComputedBorderPadding.top;
+                                   : reflowState->ComputedPhysicalBorderPadding().top;
     nsIFrame* bullet = GetOutsideBullet();
     ReflowBullet(bullet, state, metrics, lineTop);
     NS_ASSERTION(!BulletIsEmpty() || metrics.height == 0,
                  "empty bullet took up space");
 
     if (havePosition && !BulletIsEmpty()) {
       // We have some lines to align the bullet with.  
 
@@ -1364,45 +1364,45 @@ nsBlockFrame::ComputeFinalSize(const nsH
   if (aState.GetFlag(BRS_ISBOTTOMMARGINROOT) ||
       NS_UNCONSTRAINEDSIZE != aReflowState.ComputedHeight()) {
     // When we are a bottom-margin root make sure that our last
     // childs bottom margin is fully applied. We also do this when
     // we have a computed height, since in that case the carried out
     // margin is not going to be applied anywhere, so we should note it
     // here to be included in the overflow area.
     // Apply the margin only if there's space for it.
-    if (bottomEdgeOfChildren < aState.mReflowState.availableHeight)
+    if (bottomEdgeOfChildren < aState.mReflowState.AvailableHeight())
     {
       // Truncate bottom margin if it doesn't fit to our available height.
       bottomEdgeOfChildren =
         std::min(bottomEdgeOfChildren + aState.mPrevBottomMargin.get(),
-               aState.mReflowState.availableHeight);
+               aState.mReflowState.AvailableHeight());
     }
   }
   if (aState.GetFlag(BRS_FLOAT_MGR)) {
     // Include the float manager's state to properly account for the
     // bottom margin of any floated elements; e.g., inside a table cell.
     nscoord floatHeight =
       aState.ClearFloats(bottomEdgeOfChildren, NS_STYLE_CLEAR_LEFT_AND_RIGHT,
                          nullptr, nsFloatManager::DONT_CLEAR_PUSHED_FLOATS);
     bottomEdgeOfChildren = std::max(bottomEdgeOfChildren, floatHeight);
   }
 
   if (NS_UNCONSTRAINEDSIZE != aReflowState.ComputedHeight()
       && (mParent->GetType() != nsGkAtoms::columnSetFrame ||
-          aReflowState.parentReflowState->availableHeight == NS_UNCONSTRAINEDSIZE)) {
+          aReflowState.parentReflowState->AvailableHeight() == NS_UNCONSTRAINEDSIZE)) {
     ComputeFinalHeight(aReflowState, &aState.mReflowStatus,
                        aState.mY + nonCarriedOutVerticalMargin,
                        borderPadding, aMetrics, aState.mConsumedHeight);
     if (!NS_FRAME_IS_COMPLETE(aState.mReflowStatus)) {
       // Use the current height; continuations will take up the rest.
       // Do extend the height to at least consume the available
       // height, otherwise our left/right borders (for example) won't
       // extend all the way to the break.
-      aMetrics.height = std::max(aReflowState.availableHeight,
+      aMetrics.height = std::max(aReflowState.AvailableHeight(),
                                aState.mY + nonCarriedOutVerticalMargin);
       // ... but don't take up more height than is available
       nscoord effectiveComputedHeight =
         GetEffectiveComputedHeight(aReflowState, aState.GetConsumedHeight());
       aMetrics.height = std::min(aMetrics.height,
                                borderPadding.top + effectiveComputedHeight);
       // XXX It's pretty wrong that our bottom border still gets drawn on
       // on its own on the last-in-flow, even if we ran out of height
@@ -1420,20 +1420,20 @@ nsBlockFrame::ComputeFinalSize(const nsH
       // Our min-height or max-height made our height change.  Don't carry out
       // our kids' bottom margins.
       aMetrics.mCarriedOutBottomMargin.Zero();
     }
     autoHeight += borderPadding.top + borderPadding.bottom;
     aMetrics.height = autoHeight;
   }
   else {
-    NS_ASSERTION(aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE,
+    NS_ASSERTION(aReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE,
       "Shouldn't be incomplete if availableHeight is UNCONSTRAINED.");
-    aMetrics.height = std::max(aState.mY, aReflowState.availableHeight);
-    if (aReflowState.availableHeight == NS_UNCONSTRAINEDSIZE)
+    aMetrics.height = std::max(aState.mY, aReflowState.AvailableHeight());
+    if (aReflowState.AvailableHeight() == NS_UNCONSTRAINEDSIZE)
       // This should never happen, but it does. See bug 414255
       aMetrics.height = aState.mY;
   }
 
   if (IS_TRUE_OVERFLOW_CONTAINER(this) &&
       NS_FRAME_IS_NOT_COMPLETE(aState.mReflowStatus)) {
     // Overflow containers can only be overflow complete.
     // Note that auto height overflow containers have no normal children
@@ -1627,26 +1627,26 @@ nsBlockFrame::PrepareResizeReflow(nsBloc
   if (gDisableResizeOpt) {
     tryAndSkipLines = false;
   }
   if (gNoisyReflow) {
     if (!tryAndSkipLines) {
       IndentBy(stdout, gNoiseIndent);
       ListTag(stdout);
       printf(": marking all lines dirty: availWidth=%d textAlign=%d\n",
-             aState.mReflowState.availableWidth,
+             aState.mReflowState.AvailableWidth(),
              styleText->mTextAlign);
     }
   }
 #endif
 
   if (tryAndSkipLines) {
-    nscoord newAvailWidth = aState.mReflowState.mComputedBorderPadding.left +
+    nscoord newAvailWidth = aState.mReflowState.ComputedPhysicalBorderPadding().left +
                             aState.mReflowState.ComputedWidth();
-    NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mReflowState.mComputedBorderPadding.left &&
+    NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mReflowState.ComputedPhysicalBorderPadding().left &&
                  NS_UNCONSTRAINEDSIZE != aState.mReflowState.ComputedWidth(),
                  "math on NS_UNCONSTRAINEDSIZE");
 
 #ifdef DEBUG
     if (gNoisyReflow) {
       IndentBy(stdout, gNoiseIndent);
       ListTag(stdout);
       printf(": trying to avoid marking all lines dirty\n");
@@ -1856,18 +1856,18 @@ nsBlockFrame::ReflowDirtyLines(nsBlockRe
 #endif
 
   bool selfDirty = (GetStateBits() & NS_FRAME_IS_DIRTY) ||
                      (aState.mReflowState.mFlags.mVResize &&
                       (GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT));
 
   // Reflow our last line if our availableHeight has increased
   // so that we (and our last child) pull up content as necessary
-  if (aState.mReflowState.availableHeight != NS_UNCONSTRAINEDSIZE
-      && GetNextInFlow() && aState.mReflowState.availableHeight > mRect.height) {
+  if (aState.mReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE
+      && GetNextInFlow() && aState.mReflowState.AvailableHeight() > mRect.height) {
     line_iterator lastLine = end_lines();
     if (lastLine != begin_lines()) {
       --lastLine;
       lastLine->MarkDirty();
     }
   }
     // the amount by which we will slide the current line if it is not
     // dirty
@@ -1968,17 +1968,17 @@ nsBlockFrame::ReflowDirtyLines(nsBlockRe
     // If we have a constrained height (i.e., breaking columns/pages),
     // and the distance to the bottom might have changed, then we need
     // to reflow any line that might have floats in it, both because the
     // breakpoints within those floats may have changed and because we
     // might have to push/pull the floats in their entirety.
     // FIXME: What about a deltaY or height change that forces us to
     // push lines?  Why does that work?
     if (!line->IsDirty() &&
-        aState.mReflowState.availableHeight != NS_UNCONSTRAINEDSIZE &&
+        aState.mReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE &&
         (deltaY != 0 || aState.mReflowState.mFlags.mVResize ||
          aState.mReflowState.mFlags.mMustReflowPlaceholders) &&
         (line->IsBlock() || line->HasFloats() || line->HadFloatPushed())) {
       line->MarkDirty();
     }
 
     if (!line->IsDirty()) {
       // See if there's any reflow damage that requires that we mark the
@@ -2210,17 +2210,17 @@ nsBlockFrame::ReflowDirtyLines(nsBlockRe
   // -- and we cannot have added more space for its first line to be
   // pulled up into,
   // -- it's an incremental reflow of a descendant
   // -- and we didn't reflow any floats (so the available space
   // didn't change)
   // -- my chain of next-in-flows either has no first line, or its first
   // line isn't dirty.
   bool heightConstrained =
-    aState.mReflowState.availableHeight != NS_UNCONSTRAINEDSIZE;
+    aState.mReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE;
   bool skipPull = willReflowAgain && heightConstrained;
   if (!skipPull && heightConstrained && aState.mNextInFlow &&
       (aState.mReflowState.mFlags.mNextInFlowUntouched &&
        !lastLineMovedUp && 
        !(GetStateBits() & NS_FRAME_IS_DIRTY) &&
        !reflowedFloat)) {
     // We'll place lineIter at the last line of this block, so that 
     // nsBlockInFlowLineIterator::Next() will take us to the first
@@ -2357,17 +2357,17 @@ nsBlockFrame::ReflowDirtyLines(nsBlockRe
     } //XXXfr shouldn't set this flag when nextinflow has no lines
   }
 
   // Handle an odd-ball case: a list-item with no lines
   if (HasOutsideBullet() && mLines.empty()) {
     nsHTMLReflowMetrics metrics;
     nsIFrame* bullet = GetOutsideBullet();
     ReflowBullet(bullet, aState, metrics,
-                 aState.mReflowState.mComputedBorderPadding.top);
+                 aState.mReflowState.ComputedPhysicalBorderPadding().top);
     NS_ASSERTION(!BulletIsEmpty() || metrics.height == 0,
                  "empty bullet took up space");
 
     if (!BulletIsEmpty()) {
       // There are no lines so we have to fake up some y motion so that
       // we end up with *some* height.
 
       if (metrics.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE &&
@@ -3599,19 +3599,19 @@ nsBlockFrame::DoReflowInlineFrames(nsBlo
       // We should never hit this case if we've placed floats on the
       // line; if we have, then the GetFloatAvailableSpace call is wrong
       // and needs to happen after the caller pops the space manager
       // state.
       aState.mFloatManager->AssertStateMatches(aFloatStateBeforeLine);
       aState.mY += aFloatAvailableSpace.mRect.height;
       aFloatAvailableSpace = aState.GetFloatAvailableSpace();
     } else {
-      NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mReflowState.availableHeight,
+      NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aState.mReflowState.AvailableHeight(),
                    "We shouldn't be running out of height here");
-      if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.availableHeight) {
+      if (NS_UNCONSTRAINEDSIZE == aState.mReflowState.AvailableHeight()) {
         // just move it down a bit to try to get out of this mess
         aState.mY += 1;
         // We should never hit this case if we've placed floats on the
         // line; if we have, then the GetFloatAvailableSpace call is wrong
         // and needs to happen after the caller pops the space manager
         // state.
         aState.mFloatManager->AssertStateMatches(aFloatStateBeforeLine);
         aFloatAvailableSpace = aState.GetFloatAvailableSpace();
@@ -5766,18 +5766,18 @@ nsBlockFrame::ComputeFloatWidth(nsBlockR
   NS_PRECONDITION(aFloat->GetStateBits() & NS_FRAME_OUT_OF_FLOW,
                   "aFloat must be an out-of-flow frame");
   // Reflow the float.
   nsRect availSpace = AdjustFloatAvailableSpace(aState, aFloatAvailableSpace,
                                                 aFloat);
 
   nsHTMLReflowState floatRS(aState.mPresContext, aState.mReflowState, aFloat, 
                             availSpace.Size());
-  return floatRS.ComputedWidth() + floatRS.mComputedBorderPadding.LeftRight() +
-    floatRS.mComputedMargin.LeftRight();
+  return floatRS.ComputedWidth() + floatRS.ComputedPhysicalBorderPadding().LeftRight() +
+    floatRS.ComputedPhysicalMargin().LeftRight();
 }
 
 nsresult
 nsBlockFrame::ReflowFloat(nsBlockReflowState& aState,
                           const nsRect&       aAdjustedAvailableSpace,
                           nsIFrame*           aFloat,
                           nsMargin&           aFloatMargin,
                           nsMargin&           aFloatOffsets,
@@ -5867,18 +5867,18 @@ nsBlockFrame::ReflowFloat(nsBlockReflowS
       aReflowStatus = NS_FRAME_COMPLETE;
   }
 
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   // Capture the margin and offsets information for the caller
-  aFloatMargin = floatRS.mComputedMargin; // float margins don't collapse
-  aFloatOffsets = floatRS.mComputedOffsets;
+  aFloatMargin = floatRS.ComputedPhysicalMargin(); // float margins don't collapse
+  aFloatOffsets = floatRS.ComputedPhysicalOffsets();
 
   const nsHTMLReflowMetrics& metrics = brc.GetMetrics();
 
   // Set the rect, make sure the view is properly sized and positioned,
   // and tell the frame we're done reflowing it
   // XXXldb This seems like the wrong place to be doing this -- shouldn't
   // we be doing this in nsBlockReflowState::FlowAndPlaceFloat after
   // we've positioned the float, and shouldn't we be doing the equivalent
@@ -6855,24 +6855,24 @@ nsBlockFrame::ReflowBullet(nsIFrame* aBu
   // the edge of the floats is the content-edge of the block, and place
   // the bullet at a position offset from there by the block's padding,
   // the block's border, and the bullet frame's margin.
   nscoord x;
   if (rs.mStyleVisibility->mDirection == NS_STYLE_DIRECTION_LTR) {
     // The floatAvailSpace.x gives us the content/float edge. Then we
     // subtract out the left border/padding and the bullet's width and
     // margin to offset the position.
-    x = floatAvailSpace.x - rs.mComputedBorderPadding.left
-        - reflowState.mComputedMargin.right - aMetrics.width;
+    x = floatAvailSpace.x - rs.ComputedPhysicalBorderPadding().left
+        - reflowState.ComputedPhysicalMargin().right - aMetrics.width;
   } else {
     // The XMost() of the available space give us offsets from the left
     // border edge.  Then we add the right border/padding and the
     // bullet's margin to offset the position.
-    x = floatAvailSpace.XMost() + rs.mComputedBorderPadding.right
-        + reflowState.mComputedMargin.left;
+    x = floatAvailSpace.XMost() + rs.ComputedPhysicalBorderPadding().right
+        + reflowState.ComputedPhysicalMargin().left;
   }
 
   // Approximate the bullets position; vertical alignment will provide
   // the final vertical location.
   nscoord y = aState.mContentArea.y;
   aBulletFrame->SetRect(nsRect(x, y, aMetrics.width, aMetrics.height));
   aBulletFrame->DidReflow(aState.mPresContext, &aState.mReflowState,
                           nsDidReflowStatus::FINISHED);
@@ -7045,21 +7045,21 @@ nsBlockFrame::WidthToClearPastFloats(nsB
   // to fit.
   // All we really need here is the result of ComputeSize, and we
   // could *almost* get that from an nsCSSOffsetState, except for the
   // last argument.
   nsSize availSpace(availWidth, NS_UNCONSTRAINEDSIZE);
   nsHTMLReflowState reflowState(aState.mPresContext, aState.mReflowState,
                                 aFrame, availSpace);
   result.borderBoxWidth = reflowState.ComputedWidth() +
-                          reflowState.mComputedBorderPadding.LeftRight();
+                          reflowState.ComputedPhysicalBorderPadding().LeftRight();
   // Use the margins from offsetState rather than reflowState so that
   // they aren't reduced by ignoring margins in overconstrained cases.
-  result.marginLeft  = offsetState.mComputedMargin.left;
-  result.marginRight = offsetState.mComputedMargin.right;
+  result.marginLeft  = offsetState.ComputedPhysicalMargin().left;
+  result.marginRight = offsetState.ComputedPhysicalMargin().right;
   return result;
 }
  
 /* static */
 nsBlockFrame*
 nsBlockFrame::GetNearestAncestorBlock(nsIFrame* aCandidate)
 {
   nsBlockFrame* block = nullptr;
@@ -7094,36 +7094,36 @@ nsBlockFrame::ComputeFinalHeight(const n
                "overflow container must not have computedHeightLeftOver");
 
   aMetrics.height =
     NSCoordSaturatingAdd(NSCoordSaturatingAdd(aBorderPadding.top,
                                               computedHeightLeftOver),
                          aBorderPadding.bottom);
 
   if (NS_FRAME_IS_NOT_COMPLETE(*aStatus)
-      && aMetrics.height < aReflowState.availableHeight) {
+      && aMetrics.height < aReflowState.AvailableHeight()) {
     // We ran out of height on this page but we're incomplete
     // Set status to complete except for overflow
     NS_FRAME_SET_OVERFLOW_INCOMPLETE(*aStatus);
   }
 
   if (NS_FRAME_IS_COMPLETE(*aStatus)) {
     if (computedHeightLeftOver > 0 &&
-        NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight &&
-        aMetrics.height > aReflowState.availableHeight) {
+        NS_UNCONSTRAINEDSIZE != aReflowState.AvailableHeight() &&
+        aMetrics.height > aReflowState.AvailableHeight()) {
       if (ShouldAvoidBreakInside(aReflowState)) {
         *aStatus = NS_INLINE_LINE_BREAK_BEFORE();
         return;
       }
       // We don't fit and we consumed some of the computed height,
       // so we should consume all the available height and then
       // break.  If our bottom border/padding straddles the break
       // point, then this will increase our height and push the
       // border/padding to the next page/column.
-      aMetrics.height = std::max(aReflowState.availableHeight,
+      aMetrics.height = std::max(aReflowState.AvailableHeight(),
                                  aContentHeight);
       NS_FRAME_SET_INCOMPLETE(*aStatus);
       if (!GetNextInFlow())
         *aStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
     }
   }
 }
 
--- a/layout/generic/nsBlockReflowContext.cpp
+++ b/layout/generic/nsBlockReflowContext.cpp
@@ -41,39 +41,39 @@ static nsIFrame* DescendIntoBlockLevelFr
 }
 
 bool
 nsBlockReflowContext::ComputeCollapsedTopMargin(const nsHTMLReflowState& aRS,
   nsCollapsingMargin* aMargin, nsIFrame* aClearanceFrame,
   bool* aMayNeedRetry, bool* aBlockIsEmpty)
 {
   // Include frame's top margin
-  aMargin->Include(aRS.mComputedMargin.top);
+  aMargin->Include(aRS.ComputedPhysicalMargin().top);
 
   // The inclusion of the bottom margin when empty is done by the caller
   // since it doesn't need to be done by the top-level (non-recursive)
   // caller.
 
 #ifdef NOISY_VERTICAL_MARGINS
   nsFrame::ListTag(stdout, aRS.frame);
-  printf(": %d => %d\n", aRS.mComputedMargin.top, aMargin->get());
+  printf(": %d => %d\n", aRS.ComputedPhysicalMargin().top, aMargin->get());
 #endif
 
   bool dirtiedLine = false;
   bool setBlockIsEmpty = false;
 
   // Calculate the frame's generational top-margin from its child
   // blocks. Note that if the frame has a non-zero top-border or
   // top-padding then this step is skipped because it will be a margin
   // root.  It is also skipped if the frame is a margin root for other
   // reasons.
   nsIFrame* frame = DescendIntoBlockLevelFrame(aRS.frame);
   nsPresContext* prescontext = frame->PresContext();
   nsBlockFrame* block = nullptr;
-  if (0 == aRS.mComputedBorderPadding.top) {
+  if (0 == aRS.ComputedPhysicalBorderPadding().top) {
     block = nsLayoutUtils::GetAsBlock(frame);
     if (block) {
       bool topMarginRoot, unused;
       block->IsMarginRoot(&topMarginRoot, &unused);
       if (topMarginRoot) {
         block = nullptr;
       }
     }
@@ -153,17 +153,17 @@ nsBlockReflowContext::ComputeCollapsedTo
             if (kid->StyleDisplay()->mBreakType != NS_STYLE_CLEAR_NONE) {
               *aMayNeedRetry = true;
             }
             if (ComputeCollapsedTopMargin(innerReflowState, aMargin, aClearanceFrame, aMayNeedRetry, &isEmpty)) {
               line->MarkDirty();
               dirtiedLine = true;
             }
             if (isEmpty)
-              aMargin->Include(innerReflowState.mComputedMargin.bottom);
+              aMargin->Include(innerReflowState.ComputedPhysicalMargin().bottom);
           }
           if (outerReflowState != &aRS) {
             delete const_cast<nsHTMLReflowState*>(outerReflowState);
           }
         }
         if (!isEmpty) {
           if (!setBlockIsEmpty && aBlockIsEmpty) {
             setBlockIsEmpty = true;
@@ -221,32 +221,32 @@ nsBlockReflowContext::ReflowBlock(const 
     nsFrame::ListTag(stdout, mOuterReflowState.frame);
     printf(": reflowing ");
     nsFrame::ListTag(stdout, mFrame);
     printf(" margin => %d, clearance => %d\n", mTopMargin.get(), aClearance);
 #endif
 
     // Adjust the available height if its constrained so that the
     // child frame doesn't think it can reflow into its margin area.
-    if (NS_UNCONSTRAINEDSIZE != aFrameRS.availableHeight) {
-      aFrameRS.availableHeight -= mTopMargin.get() + aClearance;
+    if (NS_UNCONSTRAINEDSIZE != aFrameRS.AvailableHeight()) {
+      aFrameRS.AvailableHeight() -= mTopMargin.get() + aClearance;
     }
   }
 
   nscoord tx = 0, ty = 0;
   // The values of x and y do not matter for floats, so don't bother calculating
   // them. Floats are guaranteed to have their own float manager, so tx and ty
   // don't matter.  mX and mY don't matter becacuse they are only used in
   // PlaceBlock, which is not used for floats.
   if (aLine) {
     // Compute x/y coordinate where reflow will begin. Use the rules
     // from 10.3.3 to determine what to apply. At this point in the
     // reflow auto left/right margins will have a zero value.
 
-    mX = tx = mSpace.x + aFrameRS.mComputedMargin.left;
+    mX = tx = mSpace.x + aFrameRS.ComputedPhysicalMargin().left;
     mY = ty = mSpace.y + mTopMargin.get() + aClearance;
 
     if ((mFrame->GetStateBits() & NS_BLOCK_FLOAT_MGR) == 0)
       aFrameRS.mBlockDelta = mOuterReflowState.mBlockDelta + ty - aLine->mBounds.y;
   }
 
   // Let frame know that we are reflowing it
   mFrame->WillReflow(mPresContext);
@@ -316,17 +316,17 @@ nsBlockReflowContext::PlaceBlock(const n
                                  nsCollapsingMargin&      aBottomMarginResult,
                                  nsRect&                  aInFlowBounds,
                                  nsOverflowAreas&         aOverflowAreas,
                                  nsReflowStatus           aReflowStatus)
 {
   // Compute collapsed bottom margin value.
   if (NS_FRAME_IS_COMPLETE(aReflowStatus)) {
     aBottomMarginResult = mMetrics.mCarriedOutBottomMargin;
-    aBottomMarginResult.Include(aReflowState.mComputedMargin.bottom);
+    aBottomMarginResult.Include(aReflowState.ComputedPhysicalMargin().bottom);
   } else {
     // The used bottom-margin is set to zero above a break.
     aBottomMarginResult.Zero();
   }
 
   nsPoint position(mX, mY);
   nscoord backupContainingBlockAdvance = 0;
 
--- a/layout/generic/nsBlockReflowState.cpp
+++ b/layout/generic/nsBlockReflowState.cpp
@@ -43,20 +43,20 @@ nsBlockReflowState::nsBlockReflowState(c
     mConsumedHeight(aConsumedHeight)
 {
   SetFlag(BRS_ISFIRSTINFLOW, aFrame->GetPrevInFlow() == nullptr);
   SetFlag(BRS_ISOVERFLOWCONTAINER,
           IS_TRUE_OVERFLOW_CONTAINER(aFrame));
 
   const nsMargin& borderPadding = BorderPadding();
 
-  if (aTopMarginRoot || 0 != aReflowState.mComputedBorderPadding.top) {
+  if (aTopMarginRoot || 0 != aReflowState.ComputedPhysicalBorderPadding().top) {
     SetFlag(BRS_ISTOPMARGINROOT, true);
   }
-  if (aBottomMarginRoot || 0 != aReflowState.mComputedBorderPadding.bottom) {
+  if (aBottomMarginRoot || 0 != aReflowState.ComputedPhysicalBorderPadding().bottom) {
     SetFlag(BRS_ISBOTTOMMARGINROOT, true);
   }
   if (GetFlag(BRS_ISTOPMARGINROOT)) {
     SetFlag(BRS_APPLYTOPMARGIN, true);
   }
   if (aBlockNeedsFloatManager) {
     SetFlag(BRS_FLOAT_MGR, true);
   }
@@ -82,21 +82,21 @@ nsBlockReflowState::nsBlockReflowState(c
   mContentArea.width = aReflowState.ComputedWidth();
 
   // Compute content area height. Unlike the width, if we have a
   // specified style height we ignore it since extra content is
   // managed by the "overflow" property. When we don't have a
   // specified style height then we may end up limiting our height if
   // the availableHeight is constrained (this situation occurs when we
   // are paginated).
-  if (NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight) {
+  if (NS_UNCONSTRAINEDSIZE != aReflowState.AvailableHeight()) {
     // We are in a paginated situation. The bottom edge is just inside
     // the bottom border and padding. The content area height doesn't
     // include either border or padding edge.
-    mBottomEdge = aReflowState.availableHeight - borderPadding.bottom;
+    mBottomEdge = aReflowState.AvailableHeight() - borderPadding.bottom;
     mContentArea.height = std::max(0, mBottomEdge - borderPadding.top);
   }
   else {
     // When we are not in a paginated situation then we always use
     // an constrained height.
     SetFlag(BRS_UNCONSTRAINEDHEIGHT, true);
     mContentArea.height = mBottomEdge = NS_UNCONSTRAINEDSIZE;
   }
@@ -137,17 +137,17 @@ nsBlockReflowState::ComputeReplacedBlock
   nscoord leftOffset, rightOffset;
   if (aFloatAvailableSpace.width == mContentArea.width) {
     // We don't need to compute margins when there are no floats around.
     leftOffset = 0;
     rightOffset = 0;
   } else {
     nsMargin frameMargin;
     nsCSSOffsetState os(aFrame, mReflowState.rendContext, mContentArea.width);
-    frameMargin = os.mComputedMargin;
+    frameMargin = os.ComputedPhysicalMargin();
 
     nscoord leftFloatXOffset = aFloatAvailableSpace.x - mContentArea.x;
     leftOffset = std::max(leftFloatXOffset, frameMargin.left) -
                  frameMargin.left;
     leftOffset = std::max(leftOffset, 0); // in case of negative margin
     nscoord rightFloatXOffset =
       mContentArea.XMost() - aFloatAvailableSpace.XMost();
     rightOffset = std::max(rightFloatXOffset, frameMargin.right) -
@@ -170,17 +170,17 @@ nsBlockReflowState::ComputeBlockAvailSpa
 {
 #ifdef REALLY_NOISY_REFLOW
   printf("CBAS frame=%p has floats %d\n",
          aFrame, aFloatAvailableSpace.mHasFloats);
 #endif
   aResult.y = mY;
   aResult.height = GetFlag(BRS_UNCONSTRAINEDHEIGHT)
     ? NS_UNCONSTRAINEDSIZE
-    : mReflowState.availableHeight - mY;
+    : mReflowState.AvailableHeight() - mY;
   // mY might be greater than mBottomEdge if the block's top margin pushes
   // it off the page/column. Negative available height can confuse other code
   // and is nonsense in principle.
 
   // XXX Do we really want this condition to be this restrictive (i.e.,
   // more restrictive than it used to be)?  The |else| here is allowed
   // by the CSS spec, but only out of desperation given implementations,
   // and the behavior it leads to is quite undesirable (it can cause
@@ -563,27 +563,27 @@ FloatMarginWidth(const nsHTMLReflowState
                  const nsCSSOffsetState& aFloatOffsetState)
 {
   AutoMaybeDisableFontInflation an(aFloat);
   return aFloat->ComputeSize(
     aCBReflowState.rendContext,
     nsSize(aCBReflowState.ComputedWidth(),
            aCBReflowState.ComputedHeight()),
     aFloatAvailableWidth,
-    nsSize(aFloatOffsetState.mComputedMargin.LeftRight(),
-           aFloatOffsetState.mComputedMargin.TopBottom()),
-    nsSize(aFloatOffsetState.mComputedBorderPadding.LeftRight() -
-             aFloatOffsetState.mComputedPadding.LeftRight(),
-           aFloatOffsetState.mComputedBorderPadding.TopBottom() -
-             aFloatOffsetState.mComputedPadding.TopBottom()),
-    nsSize(aFloatOffsetState.mComputedPadding.LeftRight(),
-           aFloatOffsetState.mComputedPadding.TopBottom()),
+    nsSize(aFloatOffsetState.ComputedPhysicalMargin().LeftRight(),
+           aFloatOffsetState.ComputedPhysicalMargin().TopBottom()),
+    nsSize(aFloatOffsetState.ComputedPhysicalBorderPadding().LeftRight() -
+             aFloatOffsetState.ComputedPhysicalPadding().LeftRight(),
+           aFloatOffsetState.ComputedPhysicalBorderPadding().TopBottom() -
+             aFloatOffsetState.ComputedPhysicalPadding().TopBottom()),
+    nsSize(aFloatOffsetState.ComputedPhysicalPadding().LeftRight(),
+           aFloatOffsetState.ComputedPhysicalPadding().TopBottom()),
     true).width +
-  aFloatOffsetState.mComputedMargin.LeftRight() +
-  aFloatOffsetState.mComputedBorderPadding.LeftRight();
+  aFloatOffsetState.ComputedPhysicalMargin().LeftRight() +
+  aFloatOffsetState.ComputedPhysicalBorderPadding().LeftRight();
 }
 
 bool
 nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
 {
   // Save away the Y coordinate before placing the float. We will
   // restore mY at the end after placing the float. This is
   // necessary because any adjustments to mY during the float
@@ -654,17 +654,17 @@ nsBlockReflowState::FlowAndPlaceFloat(ns
 
   // Are we required to place at least part of the float because we're
   // at the top of the page (to avoid an infinite loop of pushing and
   // breaking).
   bool mustPlaceFloat =
     mReflowState.mFlags.mIsTopOfPage && IsAdjacentWithTop();
 
   for (;;) {
-    if (mReflowState.availableHeight != NS_UNCONSTRAINEDSIZE &&
+    if (mReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE &&
         floatAvailableSpace.mRect.height <= 0 &&
         !mustPlaceFloat) {
       // No space, nowhere to put anything.
       PushFloatPastBreak(aFloat);
       return false;
     }
 
     if (CanPlaceFloat(floatMarginWidth, floatAvailableSpace)) {
@@ -982,17 +982,17 @@ nsBlockReflowState::ClearFloats(nscoord 
           mContentArea.width) {
         break;
       }
       // See the analogous code for inlines in nsBlockFrame::DoReflowInlineFrames
       if (floatAvailableSpace.mRect.height > 0) {
         // See if there's room in the next band.
         newY += floatAvailableSpace.mRect.height;
       } else {
-        if (mReflowState.availableHeight != NS_UNCONSTRAINEDSIZE) {
+        if (mReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE) {
           // Stop trying to clear here; we'll just get pushed to the
           // next column or page and try again there.
           break;
         }
         NS_NOTREACHED("avail space rect with zero height!");
         newY += 1;
       }
     }
--- a/layout/generic/nsBlockReflowState.h
+++ b/layout/generic/nsBlockReflowState.h
@@ -88,25 +88,25 @@ public:
   // floats indicated by aBreakType and has enough width between floats
   // (or no floats remaining) to accomodate aReplacedBlock.
   nscoord ClearFloats(nscoord aY, uint8_t aBreakType,
                       nsIFrame *aReplacedBlock = nullptr,
                       uint32_t aFlags = 0);
 
   bool IsAdjacentWithTop() const {
     return mY ==
-      ((mFlags & BRS_ISFIRSTINFLOW) ? mReflowState.mComputedBorderPadding.top : 0);
+      ((mFlags & BRS_ISFIRSTINFLOW) ? mReflowState.ComputedPhysicalBorderPadding().top : 0);
   }
 
   /**
    * Adjusts the border/padding to return 0 for the top if
    * we are not the first in flow.
    */
   nsMargin BorderPadding() const {
-    nsMargin result = mReflowState.mComputedBorderPadding;
+    nsMargin result = mReflowState.ComputedPhysicalBorderPadding();
     if (!(mFlags & BRS_ISFIRSTINFLOW)) {
       result.top = 0;
       if (mFlags & BRS_ISOVERFLOWCONTAINER) {
         result.bottom = 0;
       }
     }
     return result;
   }
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -1661,17 +1661,17 @@ nsBulletFrame::Reflow(nsPresContext* aPr
   // Get the base size
   // This will also set mSuppressPadding appropriately (via GetListItemText())
   // for the builtin counter styles with ideographic comma as suffix where the
   // default padding from ua.css is not desired.
   GetDesiredSize(aPresContext, aReflowState.rendContext, aMetrics, inflation);
 
   // Add in the border and padding; split the top/bottom between the
   // ascent and descent to make things look nice
-  const nsMargin& borderPadding = aReflowState.mComputedBorderPadding;
+  const nsMargin& borderPadding = aReflowState.ComputedPhysicalBorderPadding();
   if (!mSuppressPadding ||
       aPresContext->HasAuthorSpecifiedRules(this,
                                             NS_AUTHOR_SPECIFIED_PADDING)) {
     mPadding.top += NSToCoordRound(borderPadding.top * inflation);
     mPadding.right += NSToCoordRound(borderPadding.right * inflation);
     mPadding.bottom += NSToCoordRound(borderPadding.bottom * inflation);
     mPadding.left += NSToCoordRound(borderPadding.left * inflation);
   }
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -496,28 +496,28 @@ nsCanvasFrame::Reflow(nsPresContext*    
   if (mFrames.IsEmpty()) {
     // We have no child frame, so return an empty size
     aDesiredSize.width = aDesiredSize.height = 0;
   } else {
     nsIFrame* kidFrame = mFrames.FirstChild();
     bool kidDirty = (kidFrame->GetStateBits() & NS_FRAME_IS_DIRTY) != 0;
 
     nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,
-                                     nsSize(aReflowState.availableWidth,
-                                            aReflowState.availableHeight));
+                                     nsSize(aReflowState.AvailableWidth(),
+                                            aReflowState.AvailableHeight()));
 
     if (aReflowState.mFlags.mVResize &&
         (kidFrame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT)) {
       // Tell our kid it's being vertically resized too.  Bit of a
       // hack for framesets.
       kidReflowState.mFlags.mVResize = true;
     }
 
-    nsPoint kidPt(kidReflowState.mComputedMargin.left,
-                  kidReflowState.mComputedMargin.top);
+    nsPoint kidPt(kidReflowState.ComputedPhysicalMargin().left,
+                  kidReflowState.ComputedPhysicalMargin().top);
 
     kidReflowState.ApplyRelativePositioning(&kidPt);
 
     // Reflow the frame
     ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
                 kidPt.x, kidPt.y, 0, aStatus);
 
     // Complete the reflow and position and size the child frame
@@ -558,17 +558,17 @@ nsCanvasFrame::Reflow(nsPresContext*    
     }
     
     // Return our desired size. Normally it's what we're told, but
     // sometimes we can be given an unconstrained height (when a window
     // is sizing-to-content), and we should compute our desired height.
     aDesiredSize.width = aReflowState.ComputedWidth();
     if (aReflowState.ComputedHeight() == NS_UNCONSTRAINEDSIZE) {
       aDesiredSize.height = kidFrame->GetRect().height +
-        kidReflowState.mComputedMargin.TopBottom();
+        kidReflowState.ComputedPhysicalMargin().TopBottom();
     } else {
       aDesiredSize.height = aReflowState.ComputedHeight();
     }
 
     aDesiredSize.SetOverflowAreasToDesiredBounds();
     aDesiredSize.mOverflowAreas.UnionWith(
       kidDesiredSize.mOverflowAreas + kidPt);
   }
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -134,36 +134,36 @@ nsColumnSetFrame::SetInitialChildList(Ch
                "initial child list must have exaisRevertingctly one child");
   // Queue up the frames for the content frame
   return nsContainerFrame::SetInitialChildList(kPrincipalList, aChildList);
 }
 
 static nscoord
 GetAvailableContentWidth(const nsHTMLReflowState& aReflowState)
 {
-  if (aReflowState.availableWidth == NS_INTRINSICSIZE) {
+  if (aReflowState.AvailableWidth() == NS_INTRINSICSIZE) {
     return NS_INTRINSICSIZE;
   }
   nscoord borderPaddingWidth =
-    aReflowState.mComputedBorderPadding.left +
-    aReflowState.mComputedBorderPadding.right;
-  return std::max(0, aReflowState.availableWidth - borderPaddingWidth);
+    aReflowState.ComputedPhysicalBorderPadding().left +
+    aReflowState.ComputedPhysicalBorderPadding().right;
+  return std::max(0, aReflowState.AvailableWidth() - borderPaddingWidth);
 }
 
 nscoord
 nsColumnSetFrame::GetAvailableContentHeight(const nsHTMLReflowState& aReflowState)
 {
-  if (aReflowState.availableHeight == NS_INTRINSICSIZE) {
+  if (aReflowState.AvailableHeight() == NS_INTRINSICSIZE) {
     return NS_INTRINSICSIZE;
   }
 
-  nsMargin bp = aReflowState.mComputedBorderPadding;
+  nsMargin bp = aReflowState.ComputedPhysicalBorderPadding();
   ApplySkipSides(bp, &aReflowState);
-  bp.bottom = aReflowState.mComputedBorderPadding.bottom;
-  return std::max(0, aReflowState.availableHeight - bp.TopBottom());
+  bp.bottom = aReflowState.ComputedPhysicalBorderPadding().bottom;
+  return std::max(0, aReflowState.AvailableHeight() - bp.TopBottom());
 }
 
 static nscoord
 GetColumnGap(nsColumnSetFrame*    aFrame,
              const nsStyleColumn* aColStyle)
 {
   if (eStyleUnit_Normal == aColStyle->mColumnGap.GetUnit())
     return aFrame->StyleFont()->mFont.size;
@@ -199,18 +199,18 @@ nsColumnSetFrame::ChooseColumnStrategy(c
   // of the column set frame. This should be the same as the computed height
   // if we have an unconstrained available height.
   nscoord computedHeight = GetEffectiveComputedHeight(aReflowState,
                                                       consumedHeight);
   nscoord colHeight = GetAvailableContentHeight(aReflowState);
 
   if (aReflowState.ComputedHeight() != NS_INTRINSICSIZE) {
     colHeight = aReflowState.ComputedHeight();
-  } else if (aReflowState.mComputedMaxHeight != NS_INTRINSICSIZE) {
-    colHeight = std::min(colHeight, aReflowState.mComputedMaxHeight);
+  } else if (aReflowState.ComputedMaxHeight() != NS_INTRINSICSIZE) {
+    colHeight = std::min(colHeight, aReflowState.ComputedMaxHeight());
   }
 
   nscoord colGap = GetColumnGap(this, colStyle);
   int32_t numColumns = colStyle->mColumnCount;
 
   // If column-fill is set to 'balance', then we want to balance the columns.
   const bool isBalancing = colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE
                            && !aForceAuto;
@@ -450,30 +450,30 @@ nsColumnSetFrame::ReflowChildren(nsHTMLR
     // We need a way to do an incremental reflow and be sure availableHeight
     // changes are taken account of! Right now I think block frames with absolute
     // children might exit early.
     //NS_ASSERTION(aKidReason != eReflowReason_Incremental,
     //             "incremental reflow should not have changed the balance height");
   }
 
   // get our border and padding
-  nsMargin borderPadding = aReflowState.mComputedBorderPadding;
+  nsMargin borderPadding = aReflowState.ComputedPhysicalBorderPadding();
   ApplySkipSides(borderPadding, &aReflowState);
   
   nsRect contentRect(0, 0, 0, 0);
   nsOverflowAreas overflowRects;
 
   nsIFrame* child = mFrames.FirstChild();
   nsPoint childOrigin = nsPoint(borderPadding.left, borderPadding.top);
   // For RTL, figure out where the last column's left edge should be. Since the
   // columns might not fill the frame exactly, we need to account for the
   // slop. Otherwise we'll waste time moving the columns by some tiny
   // amount unnecessarily.
   if (RTL) {
-    nscoord availWidth = aReflowState.availableWidth;
+    nscoord availWidth = aReflowState.AvailableWidth();
     if (aReflowState.ComputedWidth() != NS_INTRINSICSIZE) {
       availWidth = aReflowState.ComputedWidth();
     }
     if (availWidth != NS_INTRINSICSIZE) {
       childOrigin.x += availWidth - aConfig.mColWidth;
 #ifdef DEBUG_roc
       printf("*** childOrigin.x = %d\n", childOrigin.x);
 #endif
@@ -569,18 +569,18 @@ nsColumnSetFrame::ReflowChildren(nsHTMLR
       // previous block to figure out the region of floats from the
       // previous column that extend into this column, and subtract
       // that region from the new float manager.  So you could stick a
       // really big float in the first column and text in following
       // columns would flow around it.
 
       // Reflow the frame
       ReflowChild(child, PresContext(), kidDesiredSize, kidReflowState,
-                  childOrigin.x + kidReflowState.mComputedMargin.left,
-                  childOrigin.y + kidReflowState.mComputedMargin.top,
+                  childOrigin.x + kidReflowState.ComputedPhysicalMargin().left,
+                  childOrigin.y + kidReflowState.ComputedPhysicalMargin().top,
                   0, aStatus);
 
       reflowNext = (aStatus & NS_FRAME_REFLOW_NEXTINFLOW) != 0;
     
 #ifdef DEBUG_roc
       printf("*** Reflowed child #%d %p: status = %d, desiredSize=%d,%d CarriedOutBottomMargin=%d\n",
              columnCount, (void*)child, aStatus, kidDesiredSize.width, kidDesiredSize.height,
              kidDesiredSize.mCarriedOutBottomMargin.get());
@@ -647,17 +647,17 @@ nsColumnSetFrame::ReflowChildren(nsHTMLR
         }
       }
       else if (kidNextInFlow->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER) {
         aStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
         reflowNext = true;
         kidNextInFlow->RemoveStateBits(NS_FRAME_IS_OVERFLOW_CONTAINER);
       }
 
-      if ((contentBottom > aReflowState.mComputedMaxHeight ||
+      if ((contentBottom > aReflowState.ComputedMaxHeight() ||
            contentBottom > aReflowState.ComputedHeight()) &&
            aConfig.mBalanceColCount < INT32_MAX) {
         // We overflowed vertically, but have not exceeded the number of
         // columns. We're going to go into overflow columns now, so balancing
         // no longer applies.
         aColData.mHasExcessHeight = true;
       }
 
@@ -723,17 +723,17 @@ nsColumnSetFrame::ReflowChildren(nsHTMLR
   
   // contentRect included the borderPadding.left,borderPadding.top of the child rects
   contentRect -= nsPoint(borderPadding.left, borderPadding.top);
   
   nsSize contentSize = nsSize(contentRect.XMost(), contentRect.YMost());
 
   // Apply computed and min/max values
   if (aConfig.mComputedHeight != NS_INTRINSICSIZE) {
-    if (aReflowState.availableHeight != NS_INTRINSICSIZE) {
+    if (aReflowState.AvailableHeight() != NS_INTRINSICSIZE) {
       contentSize.height = std::min(contentSize.height,
                                     aConfig.mComputedHeight);
     } else {
       contentSize.height = aConfig.mComputedHeight;
     }
   } else {
     // We add the "consumed" height back in so that we're applying
     // constraints to the correct height value, then subtract it again
@@ -799,19 +799,19 @@ nsColumnSetFrame::FindBestBalanceHeight(
                                         nsHTMLReflowMetrics& aDesiredSize,
                                         nsCollapsingMargin& aOutMargin,
                                         bool& aUnboundedLastColumn,
                                         bool& aRunWasFeasible,
                                         nsReflowStatus& aStatus)
 {
   bool feasible = aRunWasFeasible;
 
-  nsMargin bp = aReflowState.mComputedBorderPadding;
+  nsMargin bp = aReflowState.ComputedPhysicalBorderPadding();
   ApplySkipSides(bp);
-  bp.bottom = aReflowState.mComputedBorderPadding.bottom;
+  bp.bottom = aReflowState.ComputedPhysicalBorderPadding().bottom;
 
   nscoord availableContentHeight =
     GetAvailableContentHeight(aReflowState);
 
   // Termination of the algorithm below is guaranteed because
   // aConfig.knownFeasibleHeight - aConfig.knownInfeasibleHeight decreases in every
   // iteration.
 
@@ -999,30 +999,30 @@ nsColumnSetFrame::Reflow(nsPresContext* 
   // determine proper column height.
   if (config.mIsBalancing && !aPresContext->HasPendingInterrupt()) {
     FindBestBalanceHeight(aReflowState, aPresContext, config, colData,
                           aDesiredSize, carriedOutBottomMargin,
                           unboundedLastColumn, feasible, aStatus);
   }
 
   if (aPresContext->HasPendingInterrupt() &&
-      aReflowState.availableHeight == NS_UNCONSTRAINEDSIZE) {
+      aReflowState.AvailableHeight() == NS_UNCONSTRAINEDSIZE) {
     // In this situation, we might be lying about our reflow status, because
     // our last kid (the one that got interrupted) was incomplete.  Fix that.
     aStatus = NS_FRAME_COMPLETE;
   }
 
   FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowState, aStatus, false);
 
   aDesiredSize.mCarriedOutBottomMargin = carriedOutBottomMargin;
 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
 
   NS_ASSERTION(NS_FRAME_IS_FULLY_COMPLETE(aStatus) ||
-               aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE,
+               aReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE,
                "Column set should be complete if the available height is unconstrained");
 
   return NS_OK;
 }
 
 void
 nsColumnSetFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                    const nsRect&           aDirtyRect,
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -1141,17 +1141,17 @@ nsContainerFrame::ReflowOverflowContaine
       nsIFrame* prevInFlow = frame->GetPrevInFlow();
       NS_ASSERTION(prevInFlow,
                    "overflow container frame must have a prev-in-flow");
       NS_ASSERTION(frame->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER,
                    "overflow container frame must have overflow container bit set");
       nsRect prevRect = prevInFlow->GetRect();
 
       // Initialize reflow params
-      nsSize availSpace(prevRect.width, aReflowState.availableHeight);
+      nsSize availSpace(prevRect.width, aReflowState.AvailableHeight());
       nsHTMLReflowMetrics desiredSize;
       nsHTMLReflowState frameState(aPresContext, aReflowState,
                                    frame, availSpace);
       nsReflowStatus frameStatus;
 
       // Reflow
       rv = ReflowChild(frame, aPresContext, desiredSize, frameState,
                        prevRect.x, 0, aFlags, frameStatus, &tracker);
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -164,18 +164,18 @@ nsFirstLetterFrame::Reflow(nsPresContext
   nsresult rv = NS_OK;
 
   // Grab overflow list
   DrainOverflowFrames(aPresContext);
 
   nsIFrame* kid = mFrames.FirstChild();
 
   // Setup reflow state for our child
-  nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight);
-  const nsMargin& bp = aReflowState.mComputedBorderPadding;
+  nsSize availSize(aReflowState.AvailableWidth(), aReflowState.AvailableHeight());
+  const nsMargin& bp = aReflowState.ComputedPhysicalBorderPadding();
   nscoord lr = bp.left + bp.right;
   nscoord tb = bp.top + bp.bottom;
   NS_ASSERTION(availSize.width != NS_UNCONSTRAINEDSIZE,
                "should no longer use unconstrained widths");
   availSize.width -= lr;
   if (NS_UNCONSTRAINEDSIZE != availSize.height) {
     availSize.height -= tb;
   }
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -781,33 +781,33 @@ nsFlexContainerFrame::GenerateFlexItemFo
   float flexShrink = stylePos->mFlexShrink;
 
   // MAIN SIZES (flex base size, min/max size)
   // -----------------------------------------
   nscoord flexBaseSize = GET_MAIN_COMPONENT(aAxisTracker,
                                             childRS.ComputedWidth(),
                                             childRS.ComputedHeight());
   nscoord mainMinSize = GET_MAIN_COMPONENT(aAxisTracker,
-                                           childRS.mComputedMinWidth,
-                                           childRS.mComputedMinHeight);
+                                           childRS.ComputedMinWidth(),
+                                           childRS.ComputedMinHeight());
   nscoord mainMaxSize = GET_MAIN_COMPONENT(aAxisTracker,
-                                           childRS.mComputedMaxWidth,
-                                           childRS.mComputedMaxHeight);
+                                           childRS.ComputedMaxWidth(),
+                                           childRS.ComputedMaxHeight());
   // This is enforced by the nsHTMLReflowState where these values come from:
   MOZ_ASSERT(mainMinSize <= mainMaxSize, "min size is larger than max size");
 
   // CROSS MIN/MAX SIZE
   // ------------------
 
   nscoord crossMinSize = GET_CROSS_COMPONENT(aAxisTracker,
-                                             childRS.mComputedMinWidth,
-                                             childRS.mComputedMinHeight);
+                                             childRS.ComputedMinWidth(),
+                                             childRS.ComputedMinHeight());
   nscoord crossMaxSize = GET_CROSS_COMPONENT(aAxisTracker,
-                                             childRS.mComputedMaxWidth,
-                                             childRS.mComputedMaxHeight);
+                                             childRS.ComputedMaxWidth(),
+                                             childRS.ComputedMaxHeight());
 
   // SPECIAL-CASE FOR WIDGET-IMPOSED SIZES
   // Check if we're a themed widget, in which case we might have a minimum
   // main & cross size imposed by our widget (which we can't go below), or
   // (more severe) our widget might have only a single valid size.
   bool isFixedSizeWidget = false;
   const nsStyleDisplay* disp = aChildFrame->StyleDisplay();
   if (aChildFrame->IsThemed(disp)) {
@@ -822,19 +822,19 @@ nsFlexContainerFrame::GenerateFlexItemFo
       aPresContext->DevPixelsToAppUnits(
         aAxisTracker.GetMainComponent(widgetMinSize));
     nscoord widgetCrossMinSize =
       aPresContext->DevPixelsToAppUnits(
         aAxisTracker.GetCrossComponent(widgetMinSize));
 
     // GMWS() returns border-box; we need content-box
     widgetMainMinSize -=
-      aAxisTracker.GetMarginSizeInMainAxis(childRS.mComputedBorderPadding);
+      aAxisTracker.GetMarginSizeInMainAxis(childRS.ComputedPhysicalBorderPadding());
     widgetCrossMinSize -=
-      aAxisTracker.GetMarginSizeInCrossAxis(childRS.mComputedBorderPadding);
+      aAxisTracker.GetMarginSizeInCrossAxis(childRS.ComputedPhysicalBorderPadding());
 
     if (!canOverride) {
       // Fixed-size widget: freeze our main-size at the widget's mandated size.
       // (Set min and max main-sizes to that size, too, to keep us from
       // clamping to any other size later on.)
       flexBaseSize = mainMinSize = mainMaxSize = widgetMainMinSize;
       crossMinSize = crossMaxSize = widgetCrossMinSize;
       isFixedSizeWidget = true;
@@ -849,18 +849,18 @@ nsFlexContainerFrame::GenerateFlexItemFo
     }
   }
 
   // Construct the flex item!
   FlexItem item(aChildFrame,
                 flexGrow, flexShrink, flexBaseSize,
                 mainMinSize, mainMaxSize,
                 crossMinSize, crossMaxSize,
-                childRS.mComputedMargin,
-                childRS.mComputedBorderPadding,
+                childRS.ComputedPhysicalMargin(),
+                childRS.ComputedPhysicalBorderPadding(),
                 aAxisTracker);
 
   // If we're inflexible, we can just freeze to our hypothetical main-size
   // up-front. Similarly, if we're a fixed-size widget, we only have one
   // valid size, so we freeze to keep ourselves from flexing.
   if (isFixedSizeWidget || (flexGrow == 0.0f && flexShrink == 0.0f)) {
     item.Freeze();
   }
@@ -943,17 +943,17 @@ nsFlexContainerFrame::
   rv = FinishReflowChild(aFlexItem.Frame(), aPresContext,
                          &childRSForMeasuringHeight, childDesiredSize,
                          0, 0, flags);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Subtract border/padding in vertical axis, to get _just_
   // the effective computed value of the "height" property.
   nscoord childDesiredHeight = childDesiredSize.height -
-    childRSForMeasuringHeight.mComputedBorderPadding.TopBottom();
+    childRSForMeasuringHeight.ComputedPhysicalBorderPadding().TopBottom();
   childDesiredHeight = std::max(0, childDesiredHeight);
 
   aFlexItem.SetFlexBaseSizeAndMainSize(childDesiredHeight);
   aFlexItem.SetHadMeasuringReflow();
 
   return NS_OK;
 }
 
@@ -2178,18 +2178,18 @@ nsFlexContainerFrame::GenerateFlexLines(
     wrapThreshold = aContentBoxMainSize;
 
     // If the flex container doesn't have a definite content-box main-size
     // (e.g. if we're 'height:auto'), make sure we at least wrap when we hit
     // its max main-size.
     if (wrapThreshold == NS_UNCONSTRAINEDSIZE) {
       const nscoord flexContainerMaxMainSize =
         GET_MAIN_COMPONENT(aAxisTracker,
-                           aReflowState.mComputedMaxWidth,
-                           aReflowState.mComputedMaxHeight);
+                           aReflowState.ComputedMaxWidth(),
+                           aReflowState.ComputedMaxHeight());
 
       wrapThreshold = flexContainerMaxMainSize;
     }
 
     // Also: if we're vertical and paginating, we may need to wrap sooner
     // (before we run off the end of the page)
     if (!IsAxisHorizontal(aAxisTracker.GetMainAxis()) &&
         aAvailableHeightForContent != NS_UNCONSTRAINEDSIZE) {
@@ -2331,18 +2331,18 @@ ClampFlexContainerMainSize(const nsHTMLR
   }
 
   // Vertical case, with auto-height:
   // Resolve auto-height to the largest FlexLine-length, clamped to our
   // computed min/max main-size properties (min-height & max-height).
   // XXXdholbert Handle constrained-aAvailableHeightForContent case here.
   nscoord largestLineOuterSize = GetLargestLineMainSize(aLines);
   return NS_CSS_MINMAX(largestLineOuterSize,
-                       aReflowState.mComputedMinHeight,
-                       aReflowState.mComputedMaxHeight);
+                       aReflowState.ComputedMinHeight(),
+                       aReflowState.ComputedMaxHeight());
 }
 
 // Returns the sum of the cross sizes of all the lines in |aLines|
 static nscoord
 SumLineCrossSizes(const nsTArray<FlexLine>& aLines)
 {
   nscoord sum = 0;
   for (uint32_t lineIdx = 0; lineIdx < aLines.Length(); lineIdx++) {
@@ -2396,18 +2396,18 @@ nsFlexContainerFrame::ComputeCrossSize(c
     return std::min(effectiveComputedHeight, sumOfLineCrossSizes);
   }
 
   // Cross axis is vertical and we have auto-height: shrink-wrap our line(s),
   // subject to our min-size / max-size constraints in that (vertical) axis.
   // XXXdholbert Handle constrained-aAvailableHeightForContent case here.
   *aIsDefinite = false;
   return NS_CSS_MINMAX(SumLineCrossSizes(aLines),
-                       aReflowState.mComputedMinHeight,
-                       aReflowState.mComputedMaxHeight);
+                       aReflowState.ComputedMinHeight(),
+                       aReflowState.ComputedMaxHeight());
 }
 
 void
 FlexLine::PositionItemsInMainAxis(uint8_t aJustifyContent,
                                   nscoord aContentBoxMainSize,
                                   const FlexboxAxisTracker& aAxisTracker)
 {
   MainAxisPositionTracker mainAxisPosnTracker(aAxisTracker, mItems,
@@ -2624,20 +2624,20 @@ nsFlexContainerFrame::Reflow(nsPresConte
 
   nscoord contentBoxMainSize = GetMainSizeFromReflowState(aReflowState,
                                                           axisTracker);
 
   // If we're being fragmented into a constrained height, subtract off
   // borderpadding-top from it, to get the available height for our
   // content box. (Don't subtract if we're skipping top border/padding,
   // though.)
-  nscoord availableHeightForContent = aReflowState.availableHeight;
+  nscoord availableHeightForContent = aReflowState.AvailableHeight();
   if (availableHeightForContent != NS_UNCONSTRAINEDSIZE &&
       !(GetSkipSides() & (1 << NS_SIDE_TOP))) {
-    availableHeightForContent -= aReflowState.mComputedBorderPadding.top;
+    availableHeightForContent -= aReflowState.ComputedPhysicalBorderPadding().top;
     // (Don't let that push availableHeightForContent below zero, though):
     availableHeightForContent = std::max(availableHeightForContent, 0);
   }
 
   // Generate an array of our flex items (already sorted), in a FlexLine.
   nsAutoTArray<FlexLine, 1> lines;
   nsresult rv = GenerateFlexLines(aPresContext, aReflowState,
                                   contentBoxMainSize, availableHeightForContent,
@@ -2712,17 +2712,17 @@ nsFlexContainerFrame::Reflow(nsPresConte
     // offset, to get the baseline offset with respect to the *container's*
     // cross-start edge.
     nscoord firstLineBaselineOffsetWRTContainer =
       firstLineBaselineOffset + crossAxisPosnTracker.GetPosition();
 
     // The container's ascent is that ^ offset, converted out of logical coords
     // (into distance from top of content-box), plus the top border/padding
     // (since ascent is measured with respect to the top of the border-box).
-    flexContainerAscent = aReflowState.mComputedBorderPadding.top +
+    flexContainerAscent = aReflowState.ComputedPhysicalBorderPadding().top +
       PhysicalPosFromLogicalPos(firstLineBaselineOffsetWRTContainer,
                                 contentBoxCrossSize,
                                 axisTracker.GetCrossAxis());
   }
 
   for (uint32_t lineIdx = 0; lineIdx < lines.Length(); ++lineIdx) {
     FlexLine& line = lines[lineIdx];
 
@@ -2738,17 +2738,17 @@ nsFlexContainerFrame::Reflow(nsPresConte
                                   axisTracker);
     crossAxisPosnTracker.TraverseLine(line);
     crossAxisPosnTracker.TraversePackingSpace();
   }
 
   // Before giving each child a final reflow, calculate the origin of the
   // flex container's content box (with respect to its border-box), so that
   // we can compute our flex item's final positions.
-  nsMargin containerBorderPadding(aReflowState.mComputedBorderPadding);
+  nsMargin containerBorderPadding(aReflowState.ComputedPhysicalBorderPadding());
   ApplySkipSides(containerBorderPadding, &aReflowState);
   const nsPoint containerContentBoxOrigin(containerBorderPadding.left,
                                           containerBorderPadding.top);
 
   // FINAL REFLOW: Give each child frame another chance to reflow, now that
   // we know its final size and position.
   for (uint32_t lineIdx = 0; lineIdx < lines.Length(); ++lineIdx) {
     FlexLine& line = lines[lineIdx];
@@ -2888,23 +2888,23 @@ nsFlexContainerFrame::Reflow(nsPresConte
   // we stay complete to avoid looping forever)).
   // NOTE: If we're auto-height, we allow our bottom border/padding to push us
   // over the available height without requesting a continuation, for
   // consistency with the behavior of "display:block" elements.
   if (NS_FRAME_IS_COMPLETE(aStatus)) {
     // NOTE: We can't use containerBorderPadding.bottom for this, because if
     // we're auto-height, ApplySkipSides will have zeroed it (because it
     // assumed we might get a continuation). We have the correct value in
-    // aReflowState.mComputedBorderPadding.bottom, though, so we use that.
+    // aReflowState.ComputedPhyiscalBorderPadding().bottom, though, so we use that.
     nscoord desiredHeightWithBottomBP =
-      aDesiredSize.height + aReflowState.mComputedBorderPadding.bottom;
-
-    if (aReflowState.availableHeight == NS_UNCONSTRAINEDSIZE ||
+      aDesiredSize.height + aReflowState.ComputedPhysicalBorderPadding().bottom;
+
+    if (aReflowState.AvailableHeight() == NS_UNCONSTRAINEDSIZE ||
         aDesiredSize.height == 0 ||
-        desiredHeightWithBottomBP <= aReflowState.availableHeight ||
+        desiredHeightWithBottomBP <= aReflowState.AvailableHeight() ||
         aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {
       // Update desired height to include bottom border/padding
       aDesiredSize.height = desiredHeightWithBottomBP;
     } else {
       // We couldn't fit bottom border/padding, so we'll need a continuation.
       NS_FRAME_SET_INCOMPLETE(aStatus);
     }
   }
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4176,17 +4176,17 @@ nsFrame::ReflowAbsoluteFrames(nsPresCont
   if (HasAbsolutelyPositionedChildren()) {
     nsAbsoluteContainingBlock* absoluteContainer = GetAbsoluteContainingBlock();
 
     // Let the absolutely positioned container reflow any absolutely positioned
     // child frames that need to be reflowed
 
     // The containing block for the abs pos kids is formed by our padding edge.
     nsMargin computedBorder =
-      aReflowState.mComputedBorderPadding - aReflowState.mComputedPadding;
+      aReflowState.ComputedPhysicalBorderPadding() - aReflowState.ComputedPhysicalPadding();
     nscoord containingBlockWidth =
       aDesiredSize.width - computedBorder.LeftRight();
     nscoord containingBlockHeight =
       aDesiredSize.height - computedBorder.TopBottom();
 
     nsContainerFrame* container = do_QueryFrame(this);
     NS_ASSERTION(container, "Abs-pos children only supported on container frames for now");
 
@@ -7803,22 +7803,22 @@ nsFrame::BoxReflow(nsBoxLayoutState&    
     parentFrame->RemoveStateBits(~nsFrameState(0));
     parentFrame->AddStateBits(savedState);
 
     // This may not do very much useful, but it's probably worth trying.
     if (parentSize.width != NS_INTRINSICSIZE)
       parentReflowState.SetComputedWidth(std::max(parentSize.width, 0));
     if (parentSize.height != NS_INTRINSICSIZE)
       parentReflowState.SetComputedHeight(std::max(parentSize.height, 0));
-    parentReflowState.mComputedMargin.SizeTo(0, 0, 0, 0);
+    parentReflowState.ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
     // XXX use box methods
-    parentFrame->GetPadding(parentReflowState.mComputedPadding);
-    parentFrame->GetBorder(parentReflowState.mComputedBorderPadding);
-    parentReflowState.mComputedBorderPadding +=
-      parentReflowState.mComputedPadding;
+    parentFrame->GetPadding(parentReflowState.ComputedPhysicalPadding());
+    parentFrame->GetBorder(parentReflowState.ComputedPhysicalBorderPadding());
+    parentReflowState.ComputedPhysicalBorderPadding() +=
+      parentReflowState.ComputedPhysicalPadding();
 
     // Construct the parent chain manually since constructing it normally
     // messes up dimensions.
     const nsHTMLReflowState *outerReflowState = aState.OuterReflowState();
     NS_ASSERTION(!outerReflowState || outerReflowState->frame != this,
                  "in and out of XUL on a single frame?");
     const nsHTMLReflowState* parentRS;
     if (outerReflowState && outerReflowState->frame == parentFrame) {
@@ -7845,43 +7845,43 @@ nsFrame::BoxReflow(nsBoxLayoutState&    
     reflowState.mCBReflowState = parentRS;
 
     reflowState.mReflowDepth = aState.GetReflowDepth();
 
     // mComputedWidth and mComputedHeight are content-box, not
     // border-box
     if (aWidth != NS_INTRINSICSIZE) {
       nscoord computedWidth =
-        aWidth - reflowState.mComputedBorderPadding.LeftRight();
+        aWidth - reflowState.ComputedPhysicalBorderPadding().LeftRight();
       computedWidth = std::max(computedWidth, 0);
       reflowState.SetComputedWidth(computedWidth);
     }
 
     // Most child frames of box frames (e.g. subdocument or scroll frames)
     // need to be constrained to the provided size and overflow as necessary.
     // The one exception are block frames, because we need to know their
     // natural height excluding any overflow area which may be caused by
     // various CSS effects such as shadow or outline.
     if (!IsFrameOfType(eBlockFrame)) {
       if (aHeight != NS_INTRINSICSIZE) {
         nscoord computedHeight =
-          aHeight - reflowState.mComputedBorderPadding.TopBottom();
+          aHeight - reflowState.ComputedPhysicalBorderPadding().TopBottom();
         computedHeight = std::max(computedHeight, 0);
         reflowState.SetComputedHeight(computedHeight);
       } else {
         reflowState.SetComputedHeight(
           ComputeSize(aRenderingContext, availSize, availSize.width,
-                      nsSize(reflowState.mComputedMargin.LeftRight(),
-                             reflowState.mComputedMargin.TopBottom()),
-                      nsSize(reflowState.mComputedBorderPadding.LeftRight() -
-                               reflowState.mComputedPadding.LeftRight(),
-                             reflowState.mComputedBorderPadding.TopBottom() -
-                               reflowState.mComputedPadding.TopBottom()),
-                      nsSize(reflowState.mComputedPadding.LeftRight(),
-                               reflowState.mComputedPadding.TopBottom()),
+                      nsSize(reflowState.ComputedPhysicalMargin().LeftRight(),
+                             reflowState.ComputedPhysicalMargin().TopBottom()),
+                      nsSize(reflowState.ComputedPhysicalBorderPadding().LeftRight() -
+                               reflowState.ComputedPhysicalPadding().LeftRight(),
+                             reflowState.ComputedPhysicalBorderPadding().TopBottom() -
+                               reflowState.ComputedPhysicalPadding().TopBottom()),
+                      nsSize(reflowState.ComputedPhysicalPadding().LeftRight(),
+                               reflowState.ComputedPhysicalPadding().TopBottom()),
                       false).height
           );
       }
     }
 
     // Box layout calls SetRect before Layout, whereas non-box layout
     // calls SetRect after Reflow.
     // XXX Perhaps we should be doing this by twiddling the rect back to
@@ -9015,18 +9015,18 @@ static void DisplayReflowEnterPrint(nsPr
                                     bool                     aChanged)
 {
   if (aTreeNode.mDisplay) {
     DR_state->DisplayFrameTypeInfo(aFrame, aTreeNode.mIndent);
 
     char width[16];
     char height[16];
 
-    DR_state->PrettyUC(aReflowState.availableWidth, width);
-    DR_state->PrettyUC(aReflowState.availableHeight, height);
+    DR_state->PrettyUC(aReflowState.AvailableWidth(), width);
+    DR_state->PrettyUC(aReflowState.AvailableHeight(), height);
     printf("Reflow a=%s,%s ", width, height);
 
     DR_state->PrettyUC(aReflowState.ComputedWidth(), width);
     DR_state->PrettyUC(aReflowState.ComputedHeight(), height);
     printf("c=%s,%s ", width, height);
 
     if (aFrame->GetStateBits() & NS_FRAME_IS_DIRTY)
       printf("dirty ");
@@ -9052,18 +9052,18 @@ static void DisplayReflowEnterPrint(nsPr
       printf("nif=%p ", (void*)inFlow);
     }
     if (aChanged) 
       printf("CHANGED \n");
     else 
       printf("cnt=%d \n", DR_state->mCount);
     if (DR_state->mDisplayPixelErrors) {
       int32_t p2t = aPresContext->AppUnitsPerDevPixel();
-      CheckPixelError(aReflowState.availableWidth, p2t);
-      CheckPixelError(aReflowState.availableHeight, p2t);
+      CheckPixelError(aReflowState.AvailableWidth(), p2t);
+      CheckPixelError(aReflowState.AvailableHeight(), p2t);
       CheckPixelError(aReflowState.ComputedWidth(), p2t);
       CheckPixelError(aReflowState.ComputedHeight(), p2t);
     }
   }
 }
 
 void* nsFrame::DisplayReflowEnter(nsPresContext*          aPresContext,
                                   nsIFrame*                aFrame,
@@ -9295,18 +9295,18 @@ nsHTMLReflowState::DisplayInitConstraint
 
     char width[16];
     char height[16];
 
     DR_state->PrettyUC(aContainingBlockWidth, width);
     DR_state->PrettyUC(aContainingBlockHeight, height);
     printf(" cb=%s,%s", width, height);
 
-    DR_state->PrettyUC(aState->availableWidth, width);
-    DR_state->PrettyUC(aState->availableHeight, height);
+    DR_state->PrettyUC(aState->AvailableWidth(), width);
+    DR_state->PrettyUC(aState->AvailableHeight(), height);
     printf(" as=%s,%s", width, height);
 
     DR_state->PrintMargin("b", aBorder);
     DR_state->PrintMargin("p", aPadding);
     putchar('\n');
   }
   return treeNode;
 }
@@ -9321,25 +9321,25 @@ nsHTMLReflowState::DisplayInitConstraint
 
   if (!DR_state->mActive) return;
   if (!aValue) return;
 
   DR_FrameTreeNode* treeNode = (DR_FrameTreeNode*)aValue;
   if (treeNode->mDisplay) {
     DR_state->DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
     char cmiw[16], cw[16], cmxw[16], cmih[16], ch[16], cmxh[16];
-    DR_state->PrettyUC(aState->mComputedMinWidth, cmiw);
-    DR_state->PrettyUC(aState->mComputedWidth, cw);
-    DR_state->PrettyUC(aState->mComputedMaxWidth, cmxw);
-    DR_state->PrettyUC(aState->mComputedMinHeight, cmih);
-    DR_state->PrettyUC(aState->mComputedHeight, ch);
-    DR_state->PrettyUC(aState->mComputedMaxHeight, cmxh);
+    DR_state->PrettyUC(aState->ComputedMinWidth(), cmiw);
+    DR_state->PrettyUC(aState->ComputedWidth(), cw);
+    DR_state->PrettyUC(aState->ComputedMaxWidth(), cmxw);
+    DR_state->PrettyUC(aState->ComputedMinHeight(), cmih);
+    DR_state->PrettyUC(aState->ComputedHeight(), ch);
+    DR_state->PrettyUC(aState->ComputedMaxHeight(), cmxh);
     printf("InitConstraints= cw=(%s <= %s <= %s) ch=(%s <= %s <= %s)",
            cmiw, cw, cmxw, cmih, ch, cmxh);
-    DR_state->PrintMargin("co", &aState->mComputedOffsets);
+    DR_state->PrintMargin("co", &aState->ComputedPhysicalOffsets());
     putchar('\n');
   }
   DR_state->DeleteTreeNode(*treeNode);
 }
 
 
 /* static */ void*
 nsCSSOffsetState::DisplayInitOffsetsEnter(nsIFrame* aFrame,
@@ -9383,19 +9383,19 @@ nsCSSOffsetState::DisplayInitOffsetsExit
 
   if (!DR_state->mActive) return;
   if (!aValue) return;
 
   DR_FrameTreeNode* treeNode = (DR_FrameTreeNode*)aValue;
   if (treeNode->mDisplay) {
     DR_state->DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
     printf("InitOffsets=");
-    DR_state->PrintMargin("m", &aState->mComputedMargin);
-    DR_state->PrintMargin("p", &aState->mComputedPadding);
-    DR_state->PrintMargin("p+b", &aState->mComputedBorderPadding);
+    DR_state->PrintMargin("m", &aState->ComputedPhysicalMargin());
+    DR_state->PrintMargin("p", &aState->ComputedPhysicalPadding());
+    DR_state->PrintMargin("p+b", &aState->ComputedPhysicalBorderPadding());
     putchar('\n');
   }
   DR_state->DeleteTreeNode(*treeNode);
 }
 
 /* static */ void*
 nsHTMLReflowState::DisplayInitFrameTypeEnter(nsIFrame* aFrame,
                                              nsHTMLReflowState* aState)
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -618,18 +618,18 @@ void
 nsHTMLFramesetFrame::GetDesiredSize(nsPresContext*           aPresContext,
                                     const nsHTMLReflowState& aReflowState,
                                     nsHTMLReflowMetrics&     aDesiredSize)
 {
   nsHTMLFramesetFrame* framesetParent = do_QueryFrame(GetParent());
   if (nullptr == framesetParent) {
     if (aPresContext->IsPaginated()) {
       // XXX This needs to be changed when framesets paginate properly
-      aDesiredSize.width = aReflowState.availableWidth;
-      aDesiredSize.height = aReflowState.availableHeight;
+      aDesiredSize.width = aReflowState.AvailableWidth();
+      aDesiredSize.height = aReflowState.AvailableHeight();
     } else {
       nsRect area = aPresContext->GetVisibleArea();
 
       aDesiredSize.width = area.width;
       aDesiredSize.height= area.height;
     }
   } else {
     nsSize size;
@@ -732,18 +732,18 @@ nsHTMLFramesetFrame::ReflowPlaceChild(ns
                                       nsPresContext*           aPresContext,
                                       const nsHTMLReflowState& aReflowState,
                                       nsPoint&                 aOffset,
                                       nsSize&                  aSize,
                                       nsIntPoint*              aCellIndex)
 {
   // reflow the child
   nsHTMLReflowState reflowState(aPresContext, aReflowState, aChild, aSize);
-  reflowState.SetComputedWidth(std::max(0, aSize.width - reflowState.mComputedBorderPadding.LeftRight()));
-  reflowState.SetComputedHeight(std::max(0, aSize.height - reflowState.mComputedBorderPadding.TopBottom()));
+  reflowState.SetComputedWidth(std::max(0, aSize.width - reflowState.ComputedPhysicalBorderPadding().LeftRight()));
+  reflowState.SetComputedHeight(std::max(0, aSize.height - reflowState.ComputedPhysicalBorderPadding().TopBottom()));
   nsHTMLReflowMetrics metrics;
   metrics.width = aSize.width;
   metrics.height= aSize.height;
   nsReflowStatus status;
 
   ReflowChild(aChild, aPresContext, metrics, reflowState, aOffset.x,
               aOffset.y, 0, status);
   NS_ASSERTION(NS_FRAME_IS_COMPLETE(status), "bad status");
@@ -847,24 +847,24 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
 {
   DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
   nsIPresShell *shell = aPresContext->PresShell();
   nsStyleSet *styleSet = shell->StyleSet();
 
   mParent->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT);
 
-  //printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);
+  //printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.AvailableWidth(), aReflowState.AvailableHeight());
   // Always get the size so that the caller knows how big we are
   GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
 
-  nscoord width  = (aDesiredSize.width <= aReflowState.availableWidth)
-    ? aDesiredSize.width : aReflowState.availableWidth;
-  nscoord height = (aDesiredSize.height <= aReflowState.availableHeight)
-    ? aDesiredSize.height : aReflowState.availableHeight;
+  nscoord width  = (aDesiredSize.width <= aReflowState.AvailableWidth())
+    ? aDesiredSize.width : aReflowState.AvailableWidth();
+  nscoord height = (aDesiredSize.height <= aReflowState.AvailableHeight())
+    ? aDesiredSize.height : aReflowState.AvailableHeight();
 
   bool firstTime = (GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
   if (firstTime) {
     Preferences::RegisterCallback(FrameResizePrefCallback,
                                   kFrameResizePref, this);
     mForceFrameResizability = Preferences::GetBool(kFrameResizePref);
   }
 
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -209,28 +209,28 @@ static nsSize ComputeInsideBorderSize(Sc
                                       const nsSize& aDesiredInsideBorderSize)
 {
   // aDesiredInsideBorderSize is the frame size; i.e., it includes
   // borders and padding (but the scrolled child doesn't have
   // borders). The scrolled child has the same padding as us.
   nscoord contentWidth = aState->mReflowState.ComputedWidth();
   if (contentWidth == NS_UNCONSTRAINEDSIZE) {
     contentWidth = aDesiredInsideBorderSize.width -
-      aState->mReflowState.mComputedPadding.LeftRight();
+      aState->mReflowState.ComputedPhysicalPadding().LeftRight();
   }
   nscoord contentHeight = aState->mReflowState.ComputedHeight();
   if (contentHeight == NS_UNCONSTRAINEDSIZE) {
     contentHeight = aDesiredInsideBorderSize.height -
-      aState->mReflowState.mComputedPadding.TopBottom();
+      aState->mReflowState.ComputedPhysicalPadding().TopBottom();
   }
 
   contentWidth  = aState->mReflowState.ApplyMinMaxWidth(contentWidth);
   contentHeight = aState->mReflowState.ApplyMinMaxHeight(contentHeight);
-  return nsSize(contentWidth + aState->mReflowState.mComputedPadding.LeftRight(),
-                contentHeight + aState->mReflowState.mComputedPadding.TopBottom());
+  return nsSize(contentWidth + aState->mReflowState.ComputedPhysicalPadding().LeftRight(),
+                contentHeight + aState->mReflowState.ComputedPhysicalPadding().TopBottom());
 }
 
 static void
 GetScrollbarMetrics(nsBoxLayoutState& aState, nsIFrame* aBox, nsSize* aMin,
                     nsSize* aPref, bool aVertical)
 {
   NS_ASSERTION(aState.GetRenderingContext(),
                "Must have rendering context in layout state for size "
@@ -383,36 +383,36 @@ nsHTMLScrollFrame::TryLayout(ScrollReflo
 
 bool
 nsHTMLScrollFrame::ScrolledContentDependsOnHeight(ScrollReflowState* aState)
 {
   // Return true if ReflowScrolledFrame is going to do something different
   // based on the presence of a horizontal scrollbar.
   return (mHelper.mScrolledFrame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT) ||
     aState->mReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE ||
-    aState->mReflowState.mComputedMinHeight > 0 ||
-    aState->mReflowState.mComputedMaxHeight != NS_UNCONSTRAINEDSIZE;
+    aState->mReflowState.ComputedMinHeight() > 0 ||
+    aState->mReflowState.ComputedMaxHeight() != NS_UNCONSTRAINEDSIZE;
 }
 
 nsresult
 nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
                                        bool aAssumeHScroll,
                                        bool aAssumeVScroll,
                                        nsHTMLReflowMetrics* aMetrics,
                                        bool aFirstPass)
 {
   // these could be NS_UNCONSTRAINEDSIZE ... std::min arithmetic should
   // be OK
-  nscoord paddingLR = aState->mReflowState.mComputedPadding.LeftRight();
+  nscoord paddingLR = aState->mReflowState.ComputedPhysicalPadding().LeftRight();
 
   nscoord availWidth = aState->mReflowState.ComputedWidth() + paddingLR;
 
   nscoord computedHeight = aState->mReflowState.ComputedHeight();
-  nscoord computedMinHeight = aState->mReflowState.mComputedMinHeight;
-  nscoord computedMaxHeight = aState->mReflowState.mComputedMaxHeight;
+  nscoord computedMinHeight = aState->mReflowState.ComputedMinHeight();
+  nscoord computedMaxHeight = aState->mReflowState.ComputedMaxHeight();
   if (!ShouldPropagateComputedHeightToScrolledContent()) {
     computedHeight = NS_UNCONSTRAINEDSIZE;
     computedMinHeight = 0;
     computedMaxHeight = NS_UNCONSTRAINEDSIZE;
   }
   if (aAssumeHScroll) {
     nsSize hScrollbarPrefSize;
     GetScrollbarMetrics(aState->mBoxState, mHelper.mHScrollbarBox,
@@ -434,22 +434,22 @@ nsHTMLScrollFrame::ReflowScrolledFrame(S
   nsPresContext* presContext = PresContext();
 
   // Pass false for aInit so we can pass in the correct padding.
   nsHTMLReflowState kidReflowState(presContext, aState->mReflowState,
                                    mHelper.mScrolledFrame,
                                    nsSize(availWidth, NS_UNCONSTRAINEDSIZE),
                                    -1, -1, nsHTMLReflowState::CALLER_WILL_INIT);
   kidReflowState.Init(presContext, -1, -1, nullptr,
-                      &aState->mReflowState.mComputedPadding);
+                      &aState->mReflowState.ComputedPhysicalPadding());
   kidReflowState.mFlags.mAssumingHScrollbar = aAssumeHScroll;
   kidReflowState.mFlags.mAssumingVScrollbar = aAssumeVScroll;
   kidReflowState.SetComputedHeight(computedHeight);
-  kidReflowState.mComputedMinHeight = computedMinHeight;
-  kidReflowState.mComputedMaxHeight = computedMaxHeight;
+  kidReflowState.ComputedMinHeight() = computedMinHeight;
+  kidReflowState.ComputedMaxHeight() = computedMaxHeight;
 
   // Temporarily set mHasHorizontalScrollbar/mHasVerticalScrollbar to
   // reflect our assumptions while we reflow the child.
   bool didHaveHorizontalScrollbar = mHelper.mHasHorizontalScrollbar;
   bool didHaveVerticalScrollbar = mHelper.mHasVerticalScrollbar;
   mHelper.mHasHorizontalScrollbar = aAssumeHScroll;
   mHelper.mHasVerticalScrollbar = aAssumeVScroll;
 
@@ -784,18 +784,18 @@ nsHTMLScrollFrame::Reflow(nsPresContext*
     }
   }
 
   nsRect oldScrollAreaBounds = mHelper.mScrollPort;
   nsRect oldScrolledAreaBounds =
     mHelper.mScrolledFrame->GetScrollableOverflowRectRelativeToParent();
   nsPoint oldScrollPosition = mHelper.GetScrollPosition();
 
-  state.mComputedBorder = aReflowState.mComputedBorderPadding -
-    aReflowState.mComputedPadding;
+  state.mComputedBorder = aReflowState.ComputedPhysicalBorderPadding() -
+    aReflowState.ComputedPhysicalPadding();
 
   nsresult rv = ReflowContents(&state, aDesiredSize);
   if (NS_FAILED(rv))
     return rv;
 
   // Restore the old scroll position, for now, even if that's not valid anymore
   // because we changed size. We'll fix it up in a post-reflow callback, because
   // our current size may only be temporary (e.g. we're compute XUL desired sizes).
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -175,27 +175,27 @@ nsHTMLCanvasFrame::Reflow(nsPresContext*
                           nsHTMLReflowMetrics&     aMetrics,
                           const nsHTMLReflowState& aReflowState,
                           nsReflowStatus&          aStatus)
 {
   DO_GLOBAL_REFLOW_COUNT("nsHTMLCanvasFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
   NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
                   ("enter nsHTMLCanvasFrame::Reflow: availSize=%d,%d",
-                  aReflowState.availableWidth, aReflowState.availableHeight));
+                  aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
 
   NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
 
   aStatus = NS_FRAME_COMPLETE;
 
   aMetrics.width = aReflowState.ComputedWidth();
   aMetrics.height = aReflowState.ComputedHeight();
 
   // stash this away so we can compute our inner area later
-  mBorderPadding   = aReflowState.mComputedBorderPadding;
+  mBorderPadding   = aReflowState.ComputedPhysicalBorderPadding();
 
   aMetrics.width += mBorderPadding.left + mBorderPadding.right;
   aMetrics.height += mBorderPadding.top + mBorderPadding.bottom;
 
   if (GetPrevInFlow()) {
     nscoord y = GetContinuationOffset(&aMetrics.width);
     aMetrics.height -= y + mBorderPadding.top;
     aMetrics.height = std::max(0, aMetrics.height);
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -58,18 +58,18 @@ nsHTMLReflowState::nsHTMLReflowState(nsP
   : nsCSSOffsetState(aFrame, aRenderingContext)
   , mBlockDelta(0)
   , mReflowDepth(0)
 {
   NS_PRECONDITION(aPresContext, "no pres context");
   NS_PRECONDITION(aRenderingContext, "no rendering context");
   NS_PRECONDITION(aFrame, "no frame");
   parentReflowState = nullptr;
-  mAvailableWidth = aAvailableSpace.width;
-  mAvailableHeight = aAvailableSpace.height;
+  AvailableWidth() = aAvailableSpace.width;
+  AvailableHeight() = aAvailableSpace.height;
   mFloatManager = nullptr;
   mLineLayout = nullptr;
   memset(&mFlags, 0, sizeof(mFlags));
   mDiscoveredClearance = nullptr;
   mPercentHeightObserver = nullptr;
 
   if (aFlags & DUMMY_PARENT_REFLOW_STATE) {
     mFlags.mDummyParentReflowState = true;
@@ -155,18 +155,18 @@ nsHTMLReflowState::nsHTMLReflowState(nsP
 
   // If the parent is dirty, then the child is as well.
   // XXX Are the other cases where the parent reflows a child a second
   // time, as a resize?
   if (!mFlags.mSpecialHeightReflow)
     frame->AddStateBits(parentReflowState->frame->GetStateBits() &
                         NS_FRAME_IS_DIRTY);
 
-  mAvailableWidth = aAvailableSpace.width;
-  mAvailableHeight = aAvailableSpace.height;
+  AvailableWidth() = aAvailableSpace.width;
+  AvailableHeight() = aAvailableSpace.height;
 
   mFloatManager = aParentReflowState.mFloatManager;
   if (frame->IsFrameOfType(nsIFrame::eLineParticipant))
     mLineLayout = aParentReflowState.mLineLayout;
   else
     mLineLayout = nullptr;
 
   // Note: mFlags was initialized as a copy of aParentReflowState.mFlags up in
@@ -207,44 +207,44 @@ nsCSSOffsetState::ComputeWidthValue(nsco
                                           aCoord);
 }
 
 nscoord
 nsCSSOffsetState::ComputeWidthValue(nscoord aContainingBlockWidth,
                                     uint8_t aBoxSizing,
                                     const nsStyleCoord& aCoord)
 {
-  nscoord inside = 0, outside = mComputedBorderPadding.LeftRight() +
-                                mComputedMargin.LeftRight();
+  nscoord inside = 0, outside = ComputedPhysicalBorderPadding().LeftRight() +
+                                ComputedPhysicalMargin().LeftRight();
   switch (aBoxSizing) {
     case NS_STYLE_BOX_SIZING_BORDER:
-      inside = mComputedBorderPadding.LeftRight();
+      inside = ComputedPhysicalBorderPadding().LeftRight();
       break;
     case NS_STYLE_BOX_SIZING_PADDING:
-      inside = mComputedPadding.LeftRight();
+      inside = ComputedPhysicalPadding().LeftRight();
       break;
   }
   outside -= inside;
 
   return ComputeWidthValue(aContainingBlockWidth, inside,
                            outside, aCoord);
 }
 
 nscoord
 nsCSSOffsetState::ComputeHeightValue(nscoord aContainingBlockHeight,
                                      uint8_t aBoxSizing,
                                      const nsStyleCoord& aCoord)
 {
   nscoord inside = 0;
   switch (aBoxSizing) {
     case NS_STYLE_BOX_SIZING_BORDER:
-      inside = mComputedBorderPadding.TopBottom();
+      inside = ComputedPhysicalBorderPadding().TopBottom();
       break;
     case NS_STYLE_BOX_SIZING_PADDING:
-      inside = mComputedPadding.TopBottom();
+      inside = ComputedPhysicalPadding().TopBottom();
       break;
   }
   return nsLayoutUtils::ComputeHeightValue(aContainingBlockHeight, 
                                            inside, aCoord);
 }
 
 void
 nsHTMLReflowState::SetComputedWidth(nscoord aComputedWidth)
@@ -259,18 +259,18 @@ nsHTMLReflowState::SetComputedWidth(nsco
   //    to the munged computed width is pointless.
   // 2) nsFrame::BoxReflow creates a reflow state for its parent.  This reflow
   //    state is not used to reflow the parent, but just as a parent for the
   //    frame's own reflow state.  So given a nsBoxFrame inside some non-XUL
   //    (like a text control, for example), we'll end up creating a reflow
   //    state for the parent while the parent is reflowing.
 
   NS_PRECONDITION(aComputedWidth >= 0, "Invalid computed width");
-  if (mComputedWidth != aComputedWidth) {
-    mComputedWidth = aComputedWidth;
+  if (ComputedWidth() != aComputedWidth) {
+    ComputedWidth() = aComputedWidth;
     nsIAtom* frameType = frame->GetType();
     if (frameType != nsGkAtoms::viewportFrame) { // Or check GetParent()?
       InitResizeFlags(frame->PresContext(), frameType);
     }
   }
 }
 
 void
@@ -282,30 +282,30 @@ nsHTMLReflowState::SetComputedHeight(nsc
   //
   //    nsFrame::BoxReflow creates a reflow state for its parent.  This reflow
   //    state is not used to reflow the parent, but just as a parent for the
   //    frame's own reflow state.  So given a nsBoxFrame inside some non-XUL
   //    (like a text control, for example), we'll end up creating a reflow
   //    state for the parent while the parent is reflowing.
 
   NS_PRECONDITION(aComputedHeight >= 0, "Invalid computed height");
-  if (mComputedHeight != aComputedHeight) {
-    mComputedHeight = aComputedHeight;
+  if (ComputedHeight() != aComputedHeight) {
+    ComputedHeight() = aComputedHeight;
     InitResizeFlags(frame->PresContext(), frame->GetType());
   }
 }
 
 void
 nsHTMLReflowState::Init(nsPresContext* aPresContext,
                         nscoord         aContainingBlockWidth,
                         nscoord         aContainingBlockHeight,
                         const nsMargin* aBorder,
                         const nsMargin* aPadding)
 {
-  NS_WARN_IF_FALSE(mAvailableWidth != NS_UNCONSTRAINEDSIZE,
+  NS_WARN_IF_FALSE(AvailableWidth() != NS_UNCONSTRAINEDSIZE,
                    "have unconstrained width; this should only result from "
                    "very large sizes, not attempts at intrinsic width "
                    "calculation");
 
   mStylePosition = frame->StylePosition();
   mStyleDisplay = frame->StyleDisplay();
   mStyleVisibility = frame->StyleVisibility();
   mStyleBorder = frame->StyleBorder();
@@ -371,17 +371,17 @@ nsHTMLReflowState::Init(nsPresContext* a
     }
   } else {
     frame->RemoveStateBits(NS_FRAME_IN_CONSTRAINED_HEIGHT);
   }
 
   NS_WARN_IF_FALSE((mFrameType == NS_CSS_FRAME_TYPE_INLINE &&
                     !frame->IsFrameOfType(nsIFrame::eReplaced)) ||
                    type == nsGkAtoms::textFrame ||
-                   mComputedWidth != NS_UNCONSTRAINEDSIZE,
+                   ComputedWidth() != NS_UNCONSTRAINEDSIZE,
                    "have unconstrained width; this should only result from "
                    "very large sizes, not attempts at intrinsic width "
                    "calculation");
 }
 
 void nsHTMLReflowState::InitCBReflowState()
 {
   if (!parentReflowState) {
@@ -429,17 +429,17 @@ IsQuirkContainingBlockHeight(const nsHTM
   return true;
 }
 
 
 void
 nsHTMLReflowState::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
 {
   bool isHResize = (frame->GetSize().width !=
-                     mComputedWidth + mComputedBorderPadding.LeftRight()) ||
+                     ComputedWidth() + ComputedPhysicalBorderPadding().LeftRight()) ||
                      aPresContext->PresShell()->IsReflowOnZoomPending();
 
   if ((frame->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT) &&
       nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
     // Create our font inflation data if we don't have it already, and
     // give it our current width information.
     bool dirty = nsFontInflationData::UpdateFontInflationDataWidthFor(*this) &&
                  // Avoid running this at the box-to-block interface
@@ -538,28 +538,28 @@ nsHTMLReflowState::InitResizeFlags(nsPre
     // reflowing descendant.
     mFlags.mVResize = true;
   } else if (mCBReflowState && !nsLayoutUtils::IsNonWrapperBlock(frame)) {
     // XXX Is this problematic for relatively positioned inlines acting
     // as containing block for absolutely positioned elements?
     // Possibly; in that case we should at least be checking
     // NS_SUBTREE_DIRTY, I'd think.
     mFlags.mVResize = mCBReflowState->mFlags.mVResize;
-  } else if (mComputedHeight == NS_AUTOHEIGHT) {
+  } else if (ComputedHeight() == NS_AUTOHEIGHT) {
     if (eCompatibility_NavQuirks == aPresContext->CompatibilityMode() &&
         mCBReflowState) {
       mFlags.mVResize = mCBReflowState->mFlags.mVResize;
     } else {
       mFlags.mVResize = mFlags.mHResize;
     }
     mFlags.mVResize = mFlags.mVResize || NS_SUBTREE_DIRTY(frame);
   } else {
     // not 'auto' height
     mFlags.mVResize = frame->GetSize().height !=
-                        mComputedHeight + mComputedBorderPadding.TopBottom();
+                        ComputedHeight() + ComputedPhysicalBorderPadding().TopBottom();
   }
 
   bool dependsOnCBHeight =
     (mStylePosition->HeightDependsOnContainer() &&
      // FIXME: condition this on not-abspos?
      mStylePosition->mHeight.GetUnit() != eStyleUnit_Auto) ||
     mStylePosition->MinHeightDependsOnContainer() ||
     mStylePosition->MaxHeightDependsOnContainer() ||
@@ -640,17 +640,17 @@ nsHTMLReflowState::InitResizeFlags(nsPre
 
 /* static */
 nscoord
 nsHTMLReflowState::GetContainingBlockContentWidth(const nsHTMLReflowState* aReflowState)
 {
   const nsHTMLReflowState* rs = aReflowState->mCBReflowState;
   if (!rs)
     return 0;
-  return rs->mComputedWidth;
+  return rs->ComputedWidth();
 }
 
 void
 nsHTMLReflowState::InitFrameType(nsIAtom* aFrameType)
 {
   const nsStyleDisplay *disp = mStyleDisplay;
   nsCSSFrameType frameType;
 
@@ -910,18 +910,18 @@ nsHTMLReflowState::GetHypotheticalBoxCon
          state = state->parentReflowState) {
       /* do nothing */
     }
   } else {
     state = nullptr;
   }
   
   if (state) {
-    aCBLeftEdge = state->mComputedBorderPadding.left;
-    aCBWidth = state->mComputedWidth;
+    aCBLeftEdge = state->ComputedPhysicalBorderPadding().left;
+    aCBWidth = state->ComputedWidth();
   } else {
     /* Didn't find a reflow state for aFrame.  Just compute the information we
        want, on the assumption that aFrame already knows its size.  This really
        ought to be true by now. */
     NS_ASSERTION(!(aFrame->GetStateBits() & NS_FRAME_IN_REFLOW),
                  "aFrame shouldn't be in reflow; we'll lie if it is");
     nsMargin borderPadding = aFrame->GetUsedBorderAndPadding();
     aCBLeftEdge = borderPadding.left;
@@ -1297,17 +1297,17 @@ nsHTMLReflowState::CalculateHypothetical
   }
   aHypotheticalBox.mLeft += cbOffset.x;
   aHypotheticalBox.mTop += cbOffset.y;
   aHypotheticalBox.mRight += cbOffset.x;
   
   // The specified offsets are relative to the absolute containing block's
   // padding edge and our current values are relative to the border edge, so
   // translate.
-  nsMargin border = cbrs->mComputedBorderPadding - cbrs->mComputedPadding;
+  nsMargin border = cbrs->ComputedPhysicalBorderPadding() - cbrs->ComputedPhysicalPadding();
   aHypotheticalBox.mLeft -= border.left;
   aHypotheticalBox.mRight -= border.left;
   aHypotheticalBox.mTop -= border.top;
 }
 
 void
 nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
                                            const nsHTMLReflowState* cbrs,
@@ -1347,73 +1347,73 @@ nsHTMLReflowState::InitAbsoluteConstrain
     CalculateHypotheticalBox(aPresContext, placeholderFrame, cbFrame,
                              cbLeftEdge, cbWidth, cbrs, hypotheticalBox, aFrameType);
   }
 
   // Initialize the 'left' and 'right' computed offsets
   // XXX Handle new 'static-position' value...
   bool          leftIsAuto = false, rightIsAuto = false;
   if (eStyleUnit_Auto == mStylePosition->mOffset.GetLeftUnit()) {
-    mComputedOffsets.left = 0;
+    ComputedPhysicalOffsets().left = 0;
     leftIsAuto = true;
   } else {
-    mComputedOffsets.left = nsLayoutUtils::
+    ComputedPhysicalOffsets().left = nsLayoutUtils::
       ComputeCBDependentValue(containingBlockWidth,
                               mStylePosition->mOffset.GetLeft());
   }
   if (eStyleUnit_Auto == mStylePosition->mOffset.GetRightUnit()) {
-    mComputedOffsets.right = 0;
+    ComputedPhysicalOffsets().right = 0;
     rightIsAuto = true;
   } else {
-    mComputedOffsets.right = nsLayoutUtils::
+    ComputedPhysicalOffsets().right = nsLayoutUtils::
       ComputeCBDependentValue(containingBlockWidth,
                               mStylePosition->mOffset.GetRight());
   }
 
   // Use the horizontal component of the hypothetical box in the cases
   // where it's needed.
   if (leftIsAuto && rightIsAuto) {
     // Use the direction of the original ("static-position") containing block
     // to dictate whether 'left' or 'right' is treated like 'static-position'.
     if (NS_STYLE_DIRECTION_LTR == placeholderFrame->GetContainingBlock()
                                     ->StyleVisibility()->mDirection) {
       NS_ASSERTION(hypotheticalBox.mLeftIsExact, "should always have "
                    "exact value on containing block's start side");
-      mComputedOffsets.left = hypotheticalBox.mLeft;
+      ComputedPhysicalOffsets().left = hypotheticalBox.mLeft;
       leftIsAuto = false;
     } else {
       NS_ASSERTION(hypotheticalBox.mRightIsExact, "should always have "
                    "exact value on containing block's start side");
-      mComputedOffsets.right = containingBlockWidth - hypotheticalBox.mRight;
+      ComputedPhysicalOffsets().right = containingBlockWidth - hypotheticalBox.mRight;
       rightIsAuto = false;
     }
   }
 
   // Initialize the 'top' and 'bottom' computed offsets
   bool        topIsAuto = false, bottomIsAuto = false;
   if (eStyleUnit_Auto == mStylePosition->mOffset.GetTopUnit()) {
-    mComputedOffsets.top = 0;
+    ComputedPhysicalOffsets().top = 0;
     topIsAuto = true;
   } else {
-    mComputedOffsets.top = nsLayoutUtils::
+    ComputedPhysicalOffsets().top = nsLayoutUtils::
       ComputeHeightDependentValue(containingBlockHeight,
                                   mStylePosition->mOffset.GetTop());
   }
   if (eStyleUnit_Auto == mStylePosition->mOffset.GetBottomUnit()) {
-    mComputedOffsets.bottom = 0;        
+    ComputedPhysicalOffsets().bottom = 0;        
     bottomIsAuto = true;
   } else {
-    mComputedOffsets.bottom = nsLayoutUtils::
+    ComputedPhysicalOffsets().bottom = nsLayoutUtils::
       ComputeHeightDependentValue(containingBlockHeight,
                                   mStylePosition->mOffset.GetBottom());
   }
 
   if (topIsAuto && bottomIsAuto) {
     // Treat 'top' like 'static-position'
-    mComputedOffsets.top = hypotheticalBox.mTop;
+    ComputedPhysicalOffsets().top = hypotheticalBox.mTop;
     topIsAuto = false;
   }
 
   bool widthIsAuto = eStyleUnit_Auto == mStylePosition->mWidth.GetUnit();
   bool heightIsAuto = eStyleUnit_Auto == mStylePosition->mHeight.GetUnit();
 
   uint32_t computeSizeFlags = 0;
   if (leftIsAuto || rightIsAuto) {
@@ -1423,226 +1423,226 @@ nsHTMLReflowState::InitAbsoluteConstrain
   {
     AutoMaybeDisableFontInflation an(frame);
 
     nsSize size =
       frame->ComputeSize(rendContext,
                          nsSize(containingBlockWidth,
                                 containingBlockHeight),
                          containingBlockWidth, // XXX or mAvailableWidth?
-                         nsSize(mComputedMargin.LeftRight() +
-                                  mComputedOffsets.LeftRight(),
-                                mComputedMargin.TopBottom() +
-                                  mComputedOffsets.TopBottom()),
-                         nsSize(mComputedBorderPadding.LeftRight() -
-                                  mComputedPadding.LeftRight(),
-                                mComputedBorderPadding.TopBottom() -
-                                  mComputedPadding.TopBottom()),
-                         nsSize(mComputedPadding.LeftRight(),
-                                mComputedPadding.TopBottom()),
+                         nsSize(ComputedPhysicalMargin().LeftRight() +
+                                  ComputedPhysicalOffsets().LeftRight(),
+                                ComputedPhysicalMargin().TopBottom() +
+                                  ComputedPhysicalOffsets().TopBottom()),
+                         nsSize(ComputedPhysicalBorderPadding().LeftRight() -
+                                  ComputedPhysicalPadding().LeftRight(),
+                                ComputedPhysicalBorderPadding().TopBottom() -
+                                  ComputedPhysicalPadding().TopBottom()),
+                         nsSize(ComputedPhysicalPadding().LeftRight(),
+                                ComputedPhysicalPadding().TopBottom()),
                          computeSizeFlags);
-    mComputedWidth = size.width;
-    mComputedHeight = size.height;
+    ComputedWidth() = size.width;
+    ComputedHeight() = size.height;
   }
-  NS_ASSERTION(mComputedWidth >= 0, "Bogus width");
-  NS_ASSERTION(mComputedHeight == NS_UNCONSTRAINEDSIZE ||
-               mComputedHeight >= 0, "Bogus height");
+  NS_ASSERTION(ComputedWidth() >= 0, "Bogus width");
+  NS_ASSERTION(ComputedHeight() == NS_UNCONSTRAINEDSIZE ||
+               ComputedHeight() >= 0, "Bogus height");
 
   // XXX Now that we have ComputeSize, can we condense many of the
   // branches off of widthIsAuto?
 
   if (leftIsAuto) {
     // We know 'right' is not 'auto' anymore thanks to the hypothetical
     // box code above.
     // Solve for 'left'.
     if (widthIsAuto) {
       // XXXldb This, and the corresponding code in
       // nsAbsoluteContainingBlock.cpp, could probably go away now that
       // we always compute widths.
-      mComputedOffsets.left = NS_AUTOOFFSET;
+      ComputedPhysicalOffsets().left = NS_AUTOOFFSET;
     } else {
-      mComputedOffsets.left = containingBlockWidth - mComputedMargin.left -
-        mComputedBorderPadding.left - mComputedWidth - mComputedBorderPadding.right - 
-        mComputedMargin.right - mComputedOffsets.right;
+      ComputedPhysicalOffsets().left = containingBlockWidth - ComputedPhysicalMargin().left -
+        ComputedPhysicalBorderPadding().left - ComputedWidth() - ComputedPhysicalBorderPadding().right - 
+        ComputedPhysicalMargin().right - ComputedPhysicalOffsets().right;
 
     }
   } else if (rightIsAuto) {
     // We know 'left' is not 'auto' anymore thanks to the hypothetical
     // box code above.
     // Solve for 'right'.
     if (widthIsAuto) {
       // XXXldb This, and the corresponding code in
       // nsAbsoluteContainingBlock.cpp, could probably go away now that
       // we always compute widths.
-      mComputedOffsets.right = NS_AUTOOFFSET;
+      ComputedPhysicalOffsets().right = NS_AUTOOFFSET;
     } else {
-      mComputedOffsets.right = containingBlockWidth - mComputedOffsets.left -
-        mComputedMargin.left - mComputedBorderPadding.left - mComputedWidth -
-        mComputedBorderPadding.right - mComputedMargin.right;
+      ComputedPhysicalOffsets().right = containingBlockWidth - ComputedPhysicalOffsets().left -
+        ComputedPhysicalMargin().left - ComputedPhysicalBorderPadding().left - ComputedWidth() -
+        ComputedPhysicalBorderPadding().right - ComputedPhysicalMargin().right;
     }
   } else {
     // Neither 'left' nor 'right' is 'auto'.  However, the width might
     // still not fill all the available space (even though we didn't
     // shrink-wrap) in case:
     //  * width was specified
     //  * we're dealing with a replaced element
     //  * width was constrained by min-width or max-width.
 
     nscoord availMarginSpace = containingBlockWidth -
-                               mComputedOffsets.LeftRight() -
-                               mComputedMargin.LeftRight() -
-                               mComputedBorderPadding.LeftRight() -
-                               mComputedWidth;
+                               ComputedPhysicalOffsets().LeftRight() -
+                               ComputedPhysicalMargin().LeftRight() -
+                               ComputedPhysicalBorderPadding().LeftRight() -
+                               ComputedWidth();
     bool marginLeftIsAuto =
       eStyleUnit_Auto == mStyleMargin->mMargin.GetLeftUnit();
     bool marginRightIsAuto =
       eStyleUnit_Auto == mStyleMargin->mMargin.GetRightUnit();
 
     if (marginLeftIsAuto) {
       if (marginRightIsAuto) {
         if (availMarginSpace < 0) {
           // Note that this case is different from the neither-'auto'
           // case below, where the spec says to ignore 'left'/'right'.
           if (cbrs &&
               NS_STYLE_DIRECTION_RTL == cbrs->mStyleVisibility->mDirection) {
             // Ignore the specified value for 'margin-left'.
-            mComputedMargin.left = availMarginSpace;
+            ComputedPhysicalMargin().left = availMarginSpace;
           } else {
             // Ignore the specified value for 'margin-right'.
-            mComputedMargin.right = availMarginSpace;
+            ComputedPhysicalMargin().right = availMarginSpace;
           }
         } else {
           // Both 'margin-left' and 'margin-right' are 'auto', so they get
           // equal values
-          mComputedMargin.left = availMarginSpace / 2;
-          mComputedMargin.right = availMarginSpace - mComputedMargin.left;
+          ComputedPhysicalMargin().left = availMarginSpace / 2;
+          ComputedPhysicalMargin().right = availMarginSpace - ComputedPhysicalMargin().left;
         }
       } else {
         // Just 'margin-left' is 'auto'
-        mComputedMargin.left = availMarginSpace;
+        ComputedPhysicalMargin().left = availMarginSpace;
       }
     } else {
       if (marginRightIsAuto) {
         // Just 'margin-right' is 'auto'
-        mComputedMargin.right = availMarginSpace;
+        ComputedPhysicalMargin().right = availMarginSpace;
       } else {
         // We're over-constrained so use the direction of the containing
         // block to dictate which value to ignore.  (And note that the
         // spec says to ignore 'left' or 'right' rather than
         // 'margin-left' or 'margin-right'.)
         // Note that this case is different from the both-'auto' case
         // above, where the spec says to ignore
         // 'margin-left'/'margin-right'.
         if (cbrs &&
             NS_STYLE_DIRECTION_RTL == cbrs->mStyleVisibility->mDirection) {
           // Ignore the specified value for 'left'.
-          mComputedOffsets.left += availMarginSpace;
+          ComputedPhysicalOffsets().left += availMarginSpace;
         } else {
           // Ignore the specified value for 'right'.
-          mComputedOffsets.right += availMarginSpace;
+          ComputedPhysicalOffsets().right += availMarginSpace;
         }
       }
     }
   }
 
   if (topIsAuto) {
     // solve for 'top'
     if (heightIsAuto) {
-      mComputedOffsets.top = NS_AUTOOFFSET;
+      ComputedPhysicalOffsets().top = NS_AUTOOFFSET;
     } else {
-      mComputedOffsets.top = containingBlockHeight - mComputedMargin.top -
-        mComputedBorderPadding.top - mComputedHeight - mComputedBorderPadding.bottom - 
-        mComputedMargin.bottom - mComputedOffsets.bottom;
+      ComputedPhysicalOffsets().top = containingBlockHeight - ComputedPhysicalMargin().top -
+        ComputedPhysicalBorderPadding().top - ComputedHeight() - ComputedPhysicalBorderPadding().bottom - 
+        ComputedPhysicalMargin().bottom - ComputedPhysicalOffsets().bottom;
     }
   } else if (bottomIsAuto) {
     // solve for 'bottom'
     if (heightIsAuto) {
-      mComputedOffsets.bottom = NS_AUTOOFFSET;
+      ComputedPhysicalOffsets().bottom = NS_AUTOOFFSET;
     } else {
-      mComputedOffsets.bottom = containingBlockHeight - mComputedOffsets.top -
-        mComputedMargin.top - mComputedBorderPadding.top - mComputedHeight -
-        mComputedBorderPadding.bottom - mComputedMargin.bottom;
+      ComputedPhysicalOffsets().bottom = containingBlockHeight - ComputedPhysicalOffsets().top -
+        ComputedPhysicalMargin().top - ComputedPhysicalBorderPadding().top - ComputedHeight() -
+        ComputedPhysicalBorderPadding().bottom - ComputedPhysicalMargin().bottom;
     }
   } else {
     // Neither 'top' nor 'bottom' is 'auto'.
     nscoord autoHeight = containingBlockHeight -
-                         mComputedOffsets.TopBottom() -
-                         mComputedMargin.TopBottom() -
-                         mComputedBorderPadding.TopBottom();
+                         ComputedPhysicalOffsets().TopBottom() -
+                         ComputedPhysicalMargin().TopBottom() -
+                         ComputedPhysicalBorderPadding().TopBottom();
     if (autoHeight < 0) {
       autoHeight = 0;
     }
 
-    if (mComputedHeight == NS_UNCONSTRAINEDSIZE) {
+    if (ComputedHeight() == NS_UNCONSTRAINEDSIZE) {
       // For non-replaced elements with 'height' auto, the 'height'
       // fills the remaining space.
-      mComputedHeight = autoHeight;
+      ComputedHeight() = autoHeight;
 
       // XXX Do these need box-sizing adjustments?
-      if (mComputedHeight > mComputedMaxHeight)
-        mComputedHeight = mComputedMaxHeight;
-      if (mComputedHeight < mComputedMinHeight)
-        mComputedHeight = mComputedMinHeight;
+      if (ComputedHeight() > ComputedMaxHeight())
+        ComputedHeight() = ComputedMaxHeight();
+      if (ComputedHeight() < ComputedMinHeight())
+        ComputedHeight() = ComputedMinHeight();
     }
 
     // The height might still not fill all the available space in case:
     //  * height was specified
     //  * we're dealing with a replaced element
     //  * height was constrained by min-height or max-height.
-    nscoord availMarginSpace = autoHeight - mComputedHeight;
+    nscoord availMarginSpace = autoHeight - ComputedHeight();
     bool marginTopIsAuto =
       eStyleUnit_Auto == mStyleMargin->mMargin.GetTopUnit();
     bool marginBottomIsAuto =
       eStyleUnit_Auto == mStyleMargin->mMargin.GetBottomUnit();
 
     if (marginTopIsAuto) {
       if (marginBottomIsAuto) {
         if (availMarginSpace < 0) {
           // FIXME: Note that the spec doesn't actually say we should do this!
-          mComputedMargin.bottom = availMarginSpace;
+          ComputedPhysicalMargin().bottom = availMarginSpace;
         } else {
           // Both 'margin-top' and 'margin-bottom' are 'auto', so they get
           // equal values
-          mComputedMargin.top = availMarginSpace / 2;
-          mComputedMargin.bottom = availMarginSpace - mComputedMargin.top;
+          ComputedPhysicalMargin().top = availMarginSpace / 2;
+          ComputedPhysicalMargin().bottom = availMarginSpace - ComputedPhysicalMargin().top;
         }
       } else {
         // Just 'margin-top' is 'auto'
-        mComputedMargin.top = availMarginSpace;
+        ComputedPhysicalMargin().top = availMarginSpace;
       }
     } else {
       if (marginBottomIsAuto) {
         // Just 'margin-bottom' is 'auto'
-        mComputedMargin.bottom = availMarginSpace;
+        ComputedPhysicalMargin().bottom = availMarginSpace;
       } else {
         // We're over-constrained so ignore the specified value for
         // 'bottom'.  (And note that the spec says to ignore 'bottom'
         // rather than 'margin-bottom'.)
-        mComputedOffsets.bottom += availMarginSpace;
+        ComputedPhysicalOffsets().bottom += availMarginSpace;
       }
     }
   }
 }
 
 nscoord 
 GetVerticalMarginBorderPadding(const nsHTMLReflowState* aReflowState)
 {
   nscoord result = 0;
   if (!aReflowState) return result;
 
   // zero auto margins
-  nsMargin margin = aReflowState->mComputedMargin;
+  nsMargin margin = aReflowState->ComputedPhysicalMargin();
   if (NS_AUTOMARGIN == margin.top) 
     margin.top = 0;
   if (NS_AUTOMARGIN == margin.bottom) 
     margin.bottom = 0;
 
   result += margin.top + margin.bottom;
-  result += aReflowState->mComputedBorderPadding.top + 
-            aReflowState->mComputedBorderPadding.bottom;
+  result += aReflowState->ComputedPhysicalBorderPadding().top + 
+            aReflowState->ComputedPhysicalBorderPadding().bottom;
 
   return result;
 }
 
 /* Get the height based on the viewport of the containing block specified 
  * in aReflowState when the containing block has mComputedHeight == NS_AUTOHEIGHT
  * This will walk up the chain of containing blocks looking for a computed height
  * until it finds the canvas frame, or it encounters a frame that is not a block,
@@ -1700,17 +1700,17 @@ CalcQuirkContainingBlockHeight(const nsH
     }
     else {
       break;
     }
 
     // if the ancestor is the page content frame then the percent base is 
     // the avail height, otherwise it is the computed height
     result = (nsGkAtoms::pageContentFrame == frameType)
-             ? rs->availableHeight : rs->ComputedHeight();
+             ? rs->AvailableHeight() : rs->ComputedHeight();
     // if unconstrained - don't sutract borders - would result in huge height
     if (NS_AUTOHEIGHT == result) return result;
 
     // if we got to the canvas or page content frame, then subtract out 
     // margin/border/padding for the BODY and HTML elements
     if ((nsGkAtoms::canvasFrame == frameType) || 
         (nsGkAtoms::pageContentFrame == frameType)) {
 
@@ -1756,48 +1756,48 @@ CalcQuirkContainingBlockHeight(const nsH
 void
 nsHTMLReflowState::ComputeContainingBlockRectangle(nsPresContext*          aPresContext,
                                                    const nsHTMLReflowState* aContainingBlockRS,
                                                    nscoord&                 aContainingBlockWidth,
                                                    nscoord&                 aContainingBlockHeight)
 {
   // Unless the element is absolutely positioned, the containing block is
   // formed by the content edge of the nearest block-level ancestor
-  aContainingBlockWidth = aContainingBlockRS->mComputedWidth;
-  aContainingBlockHeight = aContainingBlockRS->mComputedHeight;
+  aContainingBlockWidth = aContainingBlockRS->ComputedWidth();
+  aContainingBlockHeight = aContainingBlockRS->ComputedHeight();
 
   // mFrameType for abs-pos tables is NS_CSS_FRAME_TYPE_BLOCK, so we need to
   // special case them here.
   if (NS_FRAME_GET_TYPE(mFrameType) == NS_CSS_FRAME_TYPE_ABSOLUTE ||
       (frame->GetType() == nsGkAtoms::tableFrame &&
        frame->IsAbsolutelyPositioned() &&
        (frame->GetParent()->GetStateBits() & NS_FRAME_OUT_OF_FLOW))) {
     // See if the ancestor is block-level or inline-level
     if (NS_FRAME_GET_TYPE(aContainingBlockRS->mFrameType) == NS_CSS_FRAME_TYPE_INLINE) {
       // Base our size on the actual size of the frame.  In cases when this is
       // completely bogus (eg initial reflow), this code shouldn't even be
       // called, since the code in nsInlineFrame::Reflow will pass in
       // the containing block dimensions to our constructor.
       // XXXbz we should be taking the in-flows into account too, but
       // that's very hard.
-      nsMargin computedBorder = aContainingBlockRS->mComputedBorderPadding -
-        aContainingBlockRS->mComputedPadding;
+      nsMargin computedBorder = aContainingBlockRS->ComputedPhysicalBorderPadding() -
+        aContainingBlockRS->ComputedPhysicalPadding();
       aContainingBlockWidth = aContainingBlockRS->frame->GetRect().width -
         computedBorder.LeftRight();
       NS_ASSERTION(aContainingBlockWidth >= 0,
                    "Negative containing block width!");
       aContainingBlockHeight = aContainingBlockRS->frame->GetRect().height -
         computedBorder.TopBottom();
       NS_ASSERTION(aContainingBlockHeight >= 0,
                    "Negative containing block height!");
     } else {
       // If the ancestor is block-level, the containing block is formed by the
       // padding edge of the ancestor
-      aContainingBlockWidth += aContainingBlockRS->mComputedPadding.LeftRight();
-      aContainingBlockHeight += aContainingBlockRS->mComputedPadding.TopBottom();
+      aContainingBlockWidth += aContainingBlockRS->ComputedPhysicalPadding().LeftRight();
+      aContainingBlockHeight += aContainingBlockRS->ComputedPhysicalPadding().TopBottom();
     }
   } else {
     // an element in quirks mode gets a containing block based on looking for a
     // parent with a non-auto height if the element has a percent height
     // Note: We don't emulate this quirk for percents in calc().
     if (NS_AUTOHEIGHT == aContainingBlockHeight) {
       if (eCompatibility_NavQuirks == aPresContext->CompatibilityMode() &&
           mStylePosition->mHeight.GetUnit() == eStyleUnit_Percent) {
@@ -1883,32 +1883,32 @@ nsHTMLReflowState::InitConstraints(nsPre
   if (nullptr == parentReflowState || mFlags.mDummyParentReflowState) {
     // XXXldb This doesn't mean what it used to!
     InitOffsets(aContainingBlockWidth,
                 VerticalOffsetPercentBasis(frame, aContainingBlockWidth,
                                            aContainingBlockHeight),
                 aFrameType, aBorder, aPadding);
     // Override mComputedMargin since reflow roots start from the
     // frame's boundary, which is inside the margin.
-    mComputedMargin.SizeTo(0, 0, 0, 0);
-    mComputedOffsets.SizeTo(0, 0, 0, 0);
+    ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
+    ComputedPhysicalOffsets().SizeTo(0, 0, 0, 0);
 
-    mComputedWidth = mAvailableWidth - mComputedBorderPadding.LeftRight();
-    if (mComputedWidth < 0)
-      mComputedWidth = 0;
-    if (mAvailableHeight != NS_UNCONSTRAINEDSIZE) {
-      mComputedHeight = mAvailableHeight - mComputedBorderPadding.TopBottom();
-      if (mComputedHeight < 0)
-        mComputedHeight = 0;
+    ComputedWidth() = AvailableWidth() - ComputedPhysicalBorderPadding().LeftRight();
+    if (ComputedWidth() < 0)
+      ComputedWidth() = 0;
+    if (AvailableHeight() != NS_UNCONSTRAINEDSIZE) {
+      ComputedHeight() = AvailableHeight() - ComputedPhysicalBorderPadding().TopBottom();
+      if (ComputedHeight() < 0)
+        ComputedHeight() = 0;
     } else {
-      mComputedHeight = NS_UNCONSTRAINEDSIZE;
+      ComputedHeight() = NS_UNCONSTRAINEDSIZE;
     }
 
-    mComputedMinWidth = mComputedMinHeight = 0;
-    mComputedMaxWidth = mComputedMaxHeight = NS_UNCONSTRAINEDSIZE;
+    ComputedMinWidth() = ComputedMinHeight() = 0;
+    ComputedMaxWidth() = ComputedMaxHeight() = NS_UNCONSTRAINEDSIZE;
   } else {
     // Get the containing block reflow state
     const nsHTMLReflowState* cbrs = mCBReflowState;
     NS_ASSERTION(nullptr != cbrs, "no containing block");
 
     // If we weren't given a containing block width and height, then
     // compute one
     if (aContainingBlockWidth == -1) {
@@ -1922,17 +1922,17 @@ nsHTMLReflowState::InitConstraints(nsPre
     if (NS_AUTOHEIGHT == aContainingBlockHeight) {
       // See if the containing block is a cell frame which needs
       // to use the mComputedHeight of the cell instead of what the cell block passed in.
       // XXX It seems like this could lead to bugs with min-height and friends
       if (cbrs->parentReflowState) {
         fType = cbrs->frame->GetType();
         if (IS_TABLE_CELL(fType)) {
           // use the cell's computed height 
-          aContainingBlockHeight = cbrs->mComputedHeight;
+          aContainingBlockHeight = cbrs->ComputedHeight();
         }
       }
     }
 
     // XXX Might need to also pass the CB height (not width) for page boxes,
     // too, if we implement them.
     InitOffsets(aContainingBlockWidth,
                 VerticalOffsetPercentBasis(frame, aContainingBlockWidth,
@@ -1967,18 +1967,18 @@ nsHTMLReflowState::InitConstraints(nsPre
             else {
               heightUnit = eStyleUnit_Auto;
             }
           }
           // in standard mode, use the cb height.  if it's "auto", as will be the case
           // by default in BODY, use auto height as per CSS2 spec.
           else 
           {
-            if (NS_AUTOHEIGHT != cbrs->mComputedHeight)
-              aContainingBlockHeight = cbrs->mComputedHeight;
+            if (NS_AUTOHEIGHT != cbrs->ComputedHeight())
+              aContainingBlockHeight = cbrs->ComputedHeight();
             else
               heightUnit = eStyleUnit_Auto;
           }
         }
         else {
           // default to interpreting the height like 'auto'
           heightUnit = eStyleUnit_Auto;
         }
@@ -1992,20 +1992,20 @@ nsHTMLReflowState::InitConstraints(nsPre
     // so we compute offsets from StickyScrollContainer::UpdatePositions.)
     if (mStyleDisplay->IsRelativelyPositioned(frame) &&
         NS_STYLE_POSITION_RELATIVE == mStyleDisplay->mPosition) {
       uint8_t direction = NS_STYLE_DIRECTION_LTR;
       if (cbrs && NS_STYLE_DIRECTION_RTL == cbrs->mStyleVisibility->mDirection) {
         direction = NS_STYLE_DIRECTION_RTL;
       }
       ComputeRelativeOffsets(direction, frame, aContainingBlockWidth,
-          aContainingBlockHeight, mComputedOffsets);
+          aContainingBlockHeight, ComputedPhysicalOffsets());
     } else {
       // Initialize offsets to 0
-      mComputedOffsets.SizeTo(0, 0, 0, 0);
+      ComputedPhysicalOffsets().SizeTo(0, 0, 0, 0);
     }
 
     // Calculate the computed values for min and max properties.  Note that
     // this MUST come after we've computed our border and padding.
     ComputeMinMaxValues(aContainingBlockWidth, aContainingBlockHeight, cbrs);
 
     // Calculate the computed width and height. This varies by frame type
 
@@ -2020,57 +2020,57 @@ nsHTMLReflowState::InitConstraints(nsPre
         // 'width' property doesn't apply to table rows and row groups
         widthUnit = eStyleUnit_Auto;
         rowOrRowGroup = true;
       }
 
       // calc() with percentages acts like auto on internal table elements
       if (eStyleUnit_Auto == widthUnit ||
           (width.IsCalcUnit() && width.CalcHasPercent())) {
-        mComputedWidth = mAvailableWidth;
+        ComputedWidth() = AvailableWidth();
 
-        if ((mComputedWidth != NS_UNCONSTRAINEDSIZE) && !rowOrRowGroup){
+        if ((ComputedWidth() != NS_UNCONSTRAINEDSIZE) && !rowOrRowGroup){
           // Internal table elements don't have margins. Only tables and
           // cells have border and padding
-          mComputedWidth -= mComputedBorderPadding.left +
-            mComputedBorderPadding.right;
-          if (mComputedWidth < 0)
-            mComputedWidth = 0;
+          ComputedWidth() -= ComputedPhysicalBorderPadding().left +
+            ComputedPhysicalBorderPadding().right;
+          if (ComputedWidth() < 0)
+            ComputedWidth() = 0;
         }
-        NS_ASSERTION(mComputedWidth >= 0, "Bogus computed width");
+        NS_ASSERTION(ComputedWidth() >= 0, "Bogus computed width");
       
       } else {
         NS_ASSERTION(widthUnit == mStylePosition->mWidth.GetUnit(),
                      "unexpected width unit change");
-        mComputedWidth = ComputeWidthValue(aContainingBlockWidth,
+        ComputedWidth() = ComputeWidthValue(aContainingBlockWidth,
                                            mStylePosition->mBoxSizing,
                                            mStylePosition->mWidth);
       }
 
       // Calculate the computed height
       if ((NS_STYLE_DISPLAY_TABLE_COLUMN == mStyleDisplay->mDisplay) ||
           (NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP == mStyleDisplay->mDisplay)) {
         // 'height' property doesn't apply to table columns and column groups
         heightUnit = eStyleUnit_Auto;
       }
       // calc() with percentages acts like 'auto' on internal table elements
       if (eStyleUnit_Auto == heightUnit ||
           (height.IsCalcUnit() && height.CalcHasPercent())) {
-        mComputedHeight = NS_AUTOHEIGHT;
+        ComputedHeight() = NS_AUTOHEIGHT;
       } else {
         NS_ASSERTION(heightUnit == mStylePosition->mHeight.GetUnit(),
                      "unexpected height unit change");
-        mComputedHeight = ComputeHeightValue(aContainingBlockHeight, 
+        ComputedHeight() = ComputeHeightValue(aContainingBlockHeight, 
                                              mStylePosition->mBoxSizing,
                                              mStylePosition->mHeight);
       }
 
       // Doesn't apply to table elements
-      mComputedMinWidth = mComputedMinHeight = 0;
-      mComputedMaxWidth = mComputedMaxHeight = NS_UNCONSTRAINEDSIZE;
+      ComputedMinWidth() = ComputedMinHeight() = 0;
+      ComputedMaxWidth() = ComputedMaxHeight() = NS_UNCONSTRAINEDSIZE;
 
     } else if (NS_FRAME_GET_TYPE(mFrameType) == NS_CSS_FRAME_TYPE_ABSOLUTE) {
       // XXX not sure if this belongs here or somewhere else - cwk
       InitAbsoluteConstraints(aPresContext, cbrs, aContainingBlockWidth,
                               aContainingBlockHeight, aFrameType);
     } else {
       AutoMaybeDisableFontInflation an(frame);
 
@@ -2101,39 +2101,39 @@ nsHTMLReflowState::InitConstraints(nsPre
                    "We're not in a flex container, so the flag "
                    "'mIsFlexContainerMeasuringHeight' shouldn't be set");
       }
 
       nsSize size =
         frame->ComputeSize(rendContext,
                            nsSize(aContainingBlockWidth,
                                   aContainingBlockHeight),
-                           mAvailableWidth,
-                           nsSize(mComputedMargin.LeftRight(),
-                                  mComputedMargin.TopBottom()),
-                           nsSize(mComputedBorderPadding.LeftRight() -
-                                    mComputedPadding.LeftRight(),
-                                  mComputedBorderPadding.TopBottom() -
-                                    mComputedPadding.TopBottom()),
-                           nsSize(mComputedPadding.LeftRight(),
-                                  mComputedPadding.TopBottom()),
+                           AvailableWidth(),
+                           nsSize(ComputedPhysicalMargin().LeftRight(),
+                                  ComputedPhysicalMargin().TopBottom()),
+                           nsSize(ComputedPhysicalBorderPadding().LeftRight() -
+                                    ComputedPhysicalPadding().LeftRight(),
+                                  ComputedPhysicalBorderPadding().TopBottom() -
+                                    ComputedPhysicalPadding().TopBottom()),
+                           nsSize(ComputedPhysicalPadding().LeftRight(),
+                                  ComputedPhysicalPadding().TopBottom()),
                            computeSizeFlags);
 
-      mComputedWidth = size.width;
-      mComputedHeight = size.height;
-      NS_ASSERTION(mComputedWidth >= 0, "Bogus width");
-      NS_ASSERTION(mComputedHeight == NS_UNCONSTRAINEDSIZE ||
-                   mComputedHeight >= 0, "Bogus height");
+      ComputedWidth() = size.width;
+      ComputedHeight() = size.height;
+      NS_ASSERTION(ComputedWidth() >= 0, "Bogus width");
+      NS_ASSERTION(ComputedHeight() == NS_UNCONSTRAINEDSIZE ||
+                   ComputedHeight() >= 0, "Bogus height");
 
       // Exclude inline tables and flex items from the block margin calculations
       if (isBlock &&
           !IsSideCaption(frame, mStyleDisplay) &&
           mStyleDisplay->mDisplay != NS_STYLE_DISPLAY_INLINE_TABLE &&
           !flexContainerFrame) {
-        CalculateBlockSideMargins(mAvailableWidth, mComputedWidth, aFrameType);
+        CalculateBlockSideMargins(AvailableWidth(), ComputedWidth(), aFrameType);
       }
     }
   }
 }
 
 static void
 UpdateProp(FrameProperties& aProps,
            const FramePropertyDescriptor* aProperty,
@@ -2176,98 +2176,98 @@ nsCSSOffsetState::InitOffsets(nscoord aH
   // inline-non-replaced elements
   bool needMarginProp = ComputeMargin(aHorizontalPercentBasis,
                                       aVerticalPercentBasis);
   // XXX We need to include 'auto' horizontal margins in this too!
   // ... but if we did that, we'd need to fix nsFrame::GetUsedMargin
   // to use it even when the margins are all zero (since sometimes
   // they get treated as auto)
   ::UpdateProp(props, nsIFrame::UsedMarginProperty(), needMarginProp,
-               mComputedMargin);
+               ComputedPhysicalMargin());
 
 
   const nsStyleDisplay *disp = frame->StyleDisplay();
   bool isThemed = frame->IsThemed(disp);
   bool needPaddingProp;
   nsIntMargin widget;
   if (isThemed &&
       presContext->GetTheme()->GetWidgetPadding(presContext->DeviceContext(),
                                                 frame, disp->mAppearance,
                                                 &widget)) {
-    mComputedPadding.top = presContext->DevPixelsToAppUnits(widget.top);
-    mComputedPadding.right = presContext->DevPixelsToAppUnits(widget.right);
-    mComputedPadding.bottom = presContext->DevPixelsToAppUnits(widget.bottom);
-    mComputedPadding.left = presContext->DevPixelsToAppUnits(widget.left);
+    ComputedPhysicalPadding().top = presContext->DevPixelsToAppUnits(widget.top);
+    ComputedPhysicalPadding().right = presContext->DevPixelsToAppUnits(widget.right);
+    ComputedPhysicalPadding().bottom = presContext->DevPixelsToAppUnits(widget.bottom);
+    ComputedPhysicalPadding().left = presContext->DevPixelsToAppUnits(widget.left);
     needPaddingProp = false;
   }
   else if (frame->IsSVGText()) {
-    mComputedPadding.SizeTo(0, 0, 0, 0);
+    ComputedPhysicalPadding().SizeTo(0, 0, 0, 0);
     needPaddingProp = false;
   }
   else if (aPadding) { // padding is an input arg
-    mComputedPadding = *aPadding;
+    ComputedPhysicalPadding() = *aPadding;
     needPaddingProp = frame->StylePadding()->IsWidthDependent();
   }
   else {
     needPaddingProp = ComputePadding(aHorizontalPercentBasis,
                                      aVerticalPercentBasis, aFrameType);
   }
 
   if (isThemed) {
     nsIntMargin widget;
     presContext->GetTheme()->GetWidgetBorder(presContext->DeviceContext(),
                                              frame, disp->mAppearance,
                                              &widget);
-    mComputedBorderPadding.top =
+    ComputedPhysicalBorderPadding().top =
       presContext->DevPixelsToAppUnits(widget.top);
-    mComputedBorderPadding.right =
+    ComputedPhysicalBorderPadding().right =
       presContext->DevPixelsToAppUnits(widget.right);
-    mComputedBorderPadding.bottom =
+    ComputedPhysicalBorderPadding().bottom =
       presContext->DevPixelsToAppUnits(widget.bottom);
-    mComputedBorderPadding.left =
+    ComputedPhysicalBorderPadding().left =
       presContext->DevPixelsToAppUnits(widget.left);
   }
   else if (frame->IsSVGText()) {
-    mComputedBorderPadding.SizeTo(0, 0, 0, 0);
+    ComputedPhysicalBorderPadding().SizeTo(0, 0, 0, 0);
   }
   else if (aBorder) {  // border is an input arg
-    mComputedBorderPadding = *aBorder;
+    ComputedPhysicalBorderPadding() = *aBorder;
   }
   else {
-    mComputedBorderPadding = frame->StyleBorder()->GetComputedBorder();
+    ComputedPhysicalBorderPadding() = frame->StyleBorder()->GetComputedBorder();
   }
-  mComputedBorderPadding += mComputedPadding;
+  ComputedPhysicalBorderPadding() += ComputedPhysicalPadding();
 
   if (aFrameType == nsGkAtoms::tableFrame) {
     nsTableFrame *tableFrame = static_cast<nsTableFrame*>(frame);
 
     if (tableFrame->IsBorderCollapse()) {
       // border-collapsed tables don't use any of their padding, and
       // only part of their border.  We need to do this here before we
       // try to do anything like handling 'auto' widths,
       // '-moz-box-sizing', or 'auto' margins.
-      mComputedPadding.SizeTo(0,0,0,0);
-      mComputedBorderPadding = tableFrame->GetIncludedOuterBCBorder();
+      ComputedPhysicalPadding().SizeTo(0,0,0,0);
+      ComputedPhysicalBorderPadding() = tableFrame->GetIncludedOuterBCBorder();
     }
 
     // The margin is inherited to the outer table frame via
     // the ::-moz-table-outer rule in ua.css.
-    mComputedMargin.SizeTo(0, 0, 0, 0);
+    ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
   } else if (aFrameType == nsGkAtoms::scrollbarFrame) {
     // scrollbars may have had their width or height smashed to zero
     // by the associated scrollframe, in which case we must not report
     // any padding or border.
     nsSize size(frame->GetSize());
     if (size.width == 0 || size.height == 0) {
-      mComputedPadding.SizeTo(0,0,0,0);
-      mComputedBorderPadding.SizeTo(0,0,0,0);
+      ComputedPhysicalPadding().SizeTo(0,0,0,0);
+      ComputedPhysicalBorderPadding().SizeTo(0,0,0,0);
     }
   }
   ::UpdateProp(props, nsIFrame::UsedPaddingProperty(), needPaddingProp,
-               mComputedPadding);
+               ComputedPhysicalPadding());
 }
 
 // This code enforces section 10.3.3 of the CSS2 spec for this formula:
 //
 // 'margin-left' + 'border-left-width' + 'padding-left' + 'width' +
 //   'padding-right' + 'border-right-width' + 'margin-right'
 //   = width of containing block 
 //
@@ -2278,36 +2278,36 @@ nsHTMLReflowState::CalculateBlockSideMar
                                              nsIAtom* aFrameType)
 {
   NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aComputedWidth &&
                    NS_UNCONSTRAINEDSIZE != aAvailWidth,
                    "have unconstrained width; this should only result from "
                    "very large sizes, not attempts at intrinsic width "
                    "calculation");
 
-  nscoord sum = mComputedMargin.left + mComputedBorderPadding.left +
-    aComputedWidth + mComputedBorderPadding.right + mComputedMargin.right;
+  nscoord sum = ComputedPhysicalMargin().left + ComputedPhysicalBorderPadding().left +
+    aComputedWidth + ComputedPhysicalBorderPadding().right + ComputedPhysicalMargin().right;
   if (sum == aAvailWidth)
     // The sum is already correct
     return;
 
   // Determine the left and right margin values. The width value
   // remains constant while we do this.
 
   // Calculate how much space is available for margins
   nscoord availMarginSpace = aAvailWidth - sum;
 
   // If the available margin space is negative, then don't follow the
   // usual overconstraint rules.
   if (availMarginSpace < 0) {
     if (mCBReflowState &&
         mCBReflowState->mStyleVisibility->mDirection == NS_STYLE_DIRECTION_RTL) {
-      mComputedMargin.left += availMarginSpace;
+      ComputedPhysicalMargin().left += availMarginSpace;
     } else {
-      mComputedMargin.right += availMarginSpace;
+      ComputedPhysicalMargin().right += availMarginSpace;
     }
     return;
   }
 
   // The css2 spec clearly defines how block elements should behave
   // in section 10.3.3.
   bool isAutoLeftMargin =
     eStyleUnit_Auto == mStyleMargin->mMargin.GetLeftUnit();
@@ -2349,23 +2349,23 @@ nsHTMLReflowState::CalculateBlockSideMar
   // Logic which is common to blocks and tables
   // The computed margins need not be zero because the 'auto' could come from
   // overconstraint or from HTML alignment so values need to be accumulated
 
   if (isAutoLeftMargin) {
     if (isAutoRightMargin) {
       // Both margins are 'auto' so the computed addition should be equal
       nscoord forLeft = availMarginSpace / 2;
-      mComputedMargin.left  += forLeft;
-      mComputedMargin.right += availMarginSpace - forLeft;
+      ComputedPhysicalMargin().left  += forLeft;
+      ComputedPhysicalMargin().right += availMarginSpace - forLeft;
     } else {
-      mComputedMargin.left += availMarginSpace;
+      ComputedPhysicalMargin().left += availMarginSpace;
     }
   } else if (isAutoRightMargin) {
-    mComputedMargin.right += availMarginSpace;
+    ComputedPhysicalMargin().right += availMarginSpace;
   }
 }
 
 #define NORMAL_LINE_HEIGHT_FACTOR 1.2f    // in term of emHeight 
 // For "normal" we use the font's normal line height (em height + leading).
 // If both internal leading and  external leading specified by font itself
 // are zeros, we should compensate this by creating extra (external) leading 
 // in eCompensateLeading mode. This is necessary because without this 
@@ -2440,18 +2440,18 @@ ComputeLineHeight(nsStyleContext* aStyle
                                                aFontSizeInflation);
   return GetNormalLineHeight(fm);
 }
 
 nscoord
 nsHTMLReflowState::CalcLineHeight() const
 {
   nscoord blockHeight =
-    nsLayoutUtils::IsNonWrapperBlock(frame) ? mComputedHeight :
-    (mCBReflowState ? mCBReflowState->mComputedHeight : NS_AUTOHEIGHT);
+    nsLayoutUtils::IsNonWrapperBlock(frame) ? ComputedHeight() :
+    (mCBReflowState ? mCBReflowState->ComputedHeight() : NS_AUTOHEIGHT);
 
   return CalcLineHeight(frame->StyleContext(), blockHeight,
                         nsLayoutUtils::FontSizeInflationFor(frame));
 }
 
 /* static */ nscoord
 nsHTMLReflowState::CalcLineHeight(nsStyleContext* aStyleContext,
                                   nscoord aBlockHeight,
@@ -2473,165 +2473,165 @@ nsCSSOffsetState::ComputeMargin(nscoord 
 {
   // SVG text frames have no margin.
   if (frame->IsSVGText()) {
     return false;
   }
 
   // If style style can provide us the margin directly, then use it.
   const nsStyleMargin *styleMargin = frame->StyleMargin();
-  bool isCBDependent = !styleMargin->GetMargin(mComputedMargin);
+  bool isCBDependent = !styleMargin->GetMargin(ComputedPhysicalMargin());
   if (isCBDependent) {
     // We have to compute the value
-    mComputedMargin.left = nsLayoutUtils::
+    ComputedPhysicalMargin().left = nsLayoutUtils::
       ComputeCBDependentValue(aHorizontalPercentBasis,
                               styleMargin->mMargin.GetLeft());
-    mComputedMargin.right = nsLayoutUtils::
+    ComputedPhysicalMargin().right = nsLayoutUtils::
       ComputeCBDependentValue(aHorizontalPercentBasis,
                               styleMargin->mMargin.GetRight());
 
-    mComputedMargin.top = nsLayoutUtils::
+    ComputedPhysicalMargin().top = nsLayoutUtils::
       ComputeCBDependentValue(aVerticalPercentBasis,
                               styleMargin->mMargin.GetTop());
-    mComputedMargin.bottom = nsLayoutUtils::
+    ComputedPhysicalMargin().bottom = nsLayoutUtils::
       ComputeCBDependentValue(aVerticalPercentBasis,
                               styleMargin->mMargin.GetBottom());
   }
 
   nscoord marginAdjustment = FontSizeInflationListMarginAdjustment(frame);
 
   if (marginAdjustment > 0) {
     const nsStyleVisibility* visibility = frame->StyleVisibility();
     if (visibility->mDirection == NS_STYLE_DIRECTION_RTL) {
-      mComputedMargin.right = mComputedMargin.right + marginAdjustment;
+      ComputedPhysicalMargin().right = ComputedPhysicalMargin().right + marginAdjustment;
     } else {
-      mComputedMargin.left = mComputedMargin.left + marginAdjustment;
+      ComputedPhysicalMargin().left = ComputedPhysicalMargin().left + marginAdjustment;
     }
   }
 
   return isCBDependent;
 }
 
 bool
 nsCSSOffsetState::ComputePadding(nscoord aHorizontalPercentBasis,
                                  nscoord aVerticalPercentBasis,
                                  nsIAtom* aFrameType)
 {
   // If style can provide us the padding directly, then use it.
   const nsStylePadding *stylePadding = frame->StylePadding();
-  bool isCBDependent = !stylePadding->GetPadding(mComputedPadding);
+  bool isCBDependent = !stylePadding->GetPadding(ComputedPhysicalPadding());
   // a table row/col group, row/col doesn't have padding
   // XXXldb Neither do border-collapse tables.
   if (nsGkAtoms::tableRowGroupFrame == aFrameType ||
       nsGkAtoms::tableColGroupFrame == aFrameType ||
       nsGkAtoms::tableRowFrame      == aFrameType ||
       nsGkAtoms::tableColFrame      == aFrameType) {
-    mComputedPadding.SizeTo(0,0,0,0);
+    ComputedPhysicalPadding().SizeTo(0,0,0,0);
   }
   else if (isCBDependent) {
     // We have to compute the value
     // clamp negative calc() results to 0
-    mComputedPadding.left = std::max(0, nsLayoutUtils::
+    ComputedPhysicalPadding().left = std::max(0, nsLayoutUtils::
       ComputeCBDependentValue(aHorizontalPercentBasis,
                               stylePadding->mPadding.GetLeft()));
-    mComputedPadding.right = std::max(0, nsLayoutUtils::
+    ComputedPhysicalPadding().right = std::max(0, nsLayoutUtils::
       ComputeCBDependentValue(aHorizontalPercentBasis,
                               stylePadding->mPadding.GetRight()));
 
-    mComputedPadding.top = std::max(0, nsLayoutUtils::
+    ComputedPhysicalPadding().top = std::max(0, nsLayoutUtils::
       ComputeCBDependentValue(aVerticalPercentBasis,
                               stylePadding->mPadding.GetTop()));
-    mComputedPadding.bottom = std::max(0, nsLayoutUtils::
+    ComputedPhysicalPadding().bottom = std::max(0, nsLayoutUtils::
       ComputeCBDependentValue(aVerticalPercentBasis,
                               stylePadding->mPadding.GetBottom()));
   }
   return isCBDependent;
 }
 
 void
 nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
                                        nscoord aContainingBlockHeight,
                                        const nsHTMLReflowState* aContainingBlockRS)
 {
-  mComputedMinWidth = ComputeWidthValue(aContainingBlockWidth,
+  ComputedMinWidth() = ComputeWidthValue(aContainingBlockWidth,
                                         mStylePosition->mBoxSizing,
                                         mStylePosition->mMinWidth);
 
   if (eStyleUnit_None == mStylePosition->mMaxWidth.GetUnit()) {
     // Specified value of 'none'
-    mComputedMaxWidth = NS_UNCONSTRAINEDSIZE;  // no limit
+    ComputedMaxWidth() = NS_UNCONSTRAINEDSIZE;  // no limit
   } else {
-    mComputedMaxWidth = ComputeWidthValue(aContainingBlockWidth,
+    ComputedMaxWidth() = ComputeWidthValue(aContainingBlockWidth,
                                           mStylePosition->mBoxSizing,
                                           mStylePosition->mMaxWidth);
   }
 
   // If the computed value of 'min-width' is greater than the value of
   // 'max-width', 'max-width' is set to the value of 'min-width'
-  if (mComputedMinWidth > mComputedMaxWidth) {
-    mComputedMaxWidth = mComputedMinWidth;
+  if (ComputedMinWidth() > ComputedMaxWidth()) {
+    ComputedMaxWidth() = ComputedMinWidth();
   }
 
   // Check for percentage based values and a containing block height that
   // depends on the content height. Treat them like 'auto'
   // Likewise, check for calc() with percentages on internal table elements;
   // that's treated as 'auto' too.
   // Likewise, if we're a child of a flex container who's measuring our
   // intrinsic height, then we want to disregard our min-height.
 
   const nsStyleCoord &minHeight = mStylePosition->mMinHeight;
   if ((NS_AUTOHEIGHT == aContainingBlockHeight &&
        minHeight.HasPercent()) ||
       (mFrameType == NS_CSS_FRAME_TYPE_INTERNAL_TABLE &&
        minHeight.IsCalcUnit() && minHeight.CalcHasPercent()) ||
       mFlags.mIsFlexContainerMeasuringHeight) {
-    mComputedMinHeight = 0;
+    ComputedMinHeight() = 0;
   } else {
-    mComputedMinHeight = ComputeHeightValue(aContainingBlockHeight, 
+    ComputedMinHeight() = ComputeHeightValue(aContainingBlockHeight, 
                                             mStylePosition->mBoxSizing, 
                                             minHeight);
   }
   const nsStyleCoord &maxHeight = mStylePosition->mMaxHeight;
   nsStyleUnit maxHeightUnit = maxHeight.GetUnit();
   if (eStyleUnit_None == maxHeightUnit) {
     // Specified value of 'none'
-    mComputedMaxHeight = NS_UNCONSTRAINEDSIZE;  // no limit
+    ComputedMaxHeight() = NS_UNCONSTRAINEDSIZE;  // no limit
   } else {
     // Check for percentage based values and a containing block height that
     // depends on the content height. Treat them like 'none'
     // Likewise, check for calc() with percentages on internal table elements;
     // that's treated as 'auto' too.
     // Likewise, if we're a child of a flex container who's measuring our
     // intrinsic height, then we want to disregard our max-height.
     if ((NS_AUTOHEIGHT == aContainingBlockHeight && 
          maxHeight.HasPercent()) ||
         (mFrameType == NS_CSS_FRAME_TYPE_INTERNAL_TABLE &&
          maxHeight.IsCalcUnit() && maxHeight.CalcHasPercent()) ||
         mFlags.mIsFlexContainerMeasuringHeight) {
-      mComputedMaxHeight = NS_UNCONSTRAINEDSIZE;
+      ComputedMaxHeight() = NS_UNCONSTRAINEDSIZE;
     } else {
-      mComputedMaxHeight = ComputeHeightValue(aContainingBlockHeight, 
+      ComputedMaxHeight() = ComputeHeightValue(aContainingBlockHeight, 
                                               mStylePosition->mBoxSizing,
                                               maxHeight);
     }
   }
 
   // If the computed value of 'min-height' is greater than the value of
   // 'max-height', 'max-height' is set to the value of 'min-height'
-  if (mComputedMinHeight > mComputedMaxHeight) {
-    mComputedMaxHeight = mComputedMinHeight;
+  if (ComputedMinHeight() > ComputedMaxHeight()) {
+    ComputedMaxHeight() = ComputedMinHeight();
   }
 }
 
 void
 nsHTMLReflowState::SetTruncated(const nsHTMLReflowMetrics& aMetrics,
                                 nsReflowStatus* aStatus) const
 {
-  if (mAvailableHeight != NS_UNCONSTRAINEDSIZE &&
-      mAvailableHeight < aMetrics.height &&
+  if (AvailableHeight() != NS_UNCONSTRAINEDSIZE &&
+      AvailableHeight() < aMetrics.height &&
       !mFlags.mIsTopOfPage) {
     *aStatus |= NS_FRAME_TRUNCATED;
   } else {
     *aStatus &= ~NS_FRAME_TRUNCATED;
   }
 }
 
 bool
--- a/layout/generic/nsHTMLReflowState.h
+++ b/layout/generic/nsHTMLReflowState.h
@@ -508,40 +508,40 @@ public:
                                        nscoord&                 aContainingBlockWidth,
                                        nscoord&                 aContainingBlockHeight);
 
   /**
    * Apply the mComputed(Min/Max)Width constraints to the content
    * size computed so far.
    */
   nscoord ApplyMinMaxWidth(nscoord aWidth) const {
-    if (NS_UNCONSTRAINEDSIZE != mComputedMaxWidth) {
-      aWidth = std::min(aWidth, mComputedMaxWidth);
+    if (NS_UNCONSTRAINEDSIZE != ComputedMaxWidth()) {
+      aWidth = std::min(aWidth, ComputedMaxWidth());
     }
-    return std::max(aWidth, mComputedMinWidth);
+    return std::max(aWidth, ComputedMinWidth());
   }
 
   /**
    * Apply the mComputed(Min/Max)Height constraints to the content
    * size computed so far.
    *
    * @param aHeight The height that we've computed an to which we want to apply
    *        min/max constraints.
    * @param aConsumed The amount of the computed height that was consumed by
    *        our prev-in-flows.
    */
   nscoord ApplyMinMaxHeight(nscoord aHeight, nscoord aConsumed = 0) const {
     aHeight += aConsumed;
 
-    if (NS_UNCONSTRAINEDSIZE != mComputedMaxHeight) {
-      aHeight = std::min(aHeight, mComputedMaxHeight);
+    if (NS_UNCONSTRAINEDSIZE != ComputedMaxHeight()) {
+      aHeight = std::min(aHeight, ComputedMaxHeight());
     }
 
-    if (NS_UNCONSTRAINEDSIZE != mComputedMinHeight) {
-      aHeight = std::max(aHeight, mComputedMinHeight);
+    if (NS_UNCONSTRAINEDSIZE != ComputedMinHeight()) {
+      aHeight = std::max(aHeight, ComputedMinHeight());
     }
 
     return aHeight - aConsumed;
   }
 
   bool ShouldReflowAllKids() const {
     // Note that we could make a stronger optimization for mVResize if
     // we use it in a ShouldReflowChild test that replaces the current
@@ -561,17 +561,17 @@ public:
   // This method doesn't apply min/max computed heights to the value passed in.
   void SetComputedHeight(nscoord aComputedHeight);
 
   void SetComputedHeightWithoutResettingResizeFlags(nscoord aComputedHeight) {
     // Viewport frames reset the computed height on a copy of their reflow
     // state when reflowing fixed-pos kids.  In that case we actually don't
     // want to mess with the resize flags, because comparing the frame's rect
     // to the munged computed width is pointless.
-    mComputedHeight = aComputedHeight;
+    ComputedHeight() = aComputedHeight;
   }
 
   void SetTruncated(const nsHTMLReflowMetrics& aMetrics, nsReflowStatus* aStatus) const;
 
   bool WillReflowAgainForClearance() const {
     return mDiscoveredClearance && *mDiscoveredClearance;
   }
 
@@ -583,17 +583,17 @@ public:
                                      nsMargin& aComputedOffsets);
 
   // If a relatively positioned element, adjust the position appropriately.
   static void ApplyRelativePositioning(nsIFrame* aFrame,
                                        const nsMargin& aComputedOffsets,
                                        nsPoint* aPosition);
 
   void ApplyRelativePositioning(nsPoint* aPosition) const {
-    ApplyRelativePositioning(frame, mComputedOffsets, aPosition);
+    ApplyRelativePositioning(frame, ComputedPhysicalOffsets(), aPosition);
   }
 
 #ifdef DEBUG
   // Reflow trace methods.  Defined in nsFrame.cpp so they have access
   // to the display-reflow infrastructure.
   static void* DisplayInitConstraintsEnter(nsIFrame* aFrame,
                                            nsHTMLReflowState* aState,
                                            nscoord aCBWidth,
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -802,17 +802,17 @@ nsImageFrame::Reflow(nsPresContext*     
                      nsHTMLReflowMetrics&     aMetrics,
                      const nsHTMLReflowState& aReflowState,
                      nsReflowStatus&          aStatus)
 {
   DO_GLOBAL_REFLOW_COUNT("nsImageFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
   NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
                   ("enter nsImageFrame::Reflow: availSize=%d,%d",
-                  aReflowState.availableWidth, aReflowState.availableHeight));
+                  aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
 
   NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
 
   aStatus = NS_FRAME_COMPLETE;
 
   // see if we have a frozen size (i.e. a fixed width and height)
   if (HaveFixedSize(aReflowState)) {
     mState |= IMAGE_SIZECONSTRAINED;
@@ -828,23 +828,23 @@ nsImageFrame::Reflow(nsPresContext*     
 
   mComputedSize = 
     nsSize(aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
 
   aMetrics.width = mComputedSize.width;
   aMetrics.height = mComputedSize.height;
 
   // add borders and padding
-  aMetrics.width  += aReflowState.mComputedBorderPadding.LeftRight();
-  aMetrics.height += aReflowState.mComputedBorderPadding.TopBottom();
+  aMetrics.width  += aReflowState.ComputedPhysicalBorderPadding().LeftRight();
+  aMetrics.height += aReflowState.ComputedPhysicalBorderPadding().TopBottom();
   
   if (GetPrevInFlow()) {
     aMetrics.width = GetPrevInFlow()->GetSize().width;
     nscoord y = GetContinuationOffset();
-    aMetrics.height -= y + aReflowState.mComputedBorderPadding.top;
+    aMetrics.height -= y + aReflowState.ComputedPhysicalBorderPadding().top;
     aMetrics.height = std::max(0, aMetrics.height);
   }
 
 
   // we have to split images if we are:
   //  in Paginated mode, we need to have a constrained height, and have a height larger than our available height
   uint32_t loadStatus = imgIRequest::STATUS_NONE;
   nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mContent);
@@ -854,21 +854,21 @@ nsImageFrame::Reflow(nsPresContext*     
     imageLoader->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
                             getter_AddRefs(currentRequest));
     if (currentRequest) {
       currentRequest->GetImageStatus(&loadStatus);
     }
   }
   if (aPresContext->IsPaginated() &&
       ((loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE) || (mState & IMAGE_SIZECONSTRAINED)) &&
-      NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight && 
-      aMetrics.height > aReflowState.availableHeight) { 
+      NS_UNCONSTRAINEDSIZE != aReflowState.AvailableHeight() && 
+      aMetrics.height > aReflowState.AvailableHeight()) { 
     // our desired height was greater than 0, so to avoid infinite
     // splitting, use 1 pixel as the min
-    aMetrics.height = std::max(nsPresContext::CSSPixelsToAppUnits(1), aReflowState.availableHeight);
+    aMetrics.height = std::max(nsPresContext::CSSPixelsToAppUnits(1), aReflowState.AvailableHeight());
     aStatus = NS_FRAME_NOT_COMPLETE;
   }
 
   aMetrics.SetOverflowAreasToDesiredBounds();
   nsEventStates contentState = mContent->AsElement()->State();
   bool imageOK = IMAGE_OK(contentState, true);
 
   // Determine if the size is available
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -489,26 +489,26 @@ nsInlineFrame::ReflowFrames(nsPresContex
   nsLineLayout* lineLayout = aReflowState.mLineLayout;
   bool inFirstLine = aReflowState.mLineLayout->GetInFirstLine();
   RestyleManager* restyleManager = aPresContext->RestyleManager();
   bool ltr = (NS_STYLE_DIRECTION_LTR == aReflowState.mStyleVisibility->mDirection);
   nscoord leftEdge = 0;
   // Don't offset by our start borderpadding if we have a prev continuation or
   // if we're in a part of an {ib} split other than the first one.
   if (!GetPrevContinuation() && !FrameIsNonFirstInIBSplit()) {
-    leftEdge = ltr ? aReflowState.mComputedBorderPadding.left
-                   : aReflowState.mComputedBorderPadding.right;
+    leftEdge = ltr ? aReflowState.ComputedPhysicalBorderPadding().left
+                   : aReflowState.ComputedPhysicalBorderPadding().right;
   }
-  nscoord availableWidth = aReflowState.availableWidth;
+  nscoord availableWidth = aReflowState.AvailableWidth();
   NS_ASSERTION(availableWidth != NS_UNCONSTRAINEDSIZE,
                "should no longer use available widths");
   // Subtract off left and right border+padding from availableWidth
   availableWidth -= leftEdge;
-  availableWidth -= ltr ? aReflowState.mComputedBorderPadding.right
-                        : aReflowState.mComputedBorderPadding.left;
+  availableWidth -= ltr ? aReflowState.ComputedPhysicalBorderPadding().right
+                        : aReflowState.ComputedPhysicalBorderPadding().left;
   lineLayout->BeginSpan(this, &aReflowState, leftEdge,
                         leftEdge + availableWidth, &mBaseline);
 
   // First reflow our principal children.
   nsIFrame* frame = mFrames.FirstChild();
   bool done = false;
   while (frame) {
     // Check if we should lazily set the child frame's parent pointer.
@@ -651,32 +651,32 @@ nsInlineFrame::ReflowFrames(nsPresContex
   aMetrics.width = lineLayout->EndSpan(this);
 
   // Compute final width.
 
   // Make sure to not include our start border and padding if we have a prev
   // continuation or if we're in a part of an {ib} split other than the first
   // one.
   if (!GetPrevContinuation() && !FrameIsNonFirstInIBSplit()) {
-    aMetrics.width += ltr ? aReflowState.mComputedBorderPadding.left
-                          : aReflowState.mComputedBorderPadding.right;
+    aMetrics.width += ltr ? aReflowState.ComputedPhysicalBorderPadding().left
+                          : aReflowState.ComputedPhysicalBorderPadding().right;
   }
 
   /*
    * We want to only apply the end border and padding if we're the last
    * continuation and either not in an {ib} split or the last part of it.  To
    * be the last continuation we have to be complete (so that we won't get a
    * next-in-flow) and have no non-fluid continuations on our continuation
    * chain.
    */
   if (NS_FRAME_IS_COMPLETE(aStatus) &&
       !LastInFlow()->GetNextContinuation() &&
       !FrameIsNonLastInIBSplit()) {
-    aMetrics.width += ltr ? aReflowState.mComputedBorderPadding.right
-                          : aReflowState.mComputedBorderPadding.left;
+    aMetrics.width += ltr ? aReflowState.ComputedPhysicalBorderPadding().right
+                          : aReflowState.ComputedPhysicalBorderPadding().left;
   }
 
   nsRefPtr<nsFontMetrics> fm;
   float inflation = nsLayoutUtils::FontSizeInflationFor(this);
   nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), inflation);
   aReflowState.rendContext->SetFont(fm);
 
   if (fm) {
@@ -691,19 +691,19 @@ nsInlineFrame::ReflowFrames(nsPresContex
     // and bottom border and padding. The height of children do not
     // affect our height.
     aMetrics.ascent = fm->MaxAscent();
     aMetrics.height = fm->MaxHeight();
   } else {
     NS_WARNING("Cannot get font metrics - defaulting sizes to 0");
     aMetrics.ascent = aMetrics.height = 0;
   }
-  aMetrics.ascent += aReflowState.mComputedBorderPadding.top;
-  aMetrics.height += aReflowState.mComputedBorderPadding.top +
-    aReflowState.mComputedBorderPadding.bottom;
+  aMetrics.ascent += aReflowState.ComputedPhysicalBorderPadding().top;
+  aMetrics.height += aReflowState.ComputedPhysicalBorderPadding().top +
+    aReflowState.ComputedPhysicalBorderPadding().bottom;
 
   // For now our overflow area is zero. The real value will be
   // computed in |nsLineLayout::RelativePositionFrames|.
   aMetrics.mOverflowAreas.Clear();
 
 #ifdef NOISY_FINAL_SIZE
   ListTag(stdout);
   printf(": metrics=%d,%d ascent=%d\n",
--- a/layout/generic/nsLeafFrame.cpp
+++ b/layout/generic/nsLeafFrame.cpp
@@ -46,17 +46,17 @@ NS_IMETHODIMP
 nsLeafFrame::Reflow(nsPresContext* aPresContext,
                     nsHTMLReflowMetrics& aMetrics,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus& aStatus)
 {
   DO_GLOBAL_REFLOW_COUNT("nsLeafFrame");
   NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
                  ("enter nsLeafFrame::Reflow: aMaxSize=%d,%d",
-                  aReflowState.availableWidth, aReflowState.availableHeight));
+                  aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
 
   NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
 
   DoReflow(aPresContext, aMetrics, aReflowState, aStatus);
 
   FinishAndStoreOverflow(&aMetrics);
   return NS_OK;
 }
@@ -98,21 +98,21 @@ nsLeafFrame::GetIntrinsicHeight()
 }
 
 // XXX how should border&padding effect baseline alignment?
 // => descent = borderPadding.bottom for example
 void
 nsLeafFrame::AddBordersAndPadding(const nsHTMLReflowState& aReflowState,
                                   nsHTMLReflowMetrics& aMetrics)
 {
-  aMetrics.width += aReflowState.mComputedBorderPadding.LeftRight();
-  aMetrics.height += aReflowState.mComputedBorderPadding.TopBottom();
+  aMetrics.width += aReflowState.ComputedPhysicalBorderPadding().LeftRight();
+  aMetrics.height += aReflowState.ComputedPhysicalBorderPadding().TopBottom();
 }
 
 void
 nsLeafFrame::SizeToAvailSize(const nsHTMLReflowState& aReflowState,
                              nsHTMLReflowMetrics& aDesiredSize)
 {
-  aDesiredSize.width  = aReflowState.availableWidth; // FRAME
-  aDesiredSize.height = aReflowState.availableHeight;
+  aDesiredSize.width  = aReflowState.AvailableWidth(); // FRAME
+  aDesiredSize.height = aReflowState.AvailableHeight();
   aDesiredSize.SetOverflowAreasToDesiredBounds();
   FinishAndStoreOverflow(&aDesiredSize);  
 }
--- a/layout/generic/nsLineLayout.cpp
+++ b/layout/generic/nsLineLayout.cpp
@@ -770,23 +770,23 @@ nsLineLayout::ReflowFrame(nsIFrame* aFra
   Maybe<nsHTMLReflowState> reflowStateHolder;
   if (!isText) {
     reflowStateHolder.construct(mPresContext, *psd->mReflowState,
                                 aFrame, availSize);
     nsHTMLReflowState& reflowState = reflowStateHolder.ref();
     reflowState.mLineLayout = this;
     reflowState.mFlags.mIsTopOfPage = mIsTopOfPage;
     if (reflowState.ComputedWidth() == NS_UNCONSTRAINEDSIZE)
-      reflowState.availableWidth = availableSpaceOnLine;
-    pfd->mMargin = reflowState.mComputedMargin;
-    pfd->mBorderPadding = reflowState.mComputedBorderPadding;
+      reflowState.AvailableWidth() = availableSpaceOnLine;
+    pfd->mMargin = reflowState.ComputedPhysicalMargin();
+    pfd->mBorderPadding = reflowState.ComputedPhysicalBorderPadding();
     pfd->SetFlag(PFD_RELATIVEPOS,
                  reflowState.mStyleDisplay->IsRelativelyPositionedStyle());
     if (pfd->GetFlag(PFD_RELATIVEPOS)) {
-      pfd->mOffsets = reflowState.mComputedOffsets;
+      pfd->mOffsets = reflowState.ComputedPhysicalOffsets();
     }
 
     // Apply start margins (as appropriate) to the frame computing the
     // new starting x,y coordinates for the frame.
     ApplyStartMargin(pfd, reflowState);
   } else {
     pfd->mMargin.SizeTo(0, 0, 0, 0);
     pfd->mBorderPadding.SizeTo(0, 0, 0, 0);
@@ -1078,26 +1078,26 @@ nsLineLayout::ApplyStartMargin(PerFrameD
     if (ltr)
       pfd->mMargin.left = 0;
     else
       pfd->mMargin.right = 0;
   }
   else {
     pfd->mBounds.x += ltr ? pfd->mMargin.left : pfd->mMargin.right;
 
-    NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth,
+    NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aReflowState.AvailableWidth(),
                      "have unconstrained width; this should only result from "
                      "very large sizes, not attempts at intrinsic width "
                      "calculation");
     if (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedWidth()) {
       // For inline-ish and text-ish things (which don't compute widths
       // in the reflow state), adjust available width to account for the
       // left margin. The right margin will be accounted for when we
       // finish flowing the frame.
-      aReflowState.availableWidth -= ltr ? pfd->mMargin.left : pfd->mMargin.right;
+      aReflowState.AvailableWidth() -= ltr ? pfd->mMargin.left : pfd->mMargin.right;
     }
   }
 }
 
 nscoord
 nsLineLayout::GetCurrentFrameXDistanceFromBlock()
 {
   PerSpanData* psd;
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -452,23 +452,23 @@ nsObjectFrame::GetDesiredSize(nsPresCont
   aMetrics.width = aReflowState.ComputedWidth();
   aMetrics.height = aReflowState.ComputedHeight();
 
   // for EMBED and APPLET, default to 240x200 for compatibility
   nsIAtom *atom = mContent->Tag();
   if (atom == nsGkAtoms::applet || atom == nsGkAtoms::embed) {
     if (aMetrics.width == NS_UNCONSTRAINEDSIZE) {
       aMetrics.width = clamped(nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_WIDTH),
-                               aReflowState.mComputedMinWidth,
-                               aReflowState.mComputedMaxWidth);
+                               aReflowState.ComputedMinWidth(),
+                               aReflowState.ComputedMaxWidth());
     }
     if (aMetrics.height == NS_UNCONSTRAINEDSIZE) {
       aMetrics.height = clamped(nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_HEIGHT),
-                                aReflowState.mComputedMinHeight,
-                                aReflowState.mComputedMaxHeight);
+                                aReflowState.ComputedMinHeight(),
+                                aReflowState.ComputedMaxHeight());
     }
 
 #if defined(MOZ_WIDGET_GTK)
     // We need to make sure that the size of the object frame does not
     // exceed the maximum size of X coordinates.  See bug #225357 for
     // more information.  In theory Gtk2 can handle large coordinates,
     // but underlying plugins can't.
     aMetrics.height = std::min(aPresContext->DevPixelsToAppUnits(INT16_MAX), aMetrics.height);
@@ -476,28 +476,28 @@ nsObjectFrame::GetDesiredSize(nsPresCont
 #endif
   }
 
   // At this point, the width has an unconstrained value only if we have
   // nothing to go on (no width set, no information from the plugin, nothing).
   // Make up a number.
   if (aMetrics.width == NS_UNCONSTRAINEDSIZE) {
     aMetrics.width =
-      (aReflowState.mComputedMinWidth != NS_UNCONSTRAINEDSIZE) ?
-        aReflowState.mComputedMinWidth : 0;
+      (aReflowState.ComputedMinWidth() != NS_UNCONSTRAINEDSIZE) ?
+        aReflowState.ComputedMinWidth() : 0;
   }
 
   // At this point, the height has an unconstrained value only in two cases:
   // a) We are in standards mode with percent heights and parent is auto-height
   // b) We have no height information at all.
   // In either case, we have to make up a number.
   if (aMetrics.height == NS_UNCONSTRAINEDSIZE) {
     aMetrics.height =
-      (aReflowState.mComputedMinHeight != NS_UNCONSTRAINEDSIZE) ?
-        aReflowState.mComputedMinHeight : 0;
+      (aReflowState.ComputedMinHeight() != NS_UNCONSTRAINEDSIZE) ?
+        aReflowState.ComputedMinHeight() : 0;
   }
 
   // XXXbz don't add in the border and padding, because we screw up our
   // plugin's size and positioning if we do...  Eventually we _do_ want to
   // paint borders, though!  At that point, we will need to adjust the desired
   // size either here or in Reflow....  Further, we will need to fix Paint() to
   // call the superclass in all cases.
 }
@@ -526,17 +526,17 @@ nsObjectFrame::Reflow(nsPresContext*    
 
   // if we are printing or print previewing, bail for now
   if (aPresContext->Medium() == nsGkAtoms::print) {
     aStatus = NS_FRAME_COMPLETE;
     return NS_OK;
   }
 
   nsRect r(0, 0, aMetrics.width, aMetrics.height);
-  r.Deflate(aReflowState.mComputedBorderPadding);
+  r.Deflate(aReflowState.ComputedPhysicalBorderPadding());
 
   if (mInnerView) {
     nsViewManager* vm = mInnerView->GetViewManager();
     vm->MoveViewTo(mInnerView, r.x, r.y);
     vm->ResizeView(mInnerView, nsRect(nsPoint(0, 0), r.Size()), true);
   }
 
   FixupWindow(r.Size());
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -96,17 +96,17 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsPres
     // Use the margins given in the @page rule.
     // If a margin is 'auto', use the margin from the print settings for that side.
     nsMargin pageContentMargin;
     const nsStyleSides& marginStyle = kidReflowState.mStyleMargin->mMargin;
     NS_FOR_CSS_SIDES(side) {
       if (marginStyle.GetUnit(side) == eStyleUnit_Auto) {
         pageContentMargin.Side(side) = mPD->mReflowMargin.Side(side);
       } else {
-        pageContentMargin.Side(side) = kidReflowState.mComputedMargin.Side(side);
+        pageContentMargin.Side(side) = kidReflowState.ComputedPhysicalMargin().Side(side);
       }
     }
 
 
     nscoord maxWidth = maxSize.width - pageContentMargin.LeftRight() / scale;
     nscoord maxHeight;
     if (maxSize.height == NS_UNCONSTRAINEDSIZE) {
       maxHeight = NS_UNCONSTRAINEDSIZE;
@@ -139,29 +139,29 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsPres
 
     // Place and size the child
     FinishReflowChild(frame, aPresContext, &kidReflowState, aDesiredSize, xc, yc, 0);
 
     NS_ASSERTION(!NS_FRAME_IS_FULLY_COMPLETE(aStatus) ||
                  !frame->GetNextInFlow(), "bad child flow list");
   }
   PR_PL(("PageFrame::Reflow %p ", this));
-  PR_PL(("[%d,%d][%d,%d]\n", aDesiredSize.width, aDesiredSize.height, aReflowState.availableWidth, aReflowState.availableHeight));
+  PR_PL(("[%d,%d][%d,%d]\n", aDesiredSize.width, aDesiredSize.height, aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
 
   // Return our desired size
-  aDesiredSize.width = aReflowState.availableWidth;
-  if (aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE) {
-    aDesiredSize.height = aReflowState.availableHeight;
+  aDesiredSize.width = aReflowState.AvailableWidth();
+  if (aReflowState.AvailableHeight() != NS_UNCONSTRAINEDSIZE) {
+    aDesiredSize.height = aReflowState.AvailableHeight();
   }
 
   aDesiredSize.SetOverflowAreasToDesiredBounds();
   FinishAndStoreOverflow(&aDesiredSize);
 
   PR_PL(("PageFrame::Reflow %p ", this));
-  PR_PL(("[%d,%d]\n", aReflowState.availableWidth, aReflowState.availableHeight));
+  PR_PL(("[%d,%d]\n", aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
   return NS_OK;
 }
 
 nsIAtom*
 nsPageFrame::GetType() const
 {
@@ -657,18 +657,18 @@ nsPageBreakFrame::Reflow(nsPresContext* 
                          nsReflowStatus&          aStatus)
 {
   DO_GLOBAL_REFLOW_COUNT("nsPageBreakFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
 
   // Override reflow, since we don't want to deal with what our
   // computed values are.
   aDesiredSize.width = GetIntrinsicWidth();
-  aDesiredSize.height = (aReflowState.availableHeight == NS_UNCONSTRAINEDSIZE ?
-                         0 : aReflowState.availableHeight);
+  aDesiredSize.height = (aReflowState.AvailableHeight() == NS_UNCONSTRAINEDSIZE ?
+                         0 : aReflowState.AvailableHeight());
   // round the height down to the nearest pixel
   aDesiredSize.height -=
     aDesiredSize.height % nsPresContext::CSSPixelsToAppUnits(1);
 
   // Note: not using NS_FRAME_FIRST_REFLOW here, since it's not clear whether
   // DidReflow will always get called before the next Reflow() call.
   mHaveReflowed = true;
   aStatus = NS_FRAME_COMPLETE; 
--- a/layout/generic/nsSimplePageSequence.cpp
+++ b/layout/generic/nsSimplePageSequence.cpp
@@ -106,17 +106,17 @@ nsSimplePageSequenceFrame::SetDesiredSiz
                                           const nsHTMLReflowState& aReflowState,
                                           nscoord aWidth,
                                           nscoord aHeight)
 {
     // Aim to fill the whole size of the document, not only so we
     // can act as a background in print preview but also handle overflow
     // in child page frames correctly.
     // Use availableWidth so we don't cause a needless horizontal scrollbar.
-    aDesiredSize.width = std::max(aReflowState.availableWidth,
+    aDesiredSize.width = std::max(aReflowState.AvailableWidth(),
                                 nscoord(aWidth * PresContext()->GetPrintPreviewScale()));
     aDesiredSize.height = std::max(aReflowState.ComputedHeight(),
                                  nscoord(aHeight * PresContext()->GetPrintPreviewScale()));
 }
 
 NS_IMETHODIMP
 nsSimplePageSequenceFrame::Reflow(nsPresContext*          aPresContext,
                                   nsHTMLReflowMetrics&     aDesiredSize,
@@ -206,21 +206,21 @@ nsSimplePageSequenceFrame::Reflow(nsPres
     nsPageFrame * pf = static_cast<nsPageFrame*>(kidFrame);
     pf->SetSharedPageData(mPageData);
 
     // Reflow the page
     nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,
                                      pageSize);
     nsReflowStatus  status;
 
-    kidReflowState.SetComputedWidth(kidReflowState.availableWidth);
-    //kidReflowState.SetComputedHeight(kidReflowState.availableHeight);
-    PR_PL(("AV W: %d   H: %d\n", kidReflowState.availableWidth, kidReflowState.availableHeight));
+    kidReflowState.SetComputedWidth(kidReflowState.AvailableWidth());
+    //kidReflowState.SetComputedHeight(kidReflowState.AvailableHeight());
+    PR_PL(("AV W: %d   H: %d\n", kidReflowState.AvailableWidth(), kidReflowState.AvailableHeight()));
 
-    nsMargin pageCSSMargin = kidReflowState.mComputedMargin;
+    nsMargin pageCSSMargin = kidReflowState.ComputedPhysicalMargin();
     y += pageCSSMargin.top;
     const nscoord x = pageCSSMargin.left;
 
     // Place and size the page. If the page is narrower than our
     // max width then center it horizontally
     ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, x, y, 0, status);
 
     FinishReflowChild(kidFrame, aPresContext, nullptr, kidSize, x, y, 0);
--- a/layout/generic/nsSplittableFrame.cpp
+++ b/layout/generic/nsSplittableFrame.cpp
@@ -232,17 +232,17 @@ nsSplittableFrame::GetEffectiveComputedH
     aConsumedHeight = GetConsumedHeight();
   }
 
   height -= aConsumedHeight;
 
   if (aConsumedHeight != 0 && aConsumedHeight != NS_INTRINSICSIZE) {
     // We just subtracted our top-border padding, since it was included in the
     // first frame's height. Add it back to get the content height.
-    height += aReflowState.mComputedBorderPadding.top;
+    height += aReflowState.ComputedPhysicalBorderPadding().top;
   }
 
   // We may have stretched the frame beyond its computed height. Oh well.
   height = std::max(0, height);
 
   return height;
 }
 
@@ -260,19 +260,19 @@ nsSplittableFrame::GetSkipSides(const ns
   }
 
   if (aReflowState) {
     // We're in the midst of reflow right now, so it's possible that we haven't
     // created a nif yet. If our content height is going to exceed our available
     // height, though, then we're going to need a next-in-flow, it just hasn't
     // been created yet.
 
-    if (NS_UNCONSTRAINEDSIZE != aReflowState->availableHeight) {
+    if (NS_UNCONSTRAINEDSIZE != aReflowState->AvailableHeight()) {
       nscoord effectiveCH = this->GetEffectiveComputedHeight(*aReflowState);
-      if (effectiveCH > aReflowState->availableHeight) {
+      if (effectiveCH > aReflowState->AvailableHeight()) {
         // Our content height is going to exceed our available height, so we're
         // going to need a next-in-flow.
         skip |= 1 << NS_SIDE_BOTTOM;
       }
     }
   } else {
     nsIFrame* nif = GetNextInFlow();
     if (nif && !IS_TRUE_OVERFLOW_CONTAINER(nif)) {
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -629,39 +629,39 @@ nsSubDocumentFrame::ComputeSize(nsRender
 NS_IMETHODIMP
 nsSubDocumentFrame::Reflow(nsPresContext*           aPresContext,
                            nsHTMLReflowMetrics&     aDesiredSize,
                            const nsHTMLReflowState& aReflowState,
                            nsReflowStatus&          aStatus)
 {
   DO_GLOBAL_REFLOW_COUNT("nsSubDocumentFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
-  // printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);
+  // printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.AvailableWidth(), aReflowState.AvailableHeight());
   NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
      ("enter nsSubDocumentFrame::Reflow: maxSize=%d,%d",
-      aReflowState.availableWidth, aReflowState.availableHeight));
+      aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
 
   aStatus = NS_FRAME_COMPLETE;
 
   NS_ASSERTION(mContent->GetPrimaryFrame() == this,
                "Shouldn't happen");
 
   // XUL <iframe> or <browser>, or HTML <iframe>, <object> or <embed>
   nsresult rv = nsLeafFrame::DoReflow(aPresContext, aDesiredSize, aReflowState,
                                       aStatus);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // "offset" is the offset of our content area from our frame's
   // top-left corner.
-  nsPoint offset = nsPoint(aReflowState.mComputedBorderPadding.left,
-                           aReflowState.mComputedBorderPadding.top);
+  nsPoint offset = nsPoint(aReflowState.ComputedPhysicalBorderPadding().left,
+                           aReflowState.ComputedPhysicalBorderPadding().top);
 
   nsSize innerSize(aDesiredSize.width, aDesiredSize.height);
-  innerSize.width  -= aReflowState.mComputedBorderPadding.LeftRight();
-  innerSize.height -= aReflowState.mComputedBorderPadding.TopBottom();
+  innerSize.width  -= aReflowState.ComputedPhysicalBorderPadding().LeftRight();
+  innerSize.height -= aReflowState.ComputedPhysicalBorderPadding().TopBottom();
 
   if (mInnerView) {
     nsViewManager* vm = mInnerView->GetViewManager();
     vm->MoveViewTo(mInnerView, offset.x, offset.y);
     vm->ResizeView(mInnerView, nsRect(nsPoint(0, 0), innerSize), true);
   }
 
   aDesiredSize.SetOverflowAreasToDesiredBounds();
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -7587,17 +7587,17 @@ nsTextFrame::Reflow(nsPresContext*      
   // frame. This may happen if, for example, this is text inside a table
   // but not inside a cell. For now, just don't reflow.
   if (!aReflowState.mLineLayout) {
     ClearMetrics(aMetrics);
     aStatus = NS_FRAME_COMPLETE;
     return NS_OK;
   }
 
-  ReflowText(*aReflowState.mLineLayout, aReflowState.availableWidth,
+  ReflowText(*aReflowState.mLineLayout, aReflowState.AvailableWidth(),
              aReflowState.rendContext, aMetrics, aStatus);
 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
   return NS_OK;
 }
 
 #ifdef ACCESSIBILITY
 /**
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -242,42 +242,42 @@ nsVideoFrame::Reflow(nsPresContext*     
                      nsHTMLReflowMetrics&     aMetrics,
                      const nsHTMLReflowState& aReflowState,
                      nsReflowStatus&          aStatus)
 {
   DO_GLOBAL_REFLOW_COUNT("nsVideoFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
   NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
                   ("enter nsVideoFrame::Reflow: availSize=%d,%d",
-                  aReflowState.availableWidth, aReflowState.availableHeight));
+                  aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
 
   NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
 
   aStatus = NS_FRAME_COMPLETE;
 
   aMetrics.width = aReflowState.ComputedWidth();
   aMetrics.height = aReflowState.ComputedHeight();
 
   // stash this away so we can compute our inner area later
-  mBorderPadding   = aReflowState.mComputedBorderPadding;
+  mBorderPadding   = aReflowState.ComputedPhysicalBorderPadding();
 
   aMetrics.width += mBorderPadding.left + mBorderPadding.right;
   aMetrics.height += mBorderPadding.top + mBorderPadding.bottom;
 
   // Reflow the child frames. We may have up to two, an image frame
   // which is the poster, and a box frame, which is the video controls.
   for (nsIFrame *child = mFrames.FirstChild();
        child;
        child = child->GetNextSibling()) {
     if (child->GetContent() == mPosterImage) {
       // Reflow the poster frame.
       nsImageFrame* imageFrame = static_cast<nsImageFrame*>(child);
       nsHTMLReflowMetrics kidDesiredSize;
-      nsSize availableSize = nsSize(aReflowState.availableWidth,
-                                    aReflowState.availableHeight);
+      nsSize availableSize = nsSize(aReflowState.AvailableWidth(),
+                                    aReflowState.AvailableHeight());
       nsHTMLReflowState kidReflowState(aPresContext,
                                        aReflowState,
                                        imageFrame,
                                        availableSize,
                                        aMetrics.width,
                                        aMetrics.height);
 
       uint32_t posterHeight, posterWidth;
@@ -319,27 +319,27 @@ nsVideoFrame::Reflow(nsPresContext*     
                                        aReflowState.ComputedHeight()));
       if (child->GetSize() != size) {
         nsRefPtr<nsRunnable> event = new DispatchResizeToControls(child->GetContent());
         nsContentUtils::AddScriptRunner(event);
       }
     } else if (child->GetContent() == mCaptionDiv) {
       // Reflow to caption div
       nsHTMLReflowMetrics kidDesiredSize;
-      nsSize availableSize = nsSize(aReflowState.availableWidth,
-                                    aReflowState.availableHeight);
+      nsSize availableSize = nsSize(aReflowState.AvailableWidth(),
+                                    aReflowState.AvailableHeight());
       nsHTMLReflowState kidReflowState(aPresContext,
                                        aReflowState,
                                        child,
                                        availableSize,
                                        aMetrics.width,
                                        aMetrics.height);
       nsSize size(aReflowState.ComputedWidth(), aReflowState.ComputedHeight());
-      size.width -= kidReflowState.mComputedBorderPadding.LeftRight();
-      size.height -= kidReflowState.mComputedBorderPadding.TopBottom();
+      size.width -= kidReflowState.ComputedPhysicalBorderPadding().LeftRight();
+      size.height -= kidReflowState.ComputedPhysicalBorderPadding().TopBottom();
 
       kidReflowState.SetComputedWidth(std::max(size.width, 0));
       kidReflowState.SetComputedHeight(std::max(size.height, 0));
 
       ReflowChild(child, aPresContext, kidDesiredSize, kidReflowState,
                   mBorderPadding.left, mBorderPadding.top, 0, aStatus);
       FinishReflowChild(child, aPresContext,
                         &kidReflowState, kidDesiredSize,
--- a/layout/generic/nsViewportFrame.cpp
+++ b/layout/generic/nsViewportFrame.cpp
@@ -134,17 +134,17 @@ ViewportFrame::AdjustReflowStateForScrol
   // Get our prinicpal child frame and see if we're scrollable
   nsIFrame* kidFrame = mFrames.FirstChild();
   nsIScrollableFrame* scrollingFrame = do_QueryFrame(kidFrame);
 
   if (scrollingFrame) {
     nsMargin scrollbars = scrollingFrame->GetActualScrollbarSizes();
     aReflowState->SetComputedWidth(aReflowState->ComputedWidth() -
                                    scrollbars.LeftRight());
-    aReflowState->availableWidth -= scrollbars.LeftRight();
+    aReflowState->AvailableWidth() -= scrollbars.LeftRight();
     aReflowState->SetComputedHeightWithoutResettingResizeFlags(
       aReflowState->ComputedHeight() - scrollbars.TopBottom());
     return nsPoint(scrollbars.left, scrollbars.top);
   }
   return nsPoint(0, 0);
 }
 
 nsRect
@@ -206,60 +206,60 @@ ViewportFrame::Reflow(nsPresContext*    
     // Deal with a non-incremental reflow or an incremental reflow
     // targeted at our one-and-only principal child frame.
     if (aReflowState.ShouldReflowAllKids() ||
         aReflowState.mFlags.mVResize ||
         NS_SUBTREE_DIRTY(mFrames.FirstChild())) {
       // Reflow our one-and-only principal child frame
       nsIFrame*           kidFrame = mFrames.FirstChild();
       nsHTMLReflowMetrics kidDesiredSize;
-      nsSize              availableSpace(aReflowState.availableWidth,
-                                         aReflowState.availableHeight);
+      nsSize              availableSpace(aReflowState.AvailableWidth(),
+                                         aReflowState.AvailableHeight());
       nsHTMLReflowState   kidReflowState(aPresContext, aReflowState,
                                          kidFrame, availableSpace);
 
       // Reflow the frame
       kidReflowState.SetComputedHeight(aReflowState.ComputedHeight());
       rv = ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
                        0, 0, 0, aStatus);
       kidHeight = kidDesiredSize.height;
 
       FinishReflowChild(kidFrame, aPresContext, nullptr, kidDesiredSize, 0, 0, 0);
     } else {
       kidHeight = mFrames.FirstChild()->GetSize().height;
     }
   }
 
-  NS_ASSERTION(aReflowState.availableWidth != NS_UNCONSTRAINEDSIZE,
+  NS_ASSERTION(aReflowState.AvailableWidth() != NS_UNCONSTRAINEDSIZE,
                "shouldn't happen anymore");
 
   // Return the max size as our desired size
-  aDesiredSize.width = aReflowState.availableWidth;
+  aDesiredSize.width = aReflowState.AvailableWidth();
   // Being flowed initially at an unconstrained height means we should
   // return our child's intrinsic size.
   aDesiredSize.height = aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE
                           ? aReflowState.ComputedHeight()
                           : kidHeight;
   aDesiredSize.SetOverflowAreasToDesiredBounds();
 
   if (mFrames.NotEmpty()) {
     ConsiderChildOverflow(aDesiredSize.mOverflowAreas, mFrames.FirstChild());
   }
 
   if (IsAbsoluteContainer()) {
     // Make a copy of the reflow state and change the computed width and height
     // to reflect the available space for the fixed items
     nsHTMLReflowState reflowState(aReflowState);
 
-    if (reflowState.availableHeight == NS_UNCONSTRAINEDSIZE) {
+    if (reflowState.AvailableHeight() == NS_UNCONSTRAINEDSIZE) {
       // We have an intrinsic-height document with abs-pos/fixed-pos children.
       // Set the available height and mComputedHeight to our chosen height.
-      reflowState.availableHeight = aDesiredSize.height;
+      reflowState.AvailableHeight() = aDesiredSize.height;
       // Not having border/padding simplifies things
-      NS_ASSERTION(reflowState.mComputedBorderPadding == nsMargin(0,0,0,0),
+      NS_ASSERTION(reflowState.ComputedPhysicalBorderPadding() == nsMargin(0,0,0,0),
                    "Viewports can't have border/padding");
       reflowState.SetComputedHeight(aDesiredSize.height);
     }
 
     nsRect rect = AdjustReflowStateAsContainingBlock(&reflowState);
 
     // Just reflow all the fixed-pos frames.
     rv = GetAbsoluteContainingBlock()->Reflow(this, aPresContext, reflowState, aStatus,
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -5164,18 +5164,18 @@ SVGTextFrame::DoReflow()
 
   nscoord width = kid->GetPrefWidth(renderingContext);
   nsHTMLReflowState reflowState(presContext, kid,
                                 renderingContext,
                                 nsSize(width, NS_UNCONSTRAINEDSIZE));
   nsHTMLReflowMetrics desiredSize;
   nsReflowStatus status;
 
-  NS_ASSERTION(reflowState.mComputedBorderPadding == nsMargin(0, 0, 0, 0) &&
-               reflowState.mComputedMargin == nsMargin(0, 0, 0, 0),
+  NS_ASSERTION(reflowState.ComputedPhysicalBorderPadding() == nsMargin(0, 0, 0, 0) &&
+               reflowState.ComputedPhysicalMargin() == nsMargin(0, 0, 0, 0),
                "style system should ensure that :-moz-svg-text "
                "does not get styled");
 
   kid->WillReflow(presContext);
   kid->Reflow(presContext, desiredSize, reflowState, status);
   kid->DidReflow(presContext, &reflowState, nsDidReflowStatus::FINISHED);
   kid->SetSize(nsSize(desiredSize.width, desiredSize.height));
 
--- a/layout/svg/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/nsSVGForeignObjectFrame.cpp
@@ -553,18 +553,18 @@ nsSVGForeignObjectFrame::DoReflow()
   nsHTMLReflowState reflowState(presContext, kid,
                                 renderingContext,
                                 nsSize(mRect.width, NS_UNCONSTRAINEDSIZE));
   nsHTMLReflowMetrics desiredSize;
   nsReflowStatus status;
 
   // We don't use mRect.height above because that tells the child to do
   // page/column breaking at that height.
-  NS_ASSERTION(reflowState.mComputedBorderPadding == nsMargin(0, 0, 0, 0) &&
-               reflowState.mComputedMargin == nsMargin(0, 0, 0, 0),
+  NS_ASSERTION(reflowState.ComputedPhysicalBorderPadding() == nsMargin(0, 0, 0, 0) &&
+               reflowState.ComputedPhysicalMargin() == nsMargin(0, 0, 0, 0),
                "style system should ensure that :-moz-svg-foreign-content "
                "does not get styled");
   NS_ASSERTION(reflowState.ComputedWidth() == mRect.width,
                "reflow state made child wrong size");
   reflowState.SetComputedHeight(mRect.height);
 
   ReflowChild(kid, presContext, desiredSize, reflowState, 0, 0,
               NS_FRAME_NO_MOVE_FRAME, status);
--- a/layout/svg/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/nsSVGOuterSVGFrame.cpp
@@ -311,26 +311,26 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext
                            nsHTMLReflowMetrics&     aDesiredSize,
                            const nsHTMLReflowState& aReflowState,
                            nsReflowStatus&          aStatus)
 {
   DO_GLOBAL_REFLOW_COUNT("nsSVGOuterSVGFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
   NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
                   ("enter nsSVGOuterSVGFrame::Reflow: availSize=%d,%d",
-                  aReflowState.availableWidth, aReflowState.availableHeight));
+                  aReflowState.AvailableWidth(), aReflowState.AvailableHeight()));
 
   NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
 
   aStatus = NS_FRAME_COMPLETE;
 
   aDesiredSize.width  = aReflowState.ComputedWidth() +
-                          aReflowState.mComputedBorderPadding.LeftRight();
+                          aReflowState.ComputedPhysicalBorderPadding().LeftRight();
   aDesiredSize.height = aReflowState.ComputedHeight() +
-                          aReflowState.mComputedBorderPadding.TopBottom();
+                          aReflowState.ComputedPhysicalBorderPadding().TopBottom();
 
   NS_ASSERTION(!GetPrevInFlow(), "SVG can't currently be broken across pages.");
 
   SVGSVGElement *svgElem = static_cast<SVGSVGElement*>(mContent);
 
   nsSVGOuterSVGAnonChildFrame *anonKid =
     static_cast<nsSVGOuterSVGAnonChildFrame*>(GetFirstPrincipalChild());
 
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -839,19 +839,19 @@ NS_METHOD nsTableCellFrame::Reflow(nsPre
   if (aReflowState.mFlags.mSpecialHeightReflow) {
     FirstInFlow()->AddStateBits(NS_TABLE_CELL_HAD_SPECIAL_REFLOW);
   }
 
   // see if a special height reflow needs to occur due to having a pct height
   nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
 
   aStatus = NS_FRAME_COMPLETE;
-  nsSize availSize(aReflowState.availableWidth, aReflowState.availableHeight);
+  nsSize availSize(aReflowState.AvailableWidth(), aReflowState.AvailableHeight());
 
-  nsMargin borderPadding = aReflowState.mComputedPadding;
+  nsMargin borderPadding = aReflowState.ComputedPhysicalPadding();
   nsMargin border;
   GetBorderWidth(border);
   borderPadding += border;
 
   nscoord topInset    = borderPadding.top;
   nscoord rightInset  = borderPadding.right;
   nscoord bottomInset = borderPadding.bottom;
   nscoord leftInset   = borderPadding.left;
@@ -863,17 +863,17 @@ NS_METHOD nsTableCellFrame::Reflow(nsPre
 
   // Try to reflow the child into the available space. It might not
   // fit or might need continuing.
   if (availSize.height < 0)
     availSize.height = 1;
 
   nsHTMLReflowMetrics kidSize(aDesiredSize.mFlags);
   kidSize.width = kidSize.height = 0;
-  SetPriorAvailWidth(aReflowState.availableWidth);
+  SetPriorAvailWidth(aReflowState.AvailableWidth());
   nsIFrame* firstKid = mFrames.FirstChild();
   NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame");
   nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
 
   if (aReflowState.mFlags.mSpecialHeightReflow) {
     const_cast<nsHTMLReflowState&>(aReflowState).SetComputedHeight(mRect.height - topInset - bottomInset);
     DISPLAY_REFLOW_CHANGE();
   }
@@ -976,17 +976,17 @@ NS_METHOD nsTableCellFrame::Reflow(nsPre
   // the overflow area will be computed when the child will be vertically aligned
 
   if (aReflowState.mFlags.mSpecialHeightReflow) {
     if (aDesiredSize.height > mRect.height) {
       // set a bit indicating that the pct height contents exceeded
       // the height that they could honor in the pass 2 reflow
       SetHasPctOverHeight(true);
     }
-    if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) {
+    if (NS_UNCONSTRAINEDSIZE == aReflowState.AvailableHeight()) {
       aDesiredSize.height = mRect.height;
     }
   }
 
   // If our parent is in initial reflow, it'll handle invalidating our
   // entire overflow rect.
   if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
       nsSize(aDesiredSize.width, aDesiredSize.height) != mRect.Size()) {
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -101,17 +101,17 @@ struct nsTableReflowState {
     }
   }
 
   nsTableReflowState(nsPresContext&           aPresContext,
                      const nsHTMLReflowState& aReflowState,
                      nsTableFrame&            aTableFrame)
     : reflowState(aReflowState)
   {
-    Init(aPresContext, aTableFrame, aReflowState.availableWidth, aReflowState.availableHeight);
+    Init(aPresContext, aTableFrame, aReflowState.AvailableWidth(), aReflowState.AvailableHeight());
   }
 
 };
 
 /********************************************************************************
  ** nsTableFrame                                                               **
  ********************************************************************************/
 
@@ -1697,17 +1697,17 @@ NS_METHOD nsTableFrame::Reflow(nsPresCon
   }
   nsresult rv = NS_OK;
 
   // see if collapsing borders need to be calculated
   if (!GetPrevInFlow() && IsBorderCollapse() && NeedToCalcBCBorders()) {
     CalcBCBorders();
   }
 
-  aDesiredSize.width = aReflowState.availableWidth;
+  aDesiredSize.width = aReflowState.AvailableWidth();
 
   // Check for an overflow list, and append any row group frames being pushed
   MoveOverflowToChildList(aPresContext);
 
   bool haveDesiredHeight = false;
   SetHaveReflowedColGroups(false);
 
   // Reflow the entire table (pass 2 and possibly pass 3). This phase is necessary during a
@@ -1733,17 +1733,17 @@ NS_METHOD nsTableFrame::Reflow(nsPresCon
       // internal table frames, which restores them to their state before
       // DistributeHeightToRows was called.
       SetGeometryDirty();
     }
 
     bool needToInitiateSpecialReflow =
       !!(GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT);
     // see if an extra reflow will be necessary in pagination mode when there is a specified table height
-    if (isPaginated && !GetPrevInFlow() && (NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight)) {
+    if (isPaginated && !GetPrevInFlow() && (NS_UNCONSTRAINEDSIZE != aReflowState.AvailableHeight())) {
       nscoord tableSpecifiedHeight = CalcBorderBoxHeight(aReflowState);
       if ((tableSpecifiedHeight > 0) &&
           (tableSpecifiedHeight != NS_UNCONSTRAINEDSIZE)) {
         needToInitiateSpecialReflow = true;
       }
     }
     nsIFrame* lastChildReflowed = nullptr;
 
@@ -1752,17 +1752,17 @@ NS_METHOD nsTableFrame::Reflow(nsPresCon
 
     // do the pass 2 reflow unless this is a special height reflow and we will be
     // initiating a special height reflow
     // XXXldb I changed this.  Should I change it back?
 
     // if we need to initiate a special height reflow, then don't constrain the
     // height of the reflow before that
     nscoord availHeight = needToInitiateSpecialReflow
-                          ? NS_UNCONSTRAINEDSIZE : aReflowState.availableHeight;
+                          ? NS_UNCONSTRAINEDSIZE : aReflowState.AvailableHeight();
 
     ReflowTable(aDesiredSize, aReflowState, availHeight,
                 lastChildReflowed, aStatus);
 
     // reevaluate special height reflow conditions
     if (GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT)
       needToInitiateSpecialReflow = true;
 
@@ -1772,17 +1772,17 @@ NS_METHOD nsTableFrame::Reflow(nsPresCon
 
       nsHTMLReflowState &mutable_rs =
         const_cast<nsHTMLReflowState&>(aReflowState);
 
       // distribute extra vertical space to rows
       CalcDesiredHeight(aReflowState, aDesiredSize);
       mutable_rs.mFlags.mSpecialHeightReflow = true;
 
-      ReflowTable(aDesiredSize, aReflowState, aReflowState.availableHeight,
+      ReflowTable(aDesiredSize, aReflowState, aReflowState.AvailableHeight(),
                   lastChildReflowed, aStatus);
 
       if (lastChildReflowed && NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
         // if there is an incomplete child, then set the desired height to include it but not the next one
         nsMargin borderPadding = GetChildAreaOffset(&aReflowState);
         aDesiredSize.height = borderPadding.bottom + GetCellSpacingY() +
                               lastChildReflowed->GetRect().YMost();
       }
@@ -1794,28 +1794,28 @@ NS_METHOD nsTableFrame::Reflow(nsPresCon
   else {
     // Calculate the overflow area contribution from our children.
     for (nsIFrame* kid = GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) {
       ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kid);
     }
   }
 
   aDesiredSize.width = aReflowState.ComputedWidth() +
-                       aReflowState.mComputedBorderPadding.LeftRight();
+                       aReflowState.ComputedPhysicalBorderPadding().LeftRight();
   if (!haveDesiredHeight) {
     CalcDesiredHeight(aReflowState, aDesiredSize);
   }
   if (IsRowInserted()) {
     ProcessRowInserted(aDesiredSize.height);
   }
 
   nsMargin borderPadding = GetChildAreaOffset(&aReflowState);
   SetColumnDimensions(aDesiredSize.height, borderPadding);
   if (NeedToCollapse() &&
-      (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth)) {
+      (NS_UNCONSTRAINEDSIZE != aReflowState.AvailableWidth())) {
     AdjustForCollapsingRowsCols(aDesiredSize, borderPadding);
   }
 
   // make sure the table overflow area does include the table rect.
   nsRect tableRect(0, 0, aDesiredSize.width, aDesiredSize.height) ;
 
   if (!ShouldApplyOverflowClipping(this, aReflowState.mStyleDisplay)) {
     // collapsed border may leak out
@@ -1863,17 +1863,17 @@ nsTableFrame::ReflowTable(nsHTMLReflowMe
   aLastChildReflowed = nullptr;
 
   if (!GetPrevInFlow()) {
     mTableLayoutStrategy->ComputeColumnWidths(aReflowState);
   }
   // Constrain our reflow width to the computed table width (of the 1st in flow).
   // and our reflow height to our avail height minus border, padding, cellspacing
   aDesiredSize.width = aReflowState.ComputedWidth() +
-                       aReflowState.mComputedBorderPadding.LeftRight();
+                       aReflowState.ComputedPhysicalBorderPadding().LeftRight();
   nsTableReflowState reflowState(*PresContext(), aReflowState, *this,
                                  aDesiredSize.width, aAvailHeight);
   ReflowChildren(reflowState, aStatus, aLastChildReflowed,
                  aDesiredSize.mOverflowAreas);
 
   ReflowColGroups(aReflowState.rendContext);
   return rv;
 }
@@ -2482,17 +2482,17 @@ void GetSeparateModelBorderPadding(const
                                    nsMargin&                aBorderPadding)
 {
   // XXXbz Either we _do_ have a reflow state and then we can use its
   // mComputedBorderPadding or we don't and then we get the padding
   // wrong!
   const nsStyleBorder* border = aStyleContext.StyleBorder();
   aBorderPadding = border->GetComputedBorder();
   if (aReflowState) {
-    aBorderPadding += aReflowState->mComputedPadding;
+    aBorderPadding += aReflowState->ComputedPhysicalPadding();
   }
 }
 
 nsMargin
 nsTableFrame::GetChildAreaOffset(const nsHTMLReflowState* aReflowState) const
 {
   nsMargin offset(0,0,0,0);
   if (IsBorderCollapse()) {
@@ -2868,18 +2868,18 @@ nsTableFrame::ReflowChildren(nsTableRefl
         aStatus = NS_INLINE_LINE_BREAK_BEFORE();
         break;
       }
       // see if the rowgroup did not fit on this page might be pushed on
       // the next page
       if (isPaginated &&
           (NS_INLINE_IS_BREAK_BEFORE(aStatus) ||
            (NS_FRAME_IS_COMPLETE(aStatus) &&
-            (NS_UNCONSTRAINEDSIZE != kidReflowState.availableHeight) &&
-            kidReflowState.availableHeight < desiredSize.height))) {
+            (NS_UNCONSTRAINEDSIZE != kidReflowState.AvailableHeight()) &&
+            kidReflowState.AvailableHeight() < desiredSize.height))) {
         if (ShouldAvoidBreakInside(aReflowState.reflowState)) {
           aStatus = NS_INLINE_LINE_BREAK_BEFORE();
           break;
         }
         // if we are on top of the page place with dataloss
         if (kidReflowState.mFlags.mIsTopOfPage) {
           if (childX+1 < rowGroups.Length()) {
             nsIFrame* nextRowGroupFrame = rowGroups[childX + 1];
@@ -2925,17 +2925,17 @@ nsTableFrame::ReflowChildren(nsTableRefl
         }
       }
 
       aLastChildReflowed   = kidFrame;
 
       pageBreak = false;
       // see if there is a page break after this row group or before the next one
       if (NS_FRAME_IS_COMPLETE(aStatus) && isPaginated &&
-          (NS_UNCONSTRAINEDSIZE != kidReflowState.availableHeight)) {
+          (NS_UNCONSTRAINEDSIZE != kidReflowState.AvailableHeight())) {
         nsIFrame* nextKid =
           (childX + 1 < rowGroups.Length()) ? rowGroups[childX + 1] : nullptr;
         pageBreak = PageBreakAfter(kidFrame, nextKid);
       }
 
       // Place the child
       PlaceChild(aReflowState, kidFrame, desiredSize, oldKidRect,
                  oldKidVisualOverflow);
--- a/layout/tables/nsTableOuterFrame.cpp
+++ b/layout/tables/nsTableOuterFrame.cpp
@@ -376,21 +376,21 @@ nsTableOuterFrame::GetChildMargin(nsPres
                                   nsMargin&                aMargin)
 {
   // construct a reflow state to compute margin and padding. Auto margins
   // will not be computed at this time.
 
   // create and init the child reflow state
   // XXX We really shouldn't construct a reflow state to do this.
   nsHTMLReflowState childRS(aPresContext, aOuterRS, aChildFrame,
-                            nsSize(aAvailWidth, aOuterRS.availableHeight),
+                            nsSize(aAvailWidth, aOuterRS.AvailableHeight()),
                             -1, -1, nsHTMLReflowState::CALLER_WILL_INIT);
   InitChildReflowState(*aPresContext, childRS);
 
-  aMargin = childRS.mComputedMargin;
+  aMargin = childRS.ComputedPhysicalMargin();
 }
 
 static nsSize
 GetContainingBlockSize(const nsHTMLReflowState& aOuterRS)
 {
   nsSize size(0,0);
   const nsHTMLReflowState* containRS =
     aOuterRS.mCBReflowState;
@@ -486,29 +486,29 @@ ChildShrinkWrapWidth(nsRenderingContext 
                      nsSize aCBSize, nscoord aAvailableWidth,
                      nscoord *aMarginResult = nullptr)
 {
   AutoMaybeDisableFontInflation an(aChildFrame);
 
   nsCSSOffsetState offsets(aChildFrame, aRenderingContext, aCBSize.width);
   nsSize size = aChildFrame->ComputeSize(aRenderingContext, aCBSize,
                   aAvailableWidth,
-                  nsSize(offsets.mComputedMargin.LeftRight(),
-                         offsets.mComputedMargin.TopBottom()),
-                  nsSize(offsets.mComputedBorderPadding.LeftRight() -
-                           offsets.mComputedPadding.LeftRight(),
-                         offsets.mComputedBorderPadding.TopBottom() -
-                           offsets.mComputedPadding.TopBottom()),
-                  nsSize(offsets.mComputedPadding.LeftRight(),
-                         offsets.mComputedPadding.TopBottom()),
+                  nsSize(offsets.ComputedPhysicalMargin().LeftRight(),
+                         offsets.ComputedPhysicalMargin().TopBottom()),
+                  nsSize(offsets.ComputedPhysicalBorderPadding().LeftRight() -
+                           offsets.ComputedPhysicalPadding().LeftRight(),
+                         offsets.ComputedPhysicalBorderPadding().TopBottom() -
+                           offsets.ComputedPhysicalPadding().TopBottom()),
+                  nsSize(offsets.ComputedPhysicalPadding().LeftRight(),
+                         offsets.ComputedPhysicalPadding().TopBottom()),
                   true);
   if (aMarginResult)
-    *aMarginResult = offsets.mComputedMargin.LeftRight();
-  return size.width + offsets.mComputedMargin.LeftRight() +
-                      offsets.mComputedBorderPadding.LeftRight();
+    *aMarginResult = offsets.ComputedPhysicalMargin().LeftRight();
+  return size.width + offsets.ComputedPhysicalMargin().LeftRight() +
+                      offsets.ComputedPhysicalBorderPadding().LeftRight();
 }
 
 /* virtual */ nsSize
 nsTableOuterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                    nsSize aCBSize, nscoord aAvailableWidth,
                                    nsSize aMargin, nsSize aBorder,
                                    nsSize aPadding, bool aShrinkWrap)
 {
@@ -797,24 +797,24 @@ nsTableOuterFrame::GetInnerOrigin(uint32
 void
 nsTableOuterFrame::OuterBeginReflowChild(nsPresContext*           aPresContext,
                                          nsIFrame*                aChildFrame,
                                          const nsHTMLReflowState& aOuterRS,
                                          void*                    aChildRSSpace,
                                          nscoord                  aAvailWidth)
 { 
   // work around pixel rounding errors, round down to ensure we don't exceed the avail height in
-  nscoord availHeight = aOuterRS.availableHeight;
+  nscoord availHeight = aOuterRS.AvailableHeight();
   if (NS_UNCONSTRAINEDSIZE != availHeight) {
     if (mCaptionFrames.FirstChild() == aChildFrame) {
       availHeight = NS_UNCONSTRAINEDSIZE;
     } else {
       nsMargin margin;
       GetChildMargin(aPresContext, aOuterRS, aChildFrame,
-                     aOuterRS.availableWidth, margin);
+                     aOuterRS.AvailableWidth(), margin);
     
       NS_ASSERTION(NS_UNCONSTRAINEDSIZE != margin.top, "No unconstrainedsize arithmetic, please");
       availHeight -= margin.top;
  
       NS_ASSERTION(NS_UNCONSTRAINEDSIZE != margin.bottom, "No unconstrainedsize arithmetic, please");
       availHeight -= margin.bottom;
     }
   }
@@ -933,18 +933,18 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPr
   } else if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
              captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) {
     // nsTableCaptionFrame::ComputeAutoSize takes care of making side
     // captions small.  Compute the caption's size first, and tell the
     // table to fit in what's left.
     OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
                           captionRSSpace, aOuterRS.ComputedWidth());
     nscoord innerAvailWidth = aOuterRS.ComputedWidth() -
-      (captionRS->ComputedWidth() + captionRS->mComputedMargin.LeftRight() +
-       captionRS->mComputedBorderPadding.LeftRight());
+      (captionRS->ComputedWidth() + captionRS->ComputedPhysicalMargin().LeftRight() +
+       captionRS->ComputedPhysicalBorderPadding().LeftRight());
     OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
                           innerRSSpace, innerAvailWidth);
 
   } else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
              captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
     // Compute the table's size first, and then prevent the caption from
     // being wider unless it has to be.
     //
@@ -956,17 +956,17 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPr
     OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
                           innerRSSpace, aOuterRS.ComputedWidth());
     // It's good that CSS 2.1 says not to include margins, since we
     // can't, since they already been converted so they exactly
     // fill the available width (ignoring the margin on one side if
     // neither are auto).  (We take advantage of that later when we call
     // GetCaptionOrigin, though.)
     nscoord innerBorderWidth = innerRS->ComputedWidth() +
-                               innerRS->mComputedBorderPadding.LeftRight();
+                               innerRS->ComputedPhysicalBorderPadding().LeftRight();
     OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
                           captionRSSpace, innerBorderWidth);
   } else {
     NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
                  captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,
                  "unexpected caption-side");
     // Size the table and the caption independently.
     OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
@@ -981,49 +981,49 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPr
   nsMargin captionMargin;
   if (mCaptionFrames.NotEmpty()) {
     nsReflowStatus capStatus; // don't let the caption cause incomplete
     rv = OuterDoReflowChild(aPresContext, mCaptionFrames.FirstChild(),
                             *captionRS, captionMet, capStatus);
     if (NS_FAILED(rv)) return rv;
     captionSize.width = captionMet.width;
     captionSize.height = captionMet.height;
-    captionMargin = captionRS->mComputedMargin;
+    captionMargin = captionRS->ComputedPhysicalMargin();
     // Now that we know the height of the caption, reduce the available height
     // for the table frame if we are height constrained and the caption is above
     // or below the inner table.
-    if (NS_UNCONSTRAINEDSIZE != aOuterRS.availableHeight) {
+    if (NS_UNCONSTRAINEDSIZE != aOuterRS.AvailableHeight()) {
       nscoord captionHeight = 0;
       switch (captionSide) {
         case NS_STYLE_CAPTION_SIDE_TOP:
         case NS_STYLE_CAPTION_SIDE_BOTTOM:
         case NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE:
         case NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE: {
           captionHeight = captionSize.height + captionMargin.TopBottom();
           break;
         }
       }
-      innerRS->availableHeight =
-        std::max(0, innerRS->availableHeight - captionHeight);
+      innerRS->AvailableHeight() =
+        std::max(0, innerRS->AvailableHeight() - captionHeight);
     }
   } else {
     captionSize.SizeTo(0,0);
     captionMargin.SizeTo(0,0,0,0);
   }
 
   // Then, now that we know how much to reduce the width of the inner
   // table to account for side captions, reflow the inner table.
   nsHTMLReflowMetrics innerMet;
   rv = OuterDoReflowChild(aPresContext, InnerTableFrame(), *innerRS,
                           innerMet, aStatus);
   if (NS_FAILED(rv)) return rv;
   nsSize innerSize;
   innerSize.width = innerMet.width;
   innerSize.height = innerMet.height;
-  nsMargin innerMargin = innerRS->mComputedMargin;
+  nsMargin innerMargin = innerRS->ComputedPhysicalMargin();
 
   nsSize   containSize = GetContainingBlockSize(aOuterRS);
 
   // Now that we've reflowed both we can place them.
   // XXXldb Most of the input variables here are now uninitialized!
 
   // XXX Need to recompute inner table's auto margins for the case of side
   // captions.  (Caption's are broken too, but that should be fixed earlier.)
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -494,17 +494,17 @@ nsTableRowFrame::CalcHeight(const nsHTML
   }
   // calc() with percentages is treated like 'auto' on table rows.
 
   for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame;
        kidFrame = kidFrame->GetNextSibling()) {
     nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
     if (cellFrame) {
       nsSize desSize = cellFrame->GetDesiredSize();
-      if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) && !GetPrevInFlow()) {
+      if ((NS_UNCONSTRAINEDSIZE == aReflowState.AvailableHeight()) && !GetPrevInFlow()) {
         CalculateCellActualHeight(cellFrame, desSize.height);
       }
       // height may have changed, adjust descent to absorb any excess difference
       nscoord ascent;
        if (!kidFrame->GetFirstPrincipalChild()->GetFirstPrincipalChild())
          ascent = desSize.height;
        else
          ascent = cellFrame->GetCellBaseline();
@@ -825,17 +825,17 @@ nsTableRowFrame::ReflowChildren(nsPresCo
     // See if we should only reflow the dirty child frames
     bool doReflowChild = true;
     if (!aReflowState.ShouldReflowAllKids() &&
         !aTableFrame.IsGeometryDirty() &&
         !NS_SUBTREE_DIRTY(kidFrame)) {
       if (!aReflowState.mFlags.mSpecialHeightReflow)
         doReflowChild = false;
     }
-    else if ((NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight)) {
+    else if ((NS_UNCONSTRAINEDSIZE != aReflowState.AvailableHeight())) {
       // We don't reflow a rowspan >1 cell here with a constrained height. 
       // That happens in nsTableRowGroupFrame::SplitSpanningCells.
       if (aTableFrame.GetEffectiveRowSpan(*cellFrame) > 1) {
         doReflowChild = false;
       }
     }
     if (aReflowState.mFlags.mSpecialHeightReflow) {
       if (!isPaginated && !(cellFrame->GetStateBits() &
@@ -882,17 +882,17 @@ nsTableRowFrame::ReflowChildren(nsPresCo
           (GetStateBits() & NS_FRAME_IS_DIRTY)                      ||
           isPaginated                                               ||
           NS_SUBTREE_DIRTY(cellFrame)                               ||
           // See if it needs a special reflow, or if it had one that we need to undo.
           (cellFrame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT) ||
           HasPctHeight()) {
         // Reflow the cell to fit the available width, height
         // XXX The old IR_ChildIsDirty code used availCellWidth here.
-        nsSize  kidAvailSize(availCellWidth, aReflowState.availableHeight);
+        nsSize  kidAvailSize(availCellWidth, aReflowState.AvailableHeight());
 
         // Reflow the child
         nsTableCellReflowState kidReflowState(aPresContext, aReflowState, 
                                               kidFrame, kidAvailSize,
                                               nsHTMLReflowState::CALLER_WILL_INIT);
         InitChildReflowState(*aPresContext, kidAvailSize, borderCollapse,
                              kidReflowState);
 
@@ -920,17 +920,17 @@ nsTableRowFrame::ReflowChildren(nsPresCo
         if (!aTableFrame.IsFloating()) {
           // Because we may have moved the frame we need to make sure any views are
           // positioned properly. We have to do this, because any one of our parent
           // frames could have moved and we have no way of knowing...
           nsTableFrame::RePositionViews(kidFrame);
         }
       }
       
-      if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) {
+      if (NS_UNCONSTRAINEDSIZE == aReflowState.AvailableHeight()) {
         if (!GetPrevInFlow()) {
           // Calculate the cell's actual height given its pass2 height. This
           // function takes into account the specified height (in the style)
           CalculateCellActualHeight(cellFrame, desiredSize.height);
         }
         // height may have changed, adjust descent to absorb any excess difference
         nscoord ascent;
         if (!kidFrame->GetFirstPrincipalChild()->GetFirstPrincipalChild())
@@ -975,22 +975,22 @@ nsTableRowFrame::ReflowChildren(nsPresCo
         aStatus = NS_FRAME_NOT_COMPLETE;
       }
     }
     ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
     x += cellSpacingX;
   }
 
   // just set our width to what was available. The table will calculate the width and not use our value.
-  aDesiredSize.width = aReflowState.availableWidth;
+  aDesiredSize.width = aReflowState.AvailableWidth();
 
   if (aReflowState.mFlags.mSpecialHeightReflow) {
     aDesiredSize.height = mRect.height;
   }
-  else if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) {
+  else if (NS_UNCONSTRAINEDSIZE == aReflowState.AvailableHeight()) {
     aDesiredSize.height = CalcHeight(aReflowState);
     if (GetPrevInFlow()) {
       nscoord height = CalcHeightFromUnpaginatedHeight(aPresContext, *this);
       aDesiredSize.height = std::max(aDesiredSize.height, height);
     }
     else {
       if (isPaginated && HasStyleHeight()) {
         // set the unpaginated height so next in flows can try to honor it
@@ -1001,18 +1001,18 @@ nsTableRowFrame::ReflowChildren(nsPresCo
         aDesiredSize.height = std::max(aDesiredSize.height, GetUnpaginatedHeight(aPresContext));
       }
     }
   }
   else { // constrained height, paginated
     // Compute the height we should have from style (subtracting the
     // height from our prev-in-flows from the style height)
     nscoord styleHeight = CalcHeightFromUnpaginatedHeight(aPresContext, *this);
-    if (styleHeight > aReflowState.availableHeight) {
-      styleHeight = aReflowState.availableHeight;
+    if (styleHeight > aReflowState.AvailableHeight()) {
+      styleHeight = aReflowState.AvailableHeight();
       NS_FRAME_SET_INCOMPLETE(aStatus);
     }
     aDesiredSize.height = std::max(cellMaxHeight, styleHeight);
   }
   aDesiredSize.UnionOverflowAreasWithDesiredBounds();
   FinishAndStoreOverflow(&aDesiredSize);
   return rv;
 }
@@ -1047,17 +1047,17 @@ nsTableRowFrame::Reflow(nsPresContext*  
                       aStatus);
 
   if (aPresContext->IsPaginated() && !NS_FRAME_IS_FULLY_COMPLETE(aStatus) &&
       ShouldAvoidBreakInside(aReflowState)) {
     aStatus = NS_INLINE_LINE_BREAK_BEFORE();
   }
 
   // just set our width to what was available. The table will calculate the width and not use our value.
-  aDesiredSize.width = aReflowState.availableWidth;
+  aDesiredSize.width = aReflowState.AvailableWidth();
 
   // If our parent is in initial reflow, it'll handle invalidating our
   // entire overflow rect.
   if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
       nsSize(aDesiredSize.width, aDesiredSize.height) != mRect.Size()) {
     InvalidateFrame();
   }
 
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -436,17 +436,17 @@ nsTableRowGroupFrame::ReflowChildren(nsP
     }
     ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
   }
 
   if (haveRow)
     aReflowState.y -= cellSpacingY;
 
   // Return our desired rect
-  aDesiredSize.width = aReflowState.reflowState.availableWidth;
+  aDesiredSize.width = aReflowState.reflowState.AvailableWidth();
   aDesiredSize.height = aReflowState.y;
 
   if (aReflowState.reflowState.mFlags.mSpecialHeightReflow) {
     DidResizeRows(aDesiredSize);
     if (isPaginated) {
       CacheRowHeightsForPrinting(aPresContext, GetFirstRow());
     }
   }
@@ -921,18 +921,18 @@ nsTableRowGroupFrame::SplitSpanningCells
         nsReflowStatus status;
         // Ask the row to reflow the cell to the height of all the rows it spans up through aLastRow
         // aAvailHeight is the space between the row group start and the end of the page
         nscoord cellAvailHeight = aSpanningRowBottom - rowPos.y;
         NS_ASSERTION(cellAvailHeight >= 0, "No space for cell?");
         bool isTopOfPage = (row == &aFirstRow) && aFirstRowIsTopOfPage;
 
         nsRect rowRect = row->GetRect();
-        nsSize rowAvailSize(aReflowState.availableWidth,
-                            std::max(aReflowState.availableHeight - rowRect.y,
+        nsSize rowAvailSize(aReflowState.AvailableWidth(),
+                            std::max(aReflowState.AvailableHeight() - rowRect.y,
                                    0));
         // don't let the available height exceed what
         // CalculateRowHeights set for it
         rowAvailSize.height = std::min(rowAvailSize.height, rowRect.height);
         nsHTMLReflowState rowReflowState(&aPresContext, aReflowState,
                                          row, rowAvailSize,
                                          -1, -1,
                                          nsHTMLReflowState::CALLER_WILL_INIT);
@@ -1029,18 +1029,18 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
                                     bool                     aRowForcedPageBreak)
 {
   NS_PRECONDITION(aPresContext->IsPaginated(), "SplitRowGroup currently supports only paged media"); 
 
   nsresult rv = NS_OK;
   nsTableRowFrame* prevRowFrame = nullptr;
   aDesiredSize.height = 0;
 
-  nscoord availWidth  = aReflowState.availableWidth;
-  nscoord availHeight = aReflowState.availableHeight;
+  nscoord availWidth  = aReflowState.AvailableWidth();
+  nscoord availHeight = aReflowState.AvailableHeight();
   
   const bool borderCollapse = aTableFrame->IsBorderCollapse();
   nscoord cellSpacingY = aTableFrame->GetCellSpacingY();
   
   // get the page height
   nscoord pageHeight = aPresContext->GetPageSize().height;
   NS_ASSERTION(pageHeight != NS_UNCONSTRAINEDSIZE, 
                "The table shouldn't be split when there should be space");
@@ -1097,20 +1097,20 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
         }
 
         nsTableFrame::InvalidateTableFrame(rowFrame, oldRowRect,
                                            oldRowVisualOverflow,
                                            false);
 
         if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
           // The row frame is incomplete and all of the rowspan 1 cells' block frames split
-          if ((rowMetrics.height <= rowReflowState.availableHeight) || isTopOfPage) {
+          if ((rowMetrics.height <= rowReflowState.AvailableHeight()) || isTopOfPage) {
             // The row stays on this page because either it split ok or we're on the top of page.
             // If top of page and the height exceeded the avail height, then there will be data loss
-            NS_ASSERTION(rowMetrics.height <= rowReflowState.availableHeight, 
+            NS_ASSERTION(rowMetrics.height <= rowReflowState.AvailableHeight(), 
                          "data loss - incomplete row needed more height than available, on top of page");
             CreateContinuingRowFrame(*aPresContext, *rowFrame, (nsIFrame**)&contRow);
             if (contRow) {
               aDesiredSize.height += rowMetrics.height;
               if (prevRowFrame) 
                 aDesiredSize.height += cellSpacingY;
             }
             else return NS_ERROR_NULL_POINTER;
@@ -1301,19 +1301,19 @@ nsTableRowGroupFrame::Reflow(nsPresConte
   // Reflow the existing frames. 
   bool splitDueToPageBreak = false;
   rv = ReflowChildren(aPresContext, aDesiredSize, state, aStatus,
                       &splitDueToPageBreak);
 
   // See if all the frames fit. Do not try to split anything if we're
   // not paginated ... we can't split across columns yet.
   if (aReflowState.mFlags.mTableIsSplittable &&
-      NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight &&
+      NS_UNCONSTRAINEDSIZE != aReflowState.AvailableHeight() &&
       (NS_FRAME_NOT_COMPLETE == aStatus || splitDueToPageBreak || 
-       aDesiredSize.height > aReflowState.availableHeight)) {
+       aDesiredSize.height > aReflowState.AvailableHeight())) {
     // Nope, find a place to split the row group 
     bool specialReflow = (bool)aReflowState.mFlags.mSpecialHeightReflow;
     ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = false;
 
     SplitRowGroup(aPresContext, aDesiredSize, aReflowState, tableFrame, aStatus,
                   splitDueToPageBreak);
 
     ((nsHTMLReflowState::ReflowStateFlags&)aReflowState.mFlags).mSpecialHeightReflow = specialReflow;
@@ -1325,17 +1325,17 @@ nsTableRowGroupFrame::Reflow(nsPresConte
   if (GetNextInFlow() && GetNextInFlow()->GetFirstPrincipalChild()) {
     NS_FRAME_SET_INCOMPLETE(aStatus);
   }
 
   SetHasStyleHeight((NS_UNCONSTRAINEDSIZE != aReflowState.ComputedHeight()) &&
                     (aReflowState.ComputedHeight() > 0)); 
   
   // just set our width to what was available. The table will calculate the width and not use our value.
-  aDesiredSize.width = aReflowState.availableWidth;
+  aDesiredSize.width = aReflowState.AvailableWidth();
 
   aDesiredSize.UnionOverflowAreasWithDesiredBounds();
 
   // If our parent is in initial reflow, it'll handle invalidating our
   // entire overflow rect.
   if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
       nsSize(aDesiredSize.width, aDesiredSize.height) != mRect.Size()) {
     InvalidateFrame();
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -27,18 +27,18 @@ struct nsRowGroupReflowState {
 
   // Running y-offset
   nscoord y;
 
   nsRowGroupReflowState(const nsHTMLReflowState& aReflowState,
                         nsTableFrame*            aTableFrame)
       :reflowState(aReflowState), tableFrame(aTableFrame)
   {
-    availSize.width  = reflowState.availableWidth;
-    availSize.height = reflowState.availableHeight;
+    availSize.width  = reflowState.AvailableWidth();
+    availSize.height = reflowState.AvailableHeight();
     y = 0;  
   }
 
   ~nsRowGroupReflowState() {}
 };
 
 // use the following bits from nsFrame's frame state 
 
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -635,35 +635,35 @@ nsBoxFrame::Reflow(nsPresContext*       
 
   NS_ASSERTION(aReflowState.ComputedWidth() >=0 &&
                aReflowState.ComputedHeight() >= 0, "Computed Size < 0");
 
 #ifdef DO_NOISY_REFLOW
   printf("\n-------------Starting BoxFrame Reflow ----------------------------\n");
   printf("%p ** nsBF::Reflow %d ", this, myCounter++);
   
-  printSize("AW", aReflowState.availableWidth);
-  printSize("AH", aReflowState.availableHeight);
+  printSize("AW", aReflowState.AvailableWidth());
+  printSize("AH", aReflowState.AvailableHeight());
   printSize("CW", aReflowState.ComputedWidth());
   printSize("CH", aReflowState.ComputedHeight());
 
   printf(" *\n");
 
 #endif
 
   aStatus = NS_FRAME_COMPLETE;
 
   // create the layout state
   nsBoxLayoutState state(aPresContext, aReflowState.rendContext,
                          &aReflowState, aReflowState.mReflowDepth);
 
   nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.ComputedHeight());
 
   nsMargin m;
-  m = aReflowState.mComputedBorderPadding;
+  m = aReflowState.ComputedPhysicalBorderPadding();
   // GetBorderAndPadding(m);
 
   nsSize prefSize(0,0);
 
   // if we are told to layout intrinsic then get our preferred size.
   NS_ASSERTION(computedSize.width != NS_INTRINSICSIZE,
                "computed width should always be computed");
   if (computedSize.height == NS_INTRINSICSIZE) {
@@ -676,17 +676,17 @@ nsBoxFrame::Reflow(nsPresContext*       
 
   // get our desiredSize
   computedSize.width += m.left + m.right;
 
   if (aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {
     computedSize.height = prefSize.height;
     // prefSize is border-box but min/max constraints are content-box.
     nscoord verticalBorderPadding =
-      aReflowState.mComputedBorderPadding.TopBottom();
+      aReflowState.ComputedPhysicalBorderPadding().TopBottom();
     nscoord contentHeight = computedSize.height - verticalBorderPadding;
     // Note: contentHeight might be negative, but that's OK because min-height
     // is never negative.
     computedSize.height = aReflowState.ApplyMinMaxHeight(contentHeight) +
                           verticalBorderPadding;
   } else {
     computedSize.height += m.top + m.bottom;
   }
--- a/layout/xul/nsLeafBoxFrame.cpp
+++ b/layout/xul/nsLeafBoxFrame.cpp
@@ -210,34 +210,34 @@ nsLeafBoxFrame::Reflow(nsPresContext*   
     case eReflowReason_StyleChange:
       printf("Sty");break;
     case eReflowReason_Dirty:
       printf("Drt ");
       break;
     default:printf("<unknown>%d", aReflowState.reason);break;
   }
   
-  printSize("AW", aReflowState.availableWidth);
-  printSize("AH", aReflowState.availableHeight);
+  printSize("AW", aReflowState.AvailableWidth());
+  printSize("AH", aReflowState.AvailableHeight());
   printSize("CW", aReflowState.ComputedWidth());
   printSize("CH", aReflowState.ComputedHeight());
 
   printf(" *\n");
 
 #endif
 
   aStatus = NS_FRAME_COMPLETE;
 
   // create the layout state
   nsBoxLayoutState state(aPresContext, aReflowState.rendContext);
 
   nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.ComputedHeight());
 
   nsMargin m;
-  m = aReflowState.mComputedBorderPadding;
+  m = aReflowState.ComputedPhysicalBorderPadding();
 
   //GetBorderAndPadding(m);
 
   // this happens sometimes. So lets handle it gracefully.
   if (aReflowState.ComputedHeight() == 0) {
     nsSize minSize = GetMinSize(state);
     computedSize.height = minSize.height - m.top - m.bottom;
   }
@@ -264,30 +264,30 @@ nsLeafBoxFrame::Reflow(nsPresContext*   
   } else {
     computedSize.height += m.top + m.bottom;
   }
 
   // handle reflow state min and max sizes
   // XXXbz the width handling here seems to be wrong, since
   // mComputedMin/MaxWidth is a content-box size, whole
   // computedSize.width is a border-box size...
-  if (computedSize.width > aReflowState.mComputedMaxWidth)
-    computedSize.width = aReflowState.mComputedMaxWidth;
+  if (computedSize.width > aReflowState.ComputedMaxWidth())
+    computedSize.width = aReflowState.ComputedMaxWidth();
 
-  if (computedSize.width < aReflowState.mComputedMinWidth)
-    computedSize.width = aReflowState.mComputedMinWidth;
+  if (computedSize.width < aReflowState.ComputedMinWidth())
+    computedSize.width = aReflowState.ComputedMinWidth();
 
   // Now adjust computedSize.height for our min and max computed
   // height.  The only problem is that those are content-box sizes,
   // while computedSize.height is a border-box size.  So subtract off
   // m.TopBottom() before adjusting, then readd it.
   computedSize.height = std::max(0, computedSize.height - m.TopBottom());
   computedSize.height = NS_CSS_MINMAX(computedSize.height,
-                                      aReflowState.mComputedMinHeight,
-                                      aReflowState.mComputedMaxHeight);
+                                      aReflowState.ComputedMinHeight(),
+                                      aReflowState.ComputedMaxHeight());
   computedSize.height += m.TopBottom();
 
   nsRect r(mRect.x, mRect.y, computedSize.width, computedSize.height);
 
   SetBounds(state, r);
  
   // layout our children
   Layout(state);
--- a/layout/xul/nsScrollbarFrame.cpp
+++ b/layout/xul/nsScrollbarFrame.cpp
@@ -59,20 +59,20 @@ nsScrollbarFrame::Reflow(nsPresContext* 
                          const nsHTMLReflowState& aReflowState,
                          nsReflowStatus&          aStatus)
 {
   nsresult rv = nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // nsGfxScrollFrame may have told us to shrink to nothing. If so, make sure our
   // desired size agrees.
-  if (aReflowState.availableWidth == 0) {
+  if (aReflowState.AvailableWidth() == 0) {
     aDesiredSize.width = 0;
   }
-  if (aReflowState.availableHeight == 0) {
+  if (aReflowState.AvailableHeight() == 0) {
     aDesiredSize.height = 0;
   }
 
   return NS_OK;
 }
 
 nsIAtom*
 nsScrollbarFrame::GetType() const