mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
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 -->
This commit is contained in:
commit
bccb757bcd
3 changed files with 36 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -308101,6 +308101,12 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"css/cssom-view/scroll-no-layout-box.html": [
|
||||
[
|
||||
"/css/cssom-view/scroll-no-layout-box.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/cssom-view/scrollIntoView-shadow.html": [
|
||||
[
|
||||
"/css/cssom-view/scrollIntoView-shadow.html",
|
||||
|
@ -516726,6 +516732,10 @@
|
|||
"966ebff69f91c0ea92f4bc2f943df9ef9dc3bcf9",
|
||||
"testharness"
|
||||
],
|
||||
"css/cssom-view/scroll-no-layout-box.html": [
|
||||
"8f423a757bd716c9c22e82fd2f35007d05982c08",
|
||||
"testharness"
|
||||
],
|
||||
"css/cssom-view/scrollIntoView-shadow.html": [
|
||||
"3c4a18992105fd7bf19cbf29f0b6d80cb12ca98c",
|
||||
"testharness"
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>cssom-view - Scrolling element with no layout box</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-scroll">
|
||||
<link rel="help" href="https://drafts.csswg.org/cssom-view/#css-layout-box">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div style="display: none">
|
||||
<div id="elem"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
test(() => {
|
||||
const elem = document.getElementById('elem');
|
||||
elem.scroll(1, 2);
|
||||
|
||||
assert_equals(elem.scrollTop, 0, "scrollTop should be unchanged");
|
||||
assert_equals(elem.scrollLeft, 0, "scrollLeft should be unchanged");
|
||||
}, "scrolling an element with no CSS layout box should have no effect");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue