Truly independent web browser
Revert "LibWeb: Keep a button’s baseline when its overflow is hidden"
Shannon Booth1d6ccee2133a
diff --git a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/formatting_context.rsindex 0a5d983c09e..8a0590c6b6f 100644--- a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs@@ -694,14 +694,9 @@ pub(crate) fn box_baseline_with_content_baselines(// baseline sets always derive from content; so do flex and grid containers, which are not block containers.// FIXME: Per CSS Align, a scroll container's content-derived baseline position should be clamped to its border// edge.- // AD-HOC: A box with button layout derives its baselines from its content even when its overflow makes it a- // scroll container, rather than taking its block-end margin edge, so that a button with overflow: hidden- // sits on the line by the text it shows, as pages expect.- // https://html.spec.whatwg.org/multipage/rendering.html#button-layoutlet derive_baseline_from_content = baseline_set == BaselineSet::First|| style.baseline_source() != crate::css::css_enums::baseline_source::AUTO|| is_flex_or_grid_container- || facts.uses_button_layout()|| !facts.is_scroll_container();// AD-HOC: We also use the content-derived baseline for <input> elements with block children, even when their@@ -717,17 +712,7 @@ pub(crate) fn box_baseline_with_content_baselines(if let Some(content_baseline) = content_baseline&& (derive_baseline_from_content || input_derives_from_children){- let baseline = metrics.margin_box_top(collapsed) + content_baseline;- // https://drafts.csswg.org/css-align-3/#baseline-export- // "if the position of a scroll container's first/last baseline is outside its border edge, that baseline's- // position is clamped to the border edge."- // NB: Only a button takes a scroll container's baseline from its content here.- if facts.uses_button_layout() && facts.is_scroll_container() {- let border_box_bottom =- metrics.margin_box_top(collapsed) + metrics.content_block_size() + metrics.border_box_bottom(collapsed);- return baseline.min(border_box_bottom);- }- return baseline;+ return metrics.margin_box_top(collapsed) + content_baseline;}// AD-HOC: Inline buttons without a content baseline synthesize one from their content-box bottom edge indiff --git a/Tests/LibWeb/Layout/expected/button-with-overflow-hidden-baseline.txt b/Tests/LibWeb/Layout/expected/button-with-overflow-hidden-baseline.txtdeleted file mode 100644index 821fcfb774d..00000000000--- a/Tests/LibWeb/Layout/expected/button-with-overflow-hidden-baseline.txt+++ /dev/null@@ -1,50 +0,0 @@-Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 109.203125 0+0+0] [BFC] children: not-inline- BlockContainer <body> at [8,16] [8+0+0 784 0+0+8] [8+0+0 77.203125 0+0+8] children: not-inline- BlockContainer <p> at [8,16] [0+0+0 784 0+0+0] [16+0+0 28 0+0+16] children: inline- frag 0 from TextNode start: 0, length: 9, rect: [8,22 80.484375x16] baseline: 12.796875- "Read the "- frag 1 from BlockContainer start: 0, length: 0, rect: [88.484375,22 45.953125x16] baseline: 12.796875- frag 2 from TextNode start: 0, length: 9, rect: [134.4375,22 75.6875x16] baseline: 12.796875- " and the "- frag 3 from BlockContainer start: 0, length: 0, rect: [220.125,22 109.0625x16] baseline: 18.796875- frag 4 from TextNode start: 0, length: 18, rect: [339.1875,22 151.34375x16] baseline: 12.796875- " before you agree."- TextNode <#text> (not painted)- BlockContainer <button> at [88.484375,22] inline-block [0+0+0 45.953125 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline- BlockContainer <(anonymous)> at [88.484375,22] flex-container(column) [0+0+0 45.953125 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline- BlockContainer <(anonymous)> at [88.484375,22] flex-item [0+0+0 45.953125 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 5, rect: [88.484375,22 45.953125x16] baseline: 12.796875- "terms"- TextNode <#text> (not painted)- TextNode <#text> (not painted)- BlockContainer <button.padded> at [220.125,22] inline-block [0+2+8 109.0625 8+2+0] [0+2+4 16 4+2+0] [BFC] children: not-inline- BlockContainer <(anonymous)> at [220.125,22] flex-container(column) [0+0+0 109.0625 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline- BlockContainer <(anonymous)> at [220.125,22] flex-item [0+0+0 109.0625 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 14, rect: [220.125,22 109.0625x16] baseline: 12.796875- "privacy policy"- TextNode <#text> (not painted)- TextNode <#text> (not painted)- BlockContainer <p> at [8,60] [0+0+0 784 0+0+0] [16+0+0 33.203125 0+0+16] children: inline- frag 0 from TextNode start: 0, length: 1, rect: [8,77 9.703125x16] baseline: 12.796875- "x"- frag 1 from BlockContainer start: 0, length: 0, rect: [19.703125,62 36x26] baseline: 30- frag 2 from TextNode start: 0, length: 1, rect: [57.703125,77 7.171875x16] baseline: 12.796875- "y"- TextNode <#text> (not painted)- BlockContainer <button.short> at [19.703125,62] inline-block [0+2+0 36 0+2+0] [0+2+0 26 0+2+0] [BFC] children: not-inline overflow: [19.703125,62 42.421875x80]- BlockContainer <(anonymous)> at [19.703125,62] flex-container(column) [0+0+0 36 0+0+0] [0+0+0 26 0+0+0] [FFC] children: not-inline- BlockContainer <(anonymous)> at [19.703125,62] flex-item [0+0+0 36 0+0+0] [0+0+0 26 0+0+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 3, rect: [23.359375,64 28.6875x16] baseline: 12.796875- "one"- frag 1 from TextNode start: 4, length: 3, rect: [23.484375,84 28.4375x16] baseline: 12.796875- "two"- frag 2 from TextNode start: 8, length: 5, rect: [19.703125,104 42.421875x16] baseline: 12.796875- "three"- frag 3 from TextNode start: 14, length: 4, rect: [20,124 35.390625x16] baseline: 12.796875- "four"- TextNode <#text> (not painted)- TextNode <#text> (not painted)--SC for Viewport<#document> [0,0 800x600] (z-index: auto)- SC for BlockContainer<HTML> [0,0 800x109.203125] (z-index: auto)diff --git a/Tests/LibWeb/Layout/input/button-with-overflow-hidden-baseline.html b/Tests/LibWeb/Layout/input/button-with-overflow-hidden-baseline.htmldeleted file mode 100644index 40eb1d0d7a2..00000000000--- a/Tests/LibWeb/Layout/input/button-with-overflow-hidden-baseline.html+++ /dev/null@@ -1,8 +0,0 @@-<!DOCTYPE html>-<style>- button { font: inherit; overflow: hidden; padding: 0; border: 0; background: none; text-decoration: underline; }- .padded { padding: 4px 8px; border: 2px solid; }- .short { height: 30px; width: 40px; line-height: 20px; border: 2px solid; }-</style>-<p>Read the <button>terms</button> and the <button class="padded">privacy policy</button> before you agree.</p>-<p>x<button class="short">one two three four</button>y</p>