From 5294559f7bf10b7c0f055f029b8586d9fec6c0f6 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Fri, 24 Oct 2025 00:14:25 +0100 Subject: [PATCH] LibWeb: Use logical properties in UA stylesheet --- Libraries/LibWeb/CSS/Default.css | 27 +++++++------------ .../pre-margin-block-ref.html | 17 ++++++++++++ .../pre-margin-block.html | 27 +++++++++++++++++++ 3 files changed, 53 insertions(+), 18 deletions(-) create mode 100644 Tests/LibWeb/Ref/expected/wpt-import/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/pre-margin-block-ref.html create mode 100644 Tests/LibWeb/Ref/input/wpt-import/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/pre-margin-block.html diff --git a/Libraries/LibWeb/CSS/Default.css b/Libraries/LibWeb/CSS/Default.css index 8554964b013..e30b295108a 100644 --- a/Libraries/LibWeb/CSS/Default.css +++ b/Libraries/LibWeb/CSS/Default.css @@ -209,13 +209,11 @@ header, hr, legend, listing, main, p, plaintext, pre, search, xmp { } blockquote, figure, listing, p, plaintext, pre, xmp { - margin-top: 1em; - margin-bottom: 1em; + margin-block: 1em; } blockquote, figure { - margin-left: 40px; - margin-right: 40px; + margin-inline: 40px; } address { @@ -449,43 +447,37 @@ article, aside, :heading, hgroup, nav, section { } h1 { - margin-top: 0.67em; - margin-bottom: 0.67em; + margin-block: 0.67em; font-size: 2.00em; font-weight: bold; } h2 { - margin-top: 0.83em; - margin-bottom: 0.83em; + margin-block: 0.83em; font-size: 1.50em; font-weight: bold; } h3 { - margin-top: 1.00em; - margin-bottom: 1.00em; + margin-block: 1.00em; font-size: 1.17em; font-weight: bold; } h4 { - margin-top: 1.33em; - margin-bottom: 1.33em; + margin-block: 1.33em; font-size: 1.00em; font-weight: bold; } h5 { - margin-top: 1.67em; - margin-bottom: 1.67em; + margin-block: 1.67em; font-size: 0.83em; font-weight: bold; } h6 { - margin-top: 2.33em; - margin-bottom: 2.33em; + margin-block: 2.33em; font-size: 0.67em; font-weight: bold; } @@ -724,8 +716,7 @@ fieldset { } legend { - padding-left: 2px; - padding-right: 2px; + padding-inline: 2px; } legend[align=left i] { diff --git a/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/pre-margin-block-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/pre-margin-block-ref.html new file mode 100644 index 00000000000..b66f6980cec --- /dev/null +++ b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/pre-margin-block-ref.html @@ -0,0 +1,17 @@ + + + +
pre
+xmp +listing +
blockquote
+
figure
+

p

+plaintext diff --git a/Tests/LibWeb/Ref/input/wpt-import/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/pre-margin-block.html b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/pre-margin-block.html new file mode 100644 index 00000000000..f486fad2650 --- /dev/null +++ b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/pre-margin-block.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://html.spec.whatwg.org/multipage/rendering.html#the-css-user-agent-style-sheet-and-presentational-hints"> +<link rel=help href="https://issues.chromium.org/issues/407315792"> +<link rel=match href="../../../../../expected/wpt-import/html/rendering/the-css-user-agent-style-sheet-and-presentational-hints/pre-margin-block-ref.html"> + +<!-- +This is a test for the following UA style rule in the HTML spec: + +blockquote, figure, listing, p, plaintext, pre, xmp { + margin-block: 1em; +} +--> + +<style> +html { + writing-mode: vertical-rl; +} +</style> + +<pre>pre</pre> +<xmp>xmp</xmp> +<listing>listing</listing> +<blockquote>blockquote</blockquote> +<figure>figure</figure> +<p>p</p> +<plaintext>plaintext