From d5c3e8dbab404e64bdb99857531b84431d495426 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Mon, 23 Apr 2018 12:05:40 -0700 Subject: [PATCH] Bug 1455976: Give table wrapper boxes a special case during flex base size resolution, so that percent main-sizes can be respected. r=mats MozReview-Commit-ID: GB3SCaj9cv1 --HG-- extra : rebase_source : 565a8fc3879d6b9dcc0f3f6a67e5b577a2dc50b9 --- layout/generic/nsFrame.cpp | 9 ++- .../flexbox-table-flex-items-2-ref.html | 64 ++++++++++++++++ .../flexbox/flexbox-table-flex-items-2.html | 73 ++++++++++++++++++ .../flexbox-table-flex-items-3-ref.html | 66 ++++++++++++++++ .../flexbox/flexbox-table-flex-items-3.html | 75 +++++++++++++++++++ layout/reftests/flexbox/reftest.list | 2 + 6 files changed, 288 insertions(+), 1 deletion(-) create mode 100644 layout/reftests/flexbox/flexbox-table-flex-items-2-ref.html create mode 100644 layout/reftests/flexbox/flexbox-table-flex-items-2.html create mode 100644 layout/reftests/flexbox/flexbox-table-flex-items-3-ref.html create mode 100644 layout/reftests/flexbox/flexbox-table-flex-items-3.html diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 6120cc25549b..916f9b1530f5 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -5676,8 +5676,15 @@ nsFrame::ComputeSize(gfxContext* aRenderingContext, auto& mainAxisCoord = (flexMainAxis == eLogicalAxisInline ? inlineStyleCoord : blockStyleCoord); + // 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. if (nsFlexContainerFrame::IsUsedFlexBasisContent(flexBasis, - mainAxisCoord)) { + mainAxisCoord) && + MOZ_LIKELY(!IsTableWrapperFrame())) { static const nsStyleCoord maxContStyleCoord(NS_STYLE_WIDTH_MAX_CONTENT, eStyleUnit_Enumerated); mainAxisCoord = &maxContStyleCoord; 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 000000000000..98a93716a572 --- /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 000000000000..c11ce7080294 --- /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. + + + + + + + + + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + + diff --git a/layout/reftests/flexbox/flexbox-table-flex-items-3-ref.html b/layout/reftests/flexbox/flexbox-table-flex-items-3-ref.html new file mode 100644 index 000000000000..568495f34194 --- /dev/null +++ b/layout/reftests/flexbox/flexbox-table-flex-items-3-ref.html @@ -0,0 +1,66 @@ + + + + + + CSS Reftest Reference + + + + + + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + + diff --git a/layout/reftests/flexbox/flexbox-table-flex-items-3.html b/layout/reftests/flexbox/flexbox-table-flex-items-3.html new file mode 100644 index 000000000000..c68152856f90 --- /dev/null +++ b/layout/reftests/flexbox/flexbox-table-flex-items-3.html @@ -0,0 +1,75 @@ + + + + + + + CSS Test: Testing that implicit "flex-basis: content" on table wrapper box + doesn't prevent explicit table size from influencing flex base size. + + + + + + + + + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + + diff --git a/layout/reftests/flexbox/reftest.list b/layout/reftests/flexbox/reftest.list index b8b24d757cd1..34d21e2f79da 100644 --- a/layout/reftests/flexbox/reftest.list +++ b/layout/reftests/flexbox/reftest.list @@ -124,3 +124,5 @@ fuzzy-if(gtkWidget,1,31) == flexbox-widget-flex-items-4.html flexbox-widget-flex # Tests for table flex items == flexbox-table-flex-items-1.html flexbox-table-flex-items-1-ref.html +== flexbox-table-flex-items-2.html flexbox-table-flex-items-2-ref.html +== flexbox-table-flex-items-3.html flexbox-table-flex-items-3-ref.html