diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-01-19 14:37:57 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-19 14:37:57 -0600 |
commit | bccb757bcd630255c48290ee396b755483d34772 (patch) | |
tree | 80799d54f2fb77d82924bd74d26aa65eacab7f8d /components/script/dom/element.rs | |
parent | 0d7d02fca772a407d4ffa1ebd1e03d60f385eb74 (diff) | |
parent | 902edb925ede2c3d4a2c228aba8b01b9bb084e91 (diff) | |
download | servo-bccb757bcd630255c48290ee396b755483d34772.tar.gz servo-bccb757bcd630255c48290ee396b755483d34772.zip |
Auto merge of #19803 - jonleighton:issue-19765, r=emilio
Implement Element::has_css_layout_box()
r? emilio
Here's my initial attempt to fix #19430. It seems surprisingly simple so I am wondering whether I have missed something! (Or maybe it just actually is quite simple...)
Some things I am unsure about:
1. The spec seems vague about what a [CSS layout box](https://drafts.csswg.org/cssom-view/#css-layout-box) actually is. Indeed it says: "The terms CSS layout box and SVG layout box are not currently defined by CSS or SVG."
2. One thing the spec *does* say explicitly is "For the purpose of the requirements in this specification, elements that have a computed value of the display property that is table-column or table-column-group must be considered to have an associated CSS layout box (the column or column group, respectively)." I am unclear about the relevance of this, since [overflow does not apply](https://drafts.csswg.org/css-overflow-3/#overflow-properties) to an [internal table element](https://drafts.csswg.org/css-display-3/#layout-specific-display). Therefore I haven't done anything about this explicitly, but maybe I'm missing some nuance.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19803)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r-- | components/script/dom/element.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index 4c7d4be40d8..c6224e7dc87 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -348,11 +348,12 @@ impl Element { } // https://drafts.csswg.org/cssom-view/#css-layout-box - // Elements that have a computed value of the display property - // that is table-column or table-column-group - // FIXME: Currently, it is assumed to be true always + // + // We'll have no content box if there's no fragment for the node, and we use + // bounding_content_box, for simplicity, to detect this (rather than making a more specific + // query to the layout thread). fn has_css_layout_box(&self) -> bool { - true + self.upcast::<Node>().bounding_content_box().is_some() } // https://drafts.csswg.org/cssom-view/#potentially-scrollable |