diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp
index 27365836ec..60f3515c31 100644
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4645,6 +4645,13 @@ nsFrame::SetCoordToFlexBasis(bool aIsInlineFlexItem,
auto mainAxisCoord = aIsInlineFlexItem ?
aInlineStyle :
aBlockStyle;
+ // NOTE: If we're a table-wrapper frame, we skip this clause and just stick
+ // with 'main-size:auto' behavior (which -- unlike 'content'
+ // i.e. 'max-content' -- will give us the ability to honor percent sizes on
+ // our table-box child when resolving the flex base size). The flexbox spec
+ // doesn't call for this special case, but webcompat & regression-avoidance
+ // seems to require it, for the time being... Tables sure are special.
+ bool isTableWrapperFrame = GetType() == nsGkAtoms::tableWrapperFrame;
// We have a used flex-basis of 'content' if flex-basis explicitly has that
// value, OR if flex-basis is 'auto' (deferring to the main-size property)
// and the main-size property is also 'auto'.
@@ -4665,7 +4672,7 @@ nsFrame::SetCoordToFlexBasis(bool aIsInlineFlexItem,
// which substep we fall into) by using the 'auto' keyword for our
// main-axis coordinate here. (This makes sense, because the spec is
// effectively trying to produce the 'auto' sizing behavior).
- if (aIntrinsic) {
+ if (aIntrinsic || MOZ_LIKELY(isTableWrapperFrame)) {
static const nsStyleCoord autoStyleCoord(eStyleUnit_Auto);
*mainAxisCoord = &autoStyleCoord;
} else {
diff --git a/layout/reftests/flexbox/flexbox-table-flex-items-2-ref.html b/layout/reftests/flexbox/flexbox-table-flex-items-2-ref.html
new file mode 100644
index 0000000000..98a93716a5
--- /dev/null
+++ b/layout/reftests/flexbox/flexbox-table-flex-items-2-ref.html
@@ -0,0 +1,64 @@
+
+
+
+
+
+ CSS Reftest Reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/flexbox/flexbox-table-flex-items-2.html b/layout/reftests/flexbox/flexbox-table-flex-items-2.html
new file mode 100644
index 0000000000..c11ce70802
--- /dev/null
+++ b/layout/reftests/flexbox/flexbox-table-flex-items-2.html
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+ CSS Test: Testing that implicit "flex-basis: content" on table wrapper box
+ doesn't prevent explicit table size from influencing flex base size.
+
+
+
+
+
+
+
+
+
+