aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOriol Brufau <obrufau@igalia.com>2023-06-08 11:05:31 +0200
committerOriol Brufau <obrufau@igalia.com>2023-07-01 03:00:53 +0200
commit7d8122b264224f82921373e28ca59fda063095eb (patch)
treea2ad59bdd3bc2f7664da0a9723dc06daa1879a28 /tests
parentfe5b494e3f7a977c34ad2ad8758d94c8be41bee1 (diff)
downloadservo-7d8122b264224f82921373e28ca59fda063095eb.tar.gz
servo-7d8122b264224f82921373e28ca59fda063095eb.zip
Check computed (min-)block-size when determining margin collapse
To collapse margins through, CSS2 requires "zero or auto computed height" and "zero computed min-height" (the latter should also also include auto, which was introduced in CSS3 as the new initial value). Similarly, "auto computed height" is required to collapse the bottom margin with the bottom margin of the contents. Therefore this patch stops collapsing when the used height is clamped to zero by max-height, but the computed value is not zero. Same for non-zero percentages that are indefinite or that resolve to 0px. Note that 0% and calc(0% + 0px) are still considered to be zero (so they allow margin collapse), this may a bit inconsistent but matches Firefox (for the collapsing through case). This also matches the heuristics in find_block_margin_collapsing_with_parent(). We could change the heuristics instead, but then they would have to track block sizes in order to be able to resolve percentages. The change makes margin-collapse-through-percentage-height-block.html fail, that test is only passing on Blink, which did a different interpretation of the spec. To be fair, various places of CSS2 loosely consider that indefinite percentages compute to auto, and even Firefox does so when determining whether to collapse the top margin with the contents. Since the spec isn't particularly clear and interoperability is lacking, I filed https://github.com/w3c/csswg-drafts/issues/8919.
Diffstat (limited to 'tests')
-rw-r--r--tests/wpt/meta/css/CSS2/normal-flow/margin-collapse-through-percentage-height-block.html.ini2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/wpt/meta/css/CSS2/normal-flow/margin-collapse-through-percentage-height-block.html.ini b/tests/wpt/meta/css/CSS2/normal-flow/margin-collapse-through-percentage-height-block.html.ini
new file mode 100644
index 00000000000..79c0cdd9cab
--- /dev/null
+++ b/tests/wpt/meta/css/CSS2/normal-flow/margin-collapse-through-percentage-height-block.html.ini
@@ -0,0 +1,2 @@
+[margin-collapse-through-percentage-height-block.html]
+ expected: FAIL