mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement Element::has_css_layout_box()
Calling scroll() on an element which is not rendered (by a parent with display: none) would previously cause a crash. In fact, we should terminate the algorithm [https://drafts.csswg.org/cssom-view/#dom-element-scroll] at step 10 in this situation. The fix hinges on implementing Element::has_css_layout_box() correctly, rather than just returning true in all cases as we did previously. Fixes #19430.
This commit is contained in:
parent
9f2b33c646
commit
902edb925e
3 changed files with 36 additions and 4 deletions
|
@ -349,11 +349,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue