Skip to content

Commit

Permalink
css-display] Move unboxing to style, and handle display: contents bef…
Browse files Browse the repository at this point in the history
…ore other suppressions.

This also adopts the resolution of [1] while at it, and switches XUL to not
support display: contents until a use case appears.

This makes our behavior consistent both with the spec and also in terms of
handling dynamic changes to stuff that would otherwise get suppressed.

Also makes us consistent with both Blink and WebKit in terms of computed style.
We were the only ones respecting "behaves as display: none" without actually
computing to display: none. Will file a spec issue to get that changed.

It also makes us match Blink and WebKit in terms of respecting display: contents
before other suppressions, see the reftest which I didn't write as a WPT
(because there's no spec supporting neither that or the opposite of what we do),
where a <g> element respects display: contents even though if it had any other
kind of display value we'd suppress the frame for it and all the descendants
since it's an SVG element in a non-SVG subtree.

Also, this removes the page-break bit from the display: contents loop, which I
think is harmless.

As long as the tests under style are based in namespace id / node name /
traversal parent, this should not make style sharing go wrong in any way, since
that's the first style sharing check we do at [2].

The general idea under this change is making all nodes with computed style of
display: contents actually honor it. Otherwise there's no way of making the
setup sound except re-introducing something similar to all the state tracking
removed in bug 1303605.

[1]: w3c/csswg-drafts#2167
[2]: https://searchfox.org/mozilla-central/rev/fca4426325624fecbd493c31389721513fc49fef/servo/components/style/sharing/mod.rs#700
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1453702
gecko-commit: 43862b2ee72eec858f509ce3b9cb5c6fa96194ba
gecko-integration-branch: mozilla-inbound
gecko-reviewers: mats, xidorn
  • Loading branch information
emilio authored and moz-wptsync-bot committed Apr 16, 2018
1 parent 88a9970 commit 01d5121
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
10 changes: 10 additions & 0 deletions css/css-display/display-contents-details-001-ref.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Test Reference</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]">
<details>
<div>
<summary>summary</summary>
details
</div>
</details>
12 changes: 12 additions & 0 deletions css/css-display/display-contents-details-001.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Test: display: contents under a details element doesn't prevent content from getting suppressed</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-display-3/#valdef-display-contents">
<link rel="match" href="display-contents-details-001-ref.html">
<details>
<div style="display:contents">
<summary>summary</summary>
details
</div>
</details>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Test Reference</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]">
<p>Test passes if you see nothing below.</p>
16 changes: 16 additions & 0 deletions css/css-display/display-contents-suppression-dynamic-001.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Test: display: contents unboxing works in presence of dynamic changes to the tree.</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-display-3/#valdef-display-contents">
<link rel="help" href="https://drafts.csswg.org/css-display-3/#unbox">
<link rel="match" href="display-contents-suppression-dynamic-001-ref.html">
<p>Test passes if you see nothing below.</p>
<textarea style="display: contents">
FAIL
</textarea>
<script>
let textarea = document.querySelector("textarea");
textarea.offsetTop;
textarea.appendChild(document.createTextNode("FAIL"));
</script>

0 comments on commit 01d5121

Please sign in to comment.