From 3f6e59a2b74fcab7caa0041543722fae3b685e07 Mon Sep 17 00:00:00 2001 From: Ian Kilpatrick Date: Tue, 30 Nov 2021 17:49:32 +0000 Subject: [PATCH] [layout] Stretch semi-replaced elements when OOF in inline direction. As per: https://github.com/w3c/csswg-drafts/issues/6789 Removes the tests which were previously testing the shrink-to-fit behaviour, and adds new tests for the stretch behaviour (on more elements). Bug: 1274898 Change-Id: I5c40a4b88fe06d7ef79113a66ef3976375d026eb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3272378 Commit-Queue: Ian Kilpatrick Reviewed-by: Morten Stenshorne Cr-Commit-Position: refs/heads/main@{#946530} NOKEYCHECK=True GitOrigin-RevId: da65a23485a8a1abedd0fff0f390238fdd56258b --- .../core/layout/ng/ng_absolute_utils.cc | 3 +- .../FlagExpectations/disable-layout-ng | 3 + .../position-absolute-center-005.html | 10 --- ...lute-semi-replaced-stretch-button-ref.html | 23 +++++++ ...absolute-semi-replaced-stretch-button.html | 28 ++++++++ ...olute-semi-replaced-stretch-input-ref.html | 34 +++++++++ ...-absolute-semi-replaced-stretch-input.html | 42 +++++++++++ ...olute-semi-replaced-stretch-other-ref.html | 32 +++++++++ ...-absolute-semi-replaced-stretch-other.html | 40 +++++++++++ .../widgets/button-layout/abspos.html | 31 --------- ...nd-right-and-intrinsic-width-expected.html | 68 ------------------ ...t-and-intrinsic-width-quirks-expected.html | 67 ------------------ ...-and-right-and-intrinsic-width-quirks.html | 68 ------------------ ...nd-left-and-right-and-intrinsic-width.html | 69 ------------------- 14 files changed, 203 insertions(+), 315 deletions(-) delete mode 100644 blink/web_tests/external/wpt/css/css-position/position-absolute-center-005.html create mode 100644 blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-button-ref.html create mode 100644 blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-button.html create mode 100644 blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-input-ref.html create mode 100644 blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-input.html create mode 100644 blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-other-ref.html create mode 100644 blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-other.html delete mode 100644 blink/web_tests/external/wpt/html/rendering/widgets/button-layout/abspos.html delete mode 100644 blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-expected.html delete mode 100644 blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-quirks-expected.html delete mode 100644 blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-quirks.html delete mode 100644 blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width.html diff --git a/blink/renderer/core/layout/ng/ng_absolute_utils.cc b/blink/renderer/core/layout/ng/ng_absolute_utils.cc index b0f92e7e4fc..05a41be9fff 100644 --- a/blink/renderer/core/layout/ng/ng_absolute_utils.cc +++ b/blink/renderer/core/layout/ng/ng_absolute_utils.cc @@ -346,7 +346,7 @@ bool ComputeOutOfFlowInlineDimensions( const bool is_table = node.IsTable(); const bool can_compute_block_size_without_layout = CanComputeBlockSizeWithoutLayout(node); - bool is_shrink_to_fit = is_table || node.ShouldBeConsideredAsReplaced(); + bool is_shrink_to_fit = is_table; auto MinMaxSizesFunc = [&](MinMaxSizesType type) -> MinMaxSizesResult { DCHECK(!node.IsReplaced()); @@ -458,7 +458,6 @@ scoped_refptr ComputeOutOfFlowBlockDimensions( scoped_refptr result; - // NOTE: |is_shrink_to_fit| isn't symmetrical with the inline calculations. const auto& style = node.Style(); const bool is_table = node.IsTable(); bool is_shrink_to_fit = is_table; diff --git a/blink/web_tests/FlagExpectations/disable-layout-ng b/blink/web_tests/FlagExpectations/disable-layout-ng index a3c489c3f85..13cbf0c5744 100644 --- a/blink/web_tests/FlagExpectations/disable-layout-ng +++ b/blink/web_tests/FlagExpectations/disable-layout-ng @@ -256,6 +256,9 @@ crbug.com/591099 external/wpt/css/css-position/position-absolute-in-inline-003.h crbug.com/591099 external/wpt/css/css-position/position-absolute-in-inline-004.html [ Failure ] crbug.com/591099 external/wpt/css/css-position/position-absolute-replaced-intrinsic-size.tentative.html [ Failure ] crbug.com/591099 external/wpt/css/css-position/position-absolute-replaced-no-intrinsic-size.tentative.html [ Failure ] +crbug.com/591099 external/wpt/css/css-position/position-absolute-semi-replaced-stretch-button.html [ Failure ] +crbug.com/591099 external/wpt/css/css-position/position-absolute-semi-replaced-stretch-input.html [ Failure ] +crbug.com/591099 external/wpt/css/css-position/position-absolute-semi-replaced-stretch-other.html [ Failure ] crbug.com/591099 external/wpt/css/css-position/position-relative-001.html [ Failure ] crbug.com/591099 external/wpt/css/css-position/position-relative-002.html [ Failure ] crbug.com/591099 external/wpt/css/css-position/position-relative-004.html [ Failure ] diff --git a/blink/web_tests/external/wpt/css/css-position/position-absolute-center-005.html b/blink/web_tests/external/wpt/css/css-position/position-absolute-center-005.html deleted file mode 100644 index c586719f8e2..00000000000 --- a/blink/web_tests/external/wpt/css/css-position/position-absolute-center-005.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - -

Test passes if there is a filled green square and no red.

-
- -
diff --git a/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-button-ref.html b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-button-ref.html new file mode 100644 index 00000000000..296b87ba615 --- /dev/null +++ b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-button-ref.html @@ -0,0 +1,23 @@ + + +
diff --git a/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-button.html b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-button.html new file mode 100644 index 00000000000..fbcdbec51b6 --- /dev/null +++ b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-button.html @@ -0,0 +1,28 @@ + + + +Semi-replaced elements should stretch with an auto main size, and explicit insets in that direction. + +
diff --git a/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-input-ref.html b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-input-ref.html new file mode 100644 index 00000000000..554173c6323 --- /dev/null +++ b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-input-ref.html @@ -0,0 +1,34 @@ + + +
+
+
+
+
+
+
+
+
diff --git a/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-input.html b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-input.html new file mode 100644 index 00000000000..6080f63c101 --- /dev/null +++ b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-input.html @@ -0,0 +1,42 @@ + + + +Semi-replaced elements should stretch with an auto main size, and explicit insets in that direction. + +
+
+
+
+
+
+
+
+
diff --git a/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-other-ref.html b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-other-ref.html new file mode 100644 index 00000000000..e334bc0f63d --- /dev/null +++ b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-other-ref.html @@ -0,0 +1,32 @@ + + +
+
output
+
+
fieldset
+
+
+
diff --git a/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-other.html b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-other.html new file mode 100644 index 00000000000..21fc2c84e3d --- /dev/null +++ b/blink/web_tests/external/wpt/css/css-position/position-absolute-semi-replaced-stretch-other.html @@ -0,0 +1,40 @@ + + + +Semi-replaced elements should stretch with an auto main size, and explicit insets in that direction. + +
+
output
+
+
fieldset
+
+
+
diff --git a/blink/web_tests/external/wpt/html/rendering/widgets/button-layout/abspos.html b/blink/web_tests/external/wpt/html/rendering/widgets/button-layout/abspos.html deleted file mode 100644 index c3089b1e397..00000000000 --- a/blink/web_tests/external/wpt/html/rendering/widgets/button-layout/abspos.html +++ /dev/null @@ -1,31 +0,0 @@ - -abspos button with auto width, non-auto left/right - - - - - - - - - - - diff --git a/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-expected.html b/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-expected.html deleted file mode 100644 index eb371249e8a..00000000000 --- a/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-expected.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - -
Check if the elements shrink to fit as per their 'intrinsic' width for Button, input, select and textarea. If you see any the elements strech to available width, then the test has failed.
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- - diff --git a/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-quirks-expected.html b/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-quirks-expected.html deleted file mode 100644 index 2f7e3d71bf4..00000000000 --- a/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-quirks-expected.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - -
Check if the elements shrink to fit as per their 'intrinsic' width for Button, input, select and textarea. If you see any the elements strech to available width, then the test has failed.
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- - diff --git a/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-quirks.html b/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-quirks.html deleted file mode 100644 index 5f8462490a8..00000000000 --- a/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width-quirks.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - -
Check if the elements shrink to fit as per their 'intrinsic' width for Button, input, select and textarea. If you see any the elements strech to available width, then the test has failed.
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- - diff --git a/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width.html b/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width.html deleted file mode 100644 index dbad531bba8..00000000000 --- a/blink/web_tests/fast/replaced/absolute-position-auto-width-and-left-and-right-and-intrinsic-width.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - -
Check if the elements shrink to fit as per their 'intrinsic' width for Button, input, select and textarea. If you see any the elements strech to available width, then the test has failed.
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- -