diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 48499d7e36e..0fb5c6579c1 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -2005,9 +2005,10 @@ impl Fragment { // See CSS 2.1 ยง 10.8.1. let flow = &info.flow_ref; let block_flow = flow.as_block(); + let is_auto = self.style.get_position().height == LengthOrPercentageOrAuto::Auto; let baseline_offset = match flow.baseline_offset_of_last_line_box_in_flow() { - Some(baseline_offset) => baseline_offset, - None => block_flow.fragment.border_box.size.block, + Some(baseline_offset) if is_auto => baseline_offset, + _ => block_flow.fragment.border_box.size.block, }; let start_margin = block_flow.fragment.margin.block_start; let end_margin = block_flow.fragment.margin.block_end; diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index d150aa4538c..6fd9384d01e 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -5272,6 +5272,18 @@ "url": "/_mozilla/css/text_transform_uppercase_a.html" } ], + "css/textarea_space_calculation.html": [ + { + "path": "css/textarea_space_calculation.html", + "references": [ + [ + "/_mozilla/css/textarea_space_calculation-ref.html", + "==" + ] + ], + "url": "/_mozilla/css/textarea_space_calculation.html" + } + ], "css/transform_3d.html": [ { "path": "css/transform_3d.html", @@ -14390,6 +14402,18 @@ "url": "/_mozilla/css/text_transform_uppercase_a.html" } ], + "css/textarea_space_calculation.html": [ + { + "path": "css/textarea_space_calculation.html", + "references": [ + [ + "/_mozilla/css/textarea_space_calculation-ref.html", + "==" + ] + ], + "url": "/_mozilla/css/textarea_space_calculation.html" + } + ], "css/transform_3d.html": [ { "path": "css/transform_3d.html", diff --git a/tests/wpt/mozilla/tests/css/textarea_space_calculation-ref.html b/tests/wpt/mozilla/tests/css/textarea_space_calculation-ref.html new file mode 100644 index 00000000000..b777beb062b --- /dev/null +++ b/tests/wpt/mozilla/tests/css/textarea_space_calculation-ref.html @@ -0,0 +1,19 @@ + +REFERENCE: textarea does not take up more space than it takes up + +

To pass, no red should be visible

+
+ +
diff --git a/tests/wpt/mozilla/tests/css/textarea_space_calculation.html b/tests/wpt/mozilla/tests/css/textarea_space_calculation.html new file mode 100644 index 00000000000..20945e971b5 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/textarea_space_calculation.html @@ -0,0 +1,21 @@ + + +textarea does not take up more space than it takes up + + +

To pass, no red should be visible

+
+ +