diff options
author | Martin Robinson <mrobinson@igalia.com> | 2023-06-08 11:55:20 +0200 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2023-06-11 11:47:56 +0200 |
commit | bc58bb080f5a209f8817de7a33e33613d567c012 (patch) | |
tree | d322dc9d58dff2db03e07321bad809a424e93afe /tests | |
parent | fc512cef42a8b5d0046cb467baac0c8bc8856af5 (diff) | |
download | servo-bc58bb080f5a209f8817de7a33e33613d567c012.tar.gz servo-bc58bb080f5a209f8817de7a33e33613d567c012.zip |
Layout 2020: Properly handle negative block margins in floats
If a float has negative block margins, it should be pushed upward, but
shouldn't affect the positioning of any floats that came before it. It
should lower the ceiling though when it still has some non-negative
block contribution. In order to implement this behavior, we should only
place the float considering its non-negative block length contribution. If
the float is pushed up completely past it's "natural" position, it
should be placed like a float with zero block size.
Diffstat (limited to 'tests')
3 files changed, 38 insertions, 0 deletions
diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 8e22e1ee7e1..efebc16e140 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -60647,6 +60647,19 @@ {} ] ], + "negative-block-margin-pushing-float-out-of-block-formatting-context.html": [ + "0ebe54c1904e0c2487ebe15c4d60e9e93672d859", + [ + null, + [ + [ + "/css/CSS2/floats/negative-block-margin-pushing-float-out-of-block-formatting-context-ref.html", + "==" + ] + ], + {} + ] + ], "negative-margin-float-positioning.html": [ "8b4aef22f71f8695ebbc5b6dc83ad5639945618d", [ @@ -359477,6 +359490,10 @@ "68139cdbe2d7c998b6d948f5ecca0ed7ce367694", [] ], + "negative-block-margin-pushing-float-out-of-block-formatting-context-ref.html": [ + "09a0ed094f8eb82f9fa25c4f09bb3f8a1f79c4c9", + [] + ], "overflow-scroll-float-paint-order-ref.html": [ "0fb53d4ecd3cd77e6588be0b271a2ee47950bd29", [] diff --git a/tests/wpt/web-platform-tests/css/CSS2/floats/negative-block-margin-pushing-float-out-of-block-formatting-context-ref.html b/tests/wpt/web-platform-tests/css/CSS2/floats/negative-block-margin-pushing-float-out-of-block-formatting-context-ref.html new file mode 100644 index 00000000000..09a0ed094f8 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/CSS2/floats/negative-block-margin-pushing-float-out-of-block-formatting-context-ref.html @@ -0,0 +1,8 @@ +<!DOCTYPE html> + +<link rel="author" title="Martin Robinson" href="mailto:mrobinson@igalia.com" /> +<meta name="assert" content="When a floating box has a negative margin negative enough that it pushes the float past the top of the block formatting context, it should render properly."/> + +<body> +<div style="width: 50px; height: 50px; background: green;"></div> +</body> diff --git a/tests/wpt/web-platform-tests/css/CSS2/floats/negative-block-margin-pushing-float-out-of-block-formatting-context.html b/tests/wpt/web-platform-tests/css/CSS2/floats/negative-block-margin-pushing-float-out-of-block-formatting-context.html new file mode 100644 index 00000000000..0ebe54c1904 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/CSS2/floats/negative-block-margin-pushing-float-out-of-block-formatting-context.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> + +<link rel="author" title="Martin Robinson" href="mailto:mrobinson@igalia.com" /> +<link rel="help" href="https://drafts.csswg.org/css2/#float-position"/> +<meta name="assert" content="When a floating box has a negative margin negative enough that it pushes the float past the top of the block formatting context, it should render properly."/> +<link rel="match" href="negative-block-margin-pushing-float-out-of-block-formatting-context-ref.html"/> + +<body> +<div style="height: 100px;"></div> +<div style="position: absolute;"> + <div style="float: left; width: 50px; height: 50px; margin-top: -100px; background: green;"></div> +</div> +</body> |