mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Avoid Window::GetComputedStyle
when checking for display: none
This commit is contained in:
parent
1d8e78720b
commit
8d09398230
5 changed files with 10 additions and 19 deletions
|
@ -350,14 +350,14 @@ impl Element {
|
|||
|
||||
/// style will be `None` for elements in a `display: none` subtree. otherwise, the element has a
|
||||
/// layout box iff it doesn't have `display: none`.
|
||||
fn style(&self) -> Option<Arc<ComputedValues>> {
|
||||
pub fn style(&self) -> Option<Arc<ComputedValues>> {
|
||||
window_from_node(self).style_query(
|
||||
self.upcast::<Node>().to_trusted_node_address()
|
||||
)
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom-view/#css-layout-box
|
||||
fn has_css_layout_box(&self) -> bool {
|
||||
pub fn has_css_layout_box(&self) -> bool {
|
||||
self.style()
|
||||
.map_or(false, |s| !s.get_box().clone_display().is_none())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue