Bug 1174711 - patch 1 - Rename nsIPercentHeightObserver to nsIPercentBSizeObserver, and update related frame methods to match. r=dholbert
authorJonathan Kew <jkew@mozilla.com>
Mon, 22 Jun 2015 10:33:34 +0100
changeset 268098 92ce2f6910196ae01353c828f1849d9bf4d0a8fa
parent 268097 738e3dcf5eed00cf3a64672258f51876c11e7a34
child 268099 f5cf0bdd0c1ad430508861f3e67413f49d5c25de
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-esr52@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1174711
milestone41.0a1
Bug 1174711 - patch 1 - Rename nsIPercentHeightObserver to nsIPercentBSizeObserver, and update related frame methods to match. r=dholbert
layout/base/moz.build
layout/base/nsIPercentBSizeObserver.h
layout/base/nsIPercentHeightObserver.h
layout/generic/nsFrame.cpp
layout/generic/nsFrameIdList.h
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsHTMLReflowState.h
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableCellFrame.h
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
layout/tables/nsTableOuterFrame.cpp
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowGroupFrame.cpp
--- a/layout/base/moz.build
+++ b/layout/base/moz.build
@@ -72,17 +72,17 @@ EXPORTS += [
     'nsDisplayList.h',
     'nsDisplayListInvalidation.h',
     'nsFrameManager.h',
     'nsFrameManagerBase.h',
     'nsFrameTraversal.h',
     'nsIFrameTraversal.h',
     'nsILayoutDebugger.h',
     'nsILayoutHistoryState.h',
-    'nsIPercentHeightObserver.h',
+    'nsIPercentBSizeObserver.h',
     'nsIPresShell.h',
     'nsIReflowCallback.h',
     'nsLayoutUtils.h',
     'nsPresArena.h',
     'nsPresContext.h',
     'nsPresState.h',
     'nsRefreshDriver.h',
     'nsStyleChangeList.h',
rename from layout/base/nsIPercentHeightObserver.h
rename to layout/base/nsIPercentBSizeObserver.h
--- a/layout/base/nsIPercentHeightObserver.h
+++ b/layout/base/nsIPercentBSizeObserver.h
@@ -1,30 +1,31 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef nsIPercentHeightObserver_h___
-#define nsIPercentHeightObserver_h___
+#ifndef nsIPercentBSizeObserver_h___
+#define nsIPercentBSizeObserver_h___
 
 #include "nsQueryFrame.h"
 
 struct nsHTMLReflowState;
 
 /**
- * This interface is supported by frames that need to provide computed height
- * values to children during reflow which would otherwise not happen. Currently only
- * table cells support this.
+ * This interface is supported by frames that need to provide computed bsize
+ * values to children during reflow which would otherwise not happen. Currently
+ * only table cells support this.
  */
-class nsIPercentHeightObserver
+class nsIPercentBSizeObserver
 {
 public:
-  NS_DECL_QUERYFRAME_TARGET(nsIPercentHeightObserver)
+  NS_DECL_QUERYFRAME_TARGET(nsIPercentBSizeObserver)
 
-  // Notify the observer that aReflowState has no computed height, but it has a percent height
-  virtual void NotifyPercentHeight(const nsHTMLReflowState& aReflowState) = 0;
+  // Notify the observer that aReflowState has no computed bsize,
+  // but it has a percent bsize
+  virtual void NotifyPercentBSize(const nsHTMLReflowState& aReflowState) = 0;
 
   // Ask the observer if it should observe aReflowState.frame
   virtual bool NeedsToObserve(const nsHTMLReflowState& aReflowState) = 0;
 };
 
-#endif // nsIPercentHeightObserver_h___ 
+#endif // nsIPercentBSizeObserver_h___ 
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -48,17 +48,17 @@
 #include "nsGkAtoms.h"
 #include "nsHtml5Atoms.h"
 #include "nsCSSAnonBoxes.h"
 
 #include "nsFrameTraversal.h"
 #include "nsRange.h"
 #include "nsITextControlFrame.h"
 #include "nsNameSpaceManager.h"
-#include "nsIPercentHeightObserver.h"
+#include "nsIPercentBSizeObserver.h"
 #include "nsStyleStructInlines.h"
 #include "FrameLayerBuilder.h"
 
 #include "nsBidiPresUtils.h"
 #include "RubyUtils.h"
 
 // For triple-click pref
 #include "imgIContainer.h"
@@ -4444,25 +4444,26 @@ nsFrame::DidReflow(nsPresContext*       
 
   nsSVGEffects::InvalidateDirectRenderingObservers(this, nsSVGEffects::INVALIDATE_REFLOW);
 
   if (nsDidReflowStatus::FINISHED == aStatus) {
     mState &= ~(NS_FRAME_IN_REFLOW | NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
                 NS_FRAME_HAS_DIRTY_CHILDREN);
   }
 
-  // Notify the percent height observer if there is a percent height.
+  // Notify the percent bsize observer if there is a percent bsize.
   // The observer may be able to initiate another reflow with a computed
-  // height. This happens in the case where a table cell has no computed
-  // height but can fabricate one when the cell height is known.
-  if (aReflowState && aReflowState->mPercentHeightObserver &&
+  // bsize. This happens in the case where a table cell has no computed
+  // bsize but can fabricate one when the cell bsize is known.
+  if (aReflowState && aReflowState->mPercentBSizeObserver &&
       !GetPrevInFlow()) {
-    const nsStyleCoord &height = aReflowState->mStylePosition->mHeight;
-    if (height.HasPercent()) {
-      aReflowState->mPercentHeightObserver->NotifyPercentHeight(*aReflowState);
+    const nsStyleCoord &bsize =
+      aReflowState->mStylePosition->BSize(aReflowState->GetWritingMode());
+    if (bsize.HasPercent()) {
+      aReflowState->mPercentBSizeObserver->NotifyPercentBSize(*aReflowState);
     }
   }
 
   aPresContext->ReflowedFrame();
 }
 
 void
 nsFrame::FinishReflowWithAbsoluteFrames(nsPresContext*           aPresContext,
--- a/layout/generic/nsFrameIdList.h
+++ b/layout/generic/nsFrameIdList.h
@@ -44,17 +44,17 @@ FRAME_ID(nsIComboboxControlFrame)
 FRAME_ID(nsIFormControlFrame)
 FRAME_ID(nsIFrame)
 FRAME_ID(nsIFrameFrame)
 FRAME_ID(nsIListControlFrame)
 FRAME_ID(nsIMathMLFrame)
 FRAME_ID(nsIMenuFrame)
 FRAME_ID(nsIObjectFrame)
 FRAME_ID(nsIPageSequenceFrame)
-FRAME_ID(nsIPercentHeightObserver)
+FRAME_ID(nsIPercentBSizeObserver)
 FRAME_ID(nsIRootBox)
 FRAME_ID(nsISVGChildFrame)
 FRAME_ID(nsISVGSVGFrame)
 FRAME_ID(nsIScrollableFrame)
 FRAME_ID(nsIScrollbarMediator)
 FRAME_ID(nsISelectControlFrame)
 FRAME_ID(nsIStatefulFrame)
 FRAME_ID(nsITableCellLayout)
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -17,17 +17,17 @@
 #include "nsIPresShell.h"
 #include "nsFontMetrics.h"
 #include "nsBlockFrame.h"
 #include "nsLineBox.h"
 #include "nsFlexContainerFrame.h"
 #include "nsImageFrame.h"
 #include "nsTableFrame.h"
 #include "nsTableCellFrame.h"
-#include "nsIPercentHeightObserver.h"
+#include "nsIPercentBSizeObserver.h"
 #include "nsLayoutUtils.h"
 #include "mozilla/Preferences.h"
 #include "nsFontInflationData.h"
 #include "StickyScrollContainer.h"
 #include "nsIFrameInlines.h"
 #include "CounterStyleManager.h"
 #include <algorithm>
 #include "mozilla/dom/HTMLInputElement.h"
@@ -70,17 +70,17 @@ nsHTMLReflowState::nsHTMLReflowState(nsP
   MOZ_ASSERT(aPresContext == aFrame->PresContext(), "wrong pres context");
   parentReflowState = nullptr;
   AvailableISize() = aAvailableSpace.ISize(mWritingMode);
   AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
   mFloatManager = nullptr;
   mLineLayout = nullptr;
   memset(&mFlags, 0, sizeof(mFlags));
   mDiscoveredClearance = nullptr;
-  mPercentHeightObserver = nullptr;
+  mPercentBSizeObserver = nullptr;
 
   if (aFlags & DUMMY_PARENT_REFLOW_STATE) {
     mFlags.mDummyParentReflowState = true;
   }
 
   if (!(aFlags & CALLER_WILL_INIT)) {
     Init(aPresContext);
   }
@@ -218,19 +218,19 @@ nsHTMLReflowState::nsHTMLReflowState(
     CheckNextInFlowParenthood(aFrame, aParentReflowState.frame);
   mFlags.mAssumingHScrollbar = mFlags.mAssumingVScrollbar = false;
   mFlags.mHasClearance = false;
   mFlags.mIsColumnBalancing = false;
   mFlags.mIsFlexContainerMeasuringHeight = false;
   mFlags.mDummyParentReflowState = false;
 
   mDiscoveredClearance = nullptr;
-  mPercentHeightObserver = (aParentReflowState.mPercentHeightObserver &&
-                            aParentReflowState.mPercentHeightObserver->NeedsToObserve(*this))
-                           ? aParentReflowState.mPercentHeightObserver : nullptr;
+  mPercentBSizeObserver = (aParentReflowState.mPercentBSizeObserver &&
+                            aParentReflowState.mPercentBSizeObserver->NeedsToObserve(*this))
+                           ? aParentReflowState.mPercentBSizeObserver : nullptr;
 
   if ((aFlags & DUMMY_PARENT_REFLOW_STATE) ||
       (parentReflowState->mFlags.mDummyParentReflowState &&
        frame->GetType() == nsGkAtoms::tableFrame)) {
     mFlags.mDummyParentReflowState = true;
   }
 
   if (!(aFlags & CALLER_WILL_INIT)) {
--- a/layout/generic/nsHTMLReflowState.h
+++ b/layout/generic/nsHTMLReflowState.h
@@ -13,17 +13,17 @@
 #include "nsIFrame.h"
 #include "mozilla/Assertions.h"
 #include <algorithm>
 
 class nsPresContext;
 class nsRenderingContext;
 class nsFloatManager;
 class nsLineLayout;
-class nsIPercentHeightObserver;
+class nsIPercentBSizeObserver;
 struct nsHypotheticalBox;
 
 /**
  * @return aValue clamped to [aMinValue, aMaxValue].
  *
  * @note This function needs to handle aMinValue > aMaxValue. In that case,
  *       aMinValue is returned.
  * @see http://www.w3.org/TR/CSS21/visudet.html#min-max-widths
@@ -509,18 +509,18 @@ public:
   const nsStylePadding*    mStylePadding;
   const nsStyleText*       mStyleText;
 
   bool IsFloating() const;
 
   uint8_t GetDisplay() const;
 
   // a frame (e.g. nsTableCellFrame) which may need to generate a special 
-  // reflow for percent height calculations 
-  nsIPercentHeightObserver* mPercentHeightObserver;
+  // reflow for percent bsize calculations
+  nsIPercentBSizeObserver* mPercentBSizeObserver;
 
   // CSS margin collapsing sometimes requires us to reflow
   // optimistically assuming that margins collapse to see if clearance
   // is required. When we discover that clearance is required, we
   // store the frame in which clearance was discovered to the location
   // requested here.
   nsIFrame** mDiscoveredClearance;
 
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -100,54 +100,54 @@ nsTableCellFrame::DestroyFrom(nsIFrame* 
 {
   if (GetStateBits() & NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN) {
     nsTableFrame::UnregisterPositionedTablePart(this, aDestructRoot);
   }
 
   nsContainerFrame::DestroyFrom(aDestructRoot);
 }
 
-// nsIPercentHeightObserver methods
+// nsIPercentBSizeObserver methods
 
 void
-nsTableCellFrame::NotifyPercentHeight(const nsHTMLReflowState& aReflowState)
+nsTableCellFrame::NotifyPercentBSize(const nsHTMLReflowState& aReflowState)
 {
   // nsHTMLReflowState ensures the mCBReflowState of blocks inside a
   // cell is the cell frame, not the inner-cell block, and that the
   // containing block of an inner table is the containing block of its
   // outer table.
   // XXXldb Given the now-stricter |NeedsToObserve|, many if not all of
   // these tests are probably unnecessary.
 
   // Maybe the cell reflow state; we sure if we're inside the |if|.
   const nsHTMLReflowState *cellRS = aReflowState.mCBReflowState;
 
   if (cellRS && cellRS->frame == this &&
-      (cellRS->ComputedHeight() == NS_UNCONSTRAINEDSIZE ||
-       cellRS->ComputedHeight() == 0)) { // XXXldb Why 0?
-    // This is a percentage height on a frame whose percentage heights
-    // are based on the height of the cell, since its containing block
+      (cellRS->ComputedBSize() == NS_UNCONSTRAINEDSIZE ||
+       cellRS->ComputedBSize() == 0)) { // XXXldb Why 0?
+    // This is a percentage bsize on a frame whose percentage bsizes
+    // are based on the bsize of the cell, since its containing block
     // is the inner cell frame.
 
-    // We'll only honor the percent height if sibling-cells/ancestors
-    // have specified/pct height. (Also, siblings only count for this if
+    // We'll only honor the percent bsize if sibling-cells/ancestors
+    // have specified/pct bsize. (Also, siblings only count for this if
     // both this cell and the sibling cell span exactly 1 row.)
 
-    if (nsTableFrame::AncestorsHaveStyleHeight(*cellRS) ||
+    if (nsTableFrame::AncestorsHaveStyleBSize(*cellRS) ||
         (GetTableFrame()->GetEffectiveRowSpan(*this) == 1 &&
          (cellRS->parentReflowState->frame->GetStateBits() &
           NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT))) {
 
       for (const nsHTMLReflowState *rs = aReflowState.parentReflowState;
            rs != cellRS;
            rs = rs->parentReflowState) {
         rs->frame->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
       }
 
-      nsTableFrame::RequestSpecialHeightReflow(*cellRS);
+      nsTableFrame::RequestSpecialBSizeReflow(*cellRS);
     }
   }
 }
 
 // The cell needs to observe its block and things inside its block but nothing below that
 bool
 nsTableCellFrame::NeedsToObserve(const nsHTMLReflowState& aReflowState)
 {
@@ -160,26 +160,29 @@ nsTableCellFrame::NeedsToObserve(const n
     // propagated to its kids.
     return true;
   }
   rs = rs->parentReflowState;
   if (!rs) {
     return false;
   }
 
-  // We always need to let the percent height observer be propagated
+  // We always need to let the percent bsize observer be propagated
   // from an outer table frame to an inner table frame.
   nsIAtom *fType = aReflowState.frame->GetType();
   if (fType == nsGkAtoms::tableFrame) {
     return true;
   }
 
   // We need the observer to be propagated to all children of the cell
   // (i.e., children of the child block) in quirks mode, but only to
   // tables in standards mode.
+  // XXX This may not be true in the case of orthogonal flows within
+  // the cell (bug 1174711 comment 8); we may need to observe isizes
+  // instead of bsizes for orthogonal children.
   return rs->frame == this &&
          (PresContext()->CompatibilityMode() == eCompatibility_NavQuirks ||
           fType == nsGkAtoms::tableOuterFrame);
 }
 
 nsresult
 nsTableCellFrame::GetRowIndex(int32_t &aRowIndex) const
 {
@@ -864,17 +867,17 @@ nsTableCellFrame::Reflow(nsPresContext* 
   DO_GLOBAL_REFLOW_COUNT("nsTableCellFrame");
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
 
   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);
+  nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowState);
 
   aStatus = NS_FRAME_COMPLETE;
   WritingMode wm = aReflowState.GetWritingMode();
   LogicalSize availSize(wm, aReflowState.AvailableISize(),
                             aReflowState.AvailableBSize());
 
   LogicalMargin borderPadding = aReflowState.ComputedLogicalPadding();
   LogicalMargin border = GetBorderWidth(wm);
@@ -917,23 +920,23 @@ nsTableCellFrame::Reflow(nsPresContext* 
     SetHasPctOverBSize(false);
   }
 
   WritingMode kidWM = firstKid->GetWritingMode();
   nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid,
                                    availSize.ConvertTo(kidWM, wm));
 
   // Don't be a percent height observer if we're in the middle of
-  // special-height reflow, in case we get an accidental NotifyPercentHeight()
+  // special-height reflow, in case we get an accidental NotifyPercentBSize()
   // call (which we shouldn't honor during special-height reflow)
   if (!aReflowState.mFlags.mSpecialHeightReflow) {
-    // mPercentHeightObserver is for children of cells in quirks mode,
+    // mPercentBSizeObserver is for children of cells in quirks mode,
     // but only those than are tables in standards mode.  NeedsToObserve
     // will determine how far this is propagated to descendants.
-    kidReflowState.mPercentHeightObserver = this;
+    kidReflowState.mPercentBSizeObserver = this;
   }
   // Don't propagate special height reflow state to our kids
   kidReflowState.mFlags.mSpecialHeightReflow = false;
 
   if (aReflowState.mFlags.mSpecialHeightReflow ||
       (FirstInFlow()->GetStateBits() & NS_TABLE_CELL_HAD_SPECIAL_REFLOW)) {
     // We need to force the kid to have mBResize set if we've had a
     // special reflow in the past, since the non-special reflow needs to
@@ -1042,17 +1045,17 @@ nsTableCellFrame::Reflow(nsPresContext* 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
 }
 
 /* ----- global methods ----- */
 
 NS_QUERYFRAME_HEAD(nsTableCellFrame)
   NS_QUERYFRAME_ENTRY(nsTableCellFrame)
   NS_QUERYFRAME_ENTRY(nsITableCellLayout)
-  NS_QUERYFRAME_ENTRY(nsIPercentHeightObserver)
+  NS_QUERYFRAME_ENTRY(nsIPercentBSizeObserver)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
 #ifdef ACCESSIBILITY
 a11y::AccType
 nsTableCellFrame::AccessibleType()
 {
   return a11y::eHTMLTableCellType;
 }
--- a/layout/tables/nsTableCellFrame.h
+++ b/layout/tables/nsTableCellFrame.h
@@ -7,17 +7,17 @@
 
 #include "mozilla/Attributes.h"
 #include "celldata.h"
 #include "imgIContainer.h"
 #include "nsITableCellLayout.h"
 #include "nscore.h"
 #include "nsContainerFrame.h"
 #include "nsStyleContext.h"
-#include "nsIPercentHeightObserver.h"
+#include "nsIPercentBSizeObserver.h"
 #include "nsGkAtoms.h"
 #include "nsLayoutUtils.h"
 #include "nsTArray.h"
 #include "nsTableRowFrame.h"
 #include "mozilla/WritingModes.h"
 
 /**
  * nsTableCellFrame
@@ -27,17 +27,17 @@
  * so we can change that decsion in the future.  Users of nsITableCellLayout
  * should refcount correctly as if this object is being ref counted, though
  * no actual support is under the hood.
  *
  * @author  sclark
  */
 class nsTableCellFrame : public nsContainerFrame,
                          public nsITableCellLayout,
-                         public nsIPercentHeightObserver
+                         public nsIPercentBSizeObserver
 {
   typedef mozilla::image::DrawResult DrawResult;
 
 protected:
   typedef mozilla::WritingMode WritingMode;
   typedef mozilla::LogicalSide LogicalSide;
   typedef mozilla::LogicalMargin LogicalMargin;
 
@@ -93,17 +93,17 @@ public:
 #endif
 
   virtual nsContainerFrame* GetContentInsertionFrame() override {
     return GetFirstPrincipalChild()->GetContentInsertionFrame();
   }
 
   virtual nsMargin GetUsedMargin() const override;
 
-  virtual void NotifyPercentHeight(const nsHTMLReflowState& aReflowState) override;
+  virtual void NotifyPercentBSize(const nsHTMLReflowState& aReflowState) override;
 
   virtual bool NeedsToObserve(const nsHTMLReflowState& aReflowState) override;
 
   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                 const nsRect&           aDirtyRect,
                                 const nsDisplayListSet& aLists) override;
 
   DrawResult PaintCellBackground(nsRenderingContext& aRenderingContext,
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1656,66 +1656,69 @@ nsTableFrame::ComputeAutoSize(nsRenderin
   // Tables always shrink-wrap.
   nscoord cbBased = aAvailableISize - aMargin.ISize(aWM) - aBorder.ISize(aWM) -
                     aPadding.ISize(aWM);
   return LogicalSize(aWM, TableShrinkWidthToFit(aRenderingContext, cbBased),
                      NS_UNCONSTRAINEDSIZE);
 }
 
 // Return true if aParentReflowState.frame or any of its ancestors within
-// the containing table have non-auto height. (e.g. pct or fixed height)
+// the containing table have non-auto bsize. (e.g. pct or fixed bsize)
 bool
-nsTableFrame::AncestorsHaveStyleHeight(const nsHTMLReflowState& aParentReflowState)
-{
+nsTableFrame::AncestorsHaveStyleBSize(const nsHTMLReflowState& aParentReflowState)
+{
+  WritingMode wm = aParentReflowState.GetWritingMode();
   for (const nsHTMLReflowState* rs = &aParentReflowState;
        rs && rs->frame; rs = rs->parentReflowState) {
     nsIAtom* frameType = rs->frame->GetType();
     if (IS_TABLE_CELL(frameType)                     ||
         (nsGkAtoms::tableRowFrame      == frameType) ||
         (nsGkAtoms::tableRowGroupFrame == frameType)) {
-      const nsStyleCoord &height = rs->mStylePosition->mHeight;
+      const nsStyleCoord &bsize = rs->mStylePosition->BSize(wm);
       // calc() with percentages treated like 'auto' on internal table elements
-      if (height.GetUnit() != eStyleUnit_Auto &&
-          (!height.IsCalcUnit() || !height.HasPercent())) {
+      if (bsize.GetUnit() != eStyleUnit_Auto &&
+          (!bsize.IsCalcUnit() || !bsize.HasPercent())) {
         return true;
       }
     }
     else if (nsGkAtoms::tableFrame == frameType) {
       // we reached the containing table, so always return
-      return rs->mStylePosition->mHeight.GetUnit() != eStyleUnit_Auto;
+      return rs->mStylePosition->BSize(wm).GetUnit() != eStyleUnit_Auto;
     }
   }
   return false;
 }
 
-// See if a special height reflow needs to occur and if so, call RequestSpecialHeightReflow
+// See if a special block-size reflow needs to occur and if so,
+// call RequestSpecialBSizeReflow
 void
-nsTableFrame::CheckRequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState)
+nsTableFrame::CheckRequestSpecialBSizeReflow(const nsHTMLReflowState& aReflowState)
 {
   NS_ASSERTION(IS_TABLE_CELL(aReflowState.frame->GetType()) ||
                aReflowState.frame->GetType() == nsGkAtoms::tableRowFrame ||
                aReflowState.frame->GetType() == nsGkAtoms::tableRowGroupFrame ||
                aReflowState.frame->GetType() == nsGkAtoms::tableFrame,
                "unexpected frame type");
+  WritingMode wm = aReflowState.GetWritingMode();
   if (!aReflowState.frame->GetPrevInFlow() &&  // 1st in flow
-      (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedHeight() ||  // no computed height
-       0                    == aReflowState.ComputedHeight()) &&
-      eStyleUnit_Percent == aReflowState.mStylePosition->mHeight.GetUnit() && // pct height
-      nsTableFrame::AncestorsHaveStyleHeight(*aReflowState.parentReflowState)) {
-    nsTableFrame::RequestSpecialHeightReflow(aReflowState);
+      (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedBSize() ||  // no computed bsize
+       0                    == aReflowState.ComputedBSize()) &&
+      eStyleUnit_Percent == aReflowState.mStylePosition->BSize(wm).GetUnit() && // pct bsize
+      nsTableFrame::AncestorsHaveStyleBSize(*aReflowState.parentReflowState)) {
+    nsTableFrame::RequestSpecialBSizeReflow(aReflowState);
   }
 }
 
 // Notify the frame and its ancestors (up to the containing table) that a special
 // height reflow will occur. During a special height reflow, a table, row group,
 // row, or cell returns the last size it was reflowed at. However, the table may
 // change the height of row groups, rows, cells in DistributeHeightToRows after.
 // And the row group can change the height of rows, cells in CalculateRowHeights.
 void
-nsTableFrame::RequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState)
+nsTableFrame::RequestSpecialBSizeReflow(const nsHTMLReflowState& aReflowState)
 {
   // notify the frame and its ancestors of the special reflow, stopping at the containing table
   for (const nsHTMLReflowState* rs = &aReflowState; rs && rs->frame; rs = rs->parentReflowState) {
     nsIAtom* frameType = rs->frame->GetType();
     NS_ASSERTION(IS_TABLE_CELL(frameType) ||
                  nsGkAtoms::tableRowFrame == frameType ||
                  nsGkAtoms::tableRowGroupFrame == frameType ||
                  nsGkAtoms::tableFrame == frameType,
@@ -1744,22 +1747,22 @@ nsTableFrame::RequestSpecialHeightReflow
  * if (a) a row group, row, cell, or a frame inside a cell has a percent height but no computed
  * height or (b) in paginated mode, a table has a height. (a) supports percent nested tables
  * contained inside cells whose heights aren't known until after the pass 2 reflow. (b) is
  * necessary because the table cannot split until after the pass 2 reflow. The mechanics of
  * the special height reflow (variety a) are as follows:
  *
  * 1) Each table related frame (table, row group, row, cell) implements NeedsSpecialReflow()
  *    to indicate that it should get the reflow. It does this when it has a percent height but
- *    no computed height by calling CheckRequestSpecialHeightReflow(). This method calls
- *    RequestSpecialHeightReflow() which calls SetNeedSpecialReflow() on its ancestors until
+ *    no computed height by calling CheckRequestSpecialBSizeReflow(). This method calls
+ *    RequestSpecialBSizeReflow() which calls SetNeedSpecialReflow() on its ancestors until
  *    it reaches the containing table and calls SetNeedToInitiateSpecialReflow() on it. For
- *    percent height frames inside cells, during DidReflow(), the cell's NotifyPercentHeight()
- *    is called (the cell is the reflow state's mPercentHeightObserver in this case).
- *    NotifyPercentHeight() calls RequestSpecialHeightReflow().
+ *    percent height frames inside cells, during DidReflow(), the cell's NotifyPercentBSize()
+ *    is called (the cell is the reflow state's mPercentBSizeObserver in this case).
+ *    NotifyPercentBSize() calls RequestSpecialBSizeReflow().
  *
  * 2) After the pass 2 reflow, if the table's NeedToInitiateSpecialReflow(true) was called, it
  *    will do the special height reflow, setting the reflow state's mFlags.mSpecialHeightReflow
  *    to true and mSpecialHeightInitiator to itself. It won't do this if IsPrematureSpecialHeightReflow()
  *    returns true because in that case another special height reflow will be coming along with the
  *    containing table as the mSpecialHeightInitiator. It is only relevant to do the reflow when
  *    the mSpecialHeightInitiator is the containing table, because if it is a remote ancestor, then
  *    appropriate heights will not be known.
@@ -1809,126 +1812,130 @@ nsTableFrame::Reflow(nsPresContext*     
     return;
   }
 
   // see if collapsing borders need to be calculated
   if (!GetPrevInFlow() && IsBorderCollapse() && NeedToCalcBCBorders()) {
     CalcBCBorders();
   }
 
-  aDesiredSize.Width() = aReflowState.AvailableWidth();
+  aDesiredSize.ISize(wm) = aReflowState.AvailableISize();
 
   // Check for an overflow list, and append any row group frames being pushed
   MoveOverflowToChildList();
 
-  bool haveDesiredHeight = false;
+  bool haveDesiredBSize = false;
   SetHaveReflowedColGroups(false);
 
   // Reflow the entire table (pass 2 and possibly pass 3). This phase is necessary during a
   // constrained initial reflow and other reflows which require either a strategy init or balance.
   // This isn't done during an unconstrained reflow, because it will occur later when the parent
   // reflows with a constrained width.
   if (NS_SUBTREE_DIRTY(this) ||
       aReflowState.ShouldReflowAllKids() ||
       IsGeometryDirty() ||
-      aReflowState.IsVResize()) {
-
-    if (aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE ||
-        // Also check mVResize, to handle the first Reflow preceding a
-        // special height Reflow, when we've already had a special height
-        // Reflow (where mComputedHeight would not be
+      aReflowState.IsBResize()) {
+
+    if (aReflowState.ComputedBSize() != NS_UNCONSTRAINEDSIZE ||
+        // Also check IsBResize, to handle the first Reflow preceding a
+        // special height Reflow, when we've already had a special bsize
+        // Reflow (where ComputedBSize would not be
         // NS_UNCONSTRAINEDSIZE, but without a style change in between).
-        aReflowState.IsVResize()) {
+        aReflowState.IsBResize()) {
       // XXX Eventually, we should modify DistributeHeightToRows to use
       // nsTableRowFrame::GetHeight instead of nsIFrame::GetSize().height.
       // That way, it will make its calculations based on internal table
       // frame heights as they are before they ever had any extra height
       // distributed to them.  In the meantime, this reflows all the
       // internal table frames, which restores them to their state before
       // DistributeHeightToRows was called.
       SetGeometryDirty();
     }
 
     bool needToInitiateSpecialReflow =
       !!(GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE);
-    // 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())) {
-      nscoord tableSpecifiedHeight = CalcBorderBoxHeight(aReflowState);
-      if ((tableSpecifiedHeight > 0) &&
-          (tableSpecifiedHeight != NS_UNCONSTRAINEDSIZE)) {
+    // see if an extra reflow will be necessary in pagination mode
+    // when there is a specified table bsize
+    if (isPaginated && !GetPrevInFlow() && (NS_UNCONSTRAINEDSIZE != aReflowState.AvailableBSize())) {
+      nscoord tableSpecifiedBSize = CalcBorderBoxHeight(aReflowState);
+      if ((tableSpecifiedBSize > 0) &&
+          (tableSpecifiedBSize != NS_UNCONSTRAINEDSIZE)) {
         needToInitiateSpecialReflow = true;
       }
     }
     nsIFrame* lastChildReflowed = nullptr;
 
     NS_ASSERTION(!aReflowState.mFlags.mSpecialHeightReflow,
                  "Shouldn't be in special height reflow here!");
 
     // 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();
-
-    ReflowTable(aDesiredSize, aReflowState, availHeight,
+    nscoord availBSize = needToInitiateSpecialReflow
+                          ? NS_UNCONSTRAINEDSIZE : aReflowState.AvailableBSize();
+
+    ReflowTable(aDesiredSize, aReflowState, availBSize,
                 lastChildReflowed, aStatus);
 
-    // reevaluate special height reflow conditions
-    if (GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE)
+    // reevaluate special bsize reflow conditions
+    if (GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE) {
       needToInitiateSpecialReflow = true;
+    }
 
     // XXXldb Are all these conditions correct?
     if (needToInitiateSpecialReflow && NS_FRAME_IS_COMPLETE(aStatus)) {
       // XXXldb Do we need to set the mVResize flag on any reflow states?
 
       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.AvailableBSize(),
                   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
+        // if there is an incomplete child, then set the desired bsize
+        // to include it but not the next one
         LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowState);
-        aDesiredSize.Height() = borderPadding.BEnd(wm) + GetRowSpacing(GetRowCount()) +
-                              lastChildReflowed->GetNormalRect().YMost();
+        aDesiredSize.BSize(wm) =
+          borderPadding.BEnd(wm) + GetRowSpacing(GetRowCount()) +
+          lastChildReflowed->GetNormalRect().YMost(); // XXX YMost should be B-flavored
       }
-      haveDesiredHeight = true;
+      haveDesiredBSize = true;
 
       mutable_rs.mFlags.mSpecialHeightReflow = false;
     }
   }
   else {
     // Calculate the overflow area contribution from our children.
     for (nsIFrame* kid : mFrames) {
       ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kid);
     }
   }
 
-  aDesiredSize.Width() = aReflowState.ComputedWidth() +
-                       aReflowState.ComputedPhysicalBorderPadding().LeftRight();
-  if (!haveDesiredHeight) {
+  aDesiredSize.ISize(wm) = aReflowState.ComputedISize() +
+    aReflowState.ComputedLogicalBorderPadding().IStartEnd(wm);
+  if (!haveDesiredBSize) {
     CalcDesiredHeight(aReflowState, aDesiredSize);
   }
   if (IsRowInserted()) {
-    ProcessRowInserted(aDesiredSize.Height());
+    ProcessRowInserted(aDesiredSize.BSize(wm));
   }
 
   LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowState);
-  SetColumnDimensions(aDesiredSize.Height(), wm, borderPadding,
+  SetColumnDimensions(aDesiredSize.BSize(wm), wm, borderPadding,
                       aDesiredSize.Width());
   if (NeedToCollapse() &&
-      (NS_UNCONSTRAINEDSIZE != aReflowState.AvailableWidth())) {
+      (NS_UNCONSTRAINEDSIZE != aReflowState.AvailableISize())) {
     AdjustForCollapsingRowsCols(aDesiredSize, wm, borderPadding);
   }
 
   // If there are any relatively-positioned table parts, we need to reflow their
   // absolutely-positioned descendants now that their dimensions are final.
   FixupPositionedTableParts(aPresContext, aDesiredSize, aReflowState);
 
   // make sure the table overflow area does include the table rect.
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -153,26 +153,26 @@ public:
     */
   virtual void Init(nsIContent*       aContent,
                     nsContainerFrame* aParent,
                     nsIFrame*         aPrevInFlow) override;
 
   static float GetTwipsToPixels(nsPresContext* aPresContext);
 
   // Return true if aParentReflowState.frame or any of its ancestors within
-  // the containing table have non-auto height. (e.g. pct or fixed height)
-  static bool AncestorsHaveStyleHeight(const nsHTMLReflowState& aParentReflowState);
+  // the containing table have non-auto bsize. (e.g. pct or fixed bsize)
+  static bool AncestorsHaveStyleBSize(const nsHTMLReflowState& aParentReflowState);
 
-  // See if a special height reflow will occur due to having a pct height when
-  // the pct height basis may not yet be valid.
-  static void CheckRequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState);
+  // See if a special height reflow will occur due to having a pct bsize when
+  // the pct bsize basis may not yet be valid.
+  static void CheckRequestSpecialBSizeReflow(const nsHTMLReflowState& aReflowState);
 
   // Notify the frame and its ancestors (up to the containing table) that a special
   // height reflow will occur.
-  static void RequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState);
+  static void RequestSpecialBSizeReflow(const nsHTMLReflowState& aReflowState);
 
   static void RePositionViews(nsIFrame* aFrame);
 
   static bool PageBreakAfter(nsIFrame* aSourceFrame,
                                nsIFrame* aNextFrame);
 
   // Register a positioned table part with its nsTableFrame. These objects will
   // be visited by FixupPositionedTableParts after reflow is complete. (See that
--- a/layout/tables/nsTableOuterFrame.cpp
+++ b/layout/tables/nsTableOuterFrame.cpp
@@ -778,19 +778,19 @@ nsTableOuterFrame::UpdateReflowMetrics(u
   ConsiderChildOverflow(aMet.mOverflowAreas, InnerTableFrame());
   if (mCaptionFrames.NotEmpty()) {
     ConsiderChildOverflow(aMet.mOverflowAreas, mCaptionFrames.FirstChild());
   }
 }
 
 void
 nsTableOuterFrame::Reflow(nsPresContext*           aPresContext,
-                                    nsHTMLReflowMetrics&     aDesiredSize,
-                                    const nsHTMLReflowState& aOuterRS,
-                                    nsReflowStatus&          aStatus)
+                          nsHTMLReflowMetrics&     aDesiredSize,
+                          const nsHTMLReflowState& aOuterRS,
+                          nsReflowStatus&          aStatus)
 {
   MarkInReflow();
   DO_GLOBAL_REFLOW_COUNT("nsTableOuterFrame");
   DISPLAY_REFLOW(aPresContext, this, aOuterRS, aDesiredSize, aStatus);
 
   uint8_t captionSide = GetCaptionSide();
 
   // Initialize out parameters
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -1080,17 +1080,17 @@ nsTableRowFrame::Reflow(nsPresContext*  
   nsTableFrame* tableFrame = GetTableFrame();
   const nsStyleVisibility* rowVis = StyleVisibility();
   bool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
   if (collapseRow) {
     tableFrame->SetNeedToCollapse(true);
   }
 
   // see if a special height reflow needs to occur due to having a pct height
-  nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
+  nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowState);
 
   // See if we have a cell with specified/pct bsize
   InitHasCellWithStyleBSize(tableFrame);
 
   ReflowChildren(aPresContext, aDesiredSize, aReflowState, *tableFrame, aStatus);
 
   if (aPresContext->IsPaginated() && !NS_FRAME_IS_FULLY_COMPLETE(aStatus) &&
       ShouldAvoidBreakInside(aReflowState)) {
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -1326,17 +1326,17 @@ nsTableRowGroupFrame::Reflow(nsPresConte
   DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
 
   aStatus     = NS_FRAME_COMPLETE;
 
   // Row geometry may be going to change so we need to invalidate any row cursor.
   ClearRowCursor();
 
   // see if a special height reflow needs to occur due to having a pct height
-  nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
+  nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowState);
 
   nsTableFrame* tableFrame = GetTableFrame();
   nsRowGroupReflowState state(aReflowState, tableFrame);
   const nsStyleVisibility* groupVis = StyleVisibility();
   bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
   if (collapseGroup) {
     tableFrame->SetNeedToCollapse(true);
   }