diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/layout_dom/element.rs | 6 | ||||
-rw-r--r-- | components/script/layout_dom/node.rs | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs index 3e71e1eb773..55855930a31 100644 --- a/components/script/layout_dom/element.rs +++ b/components/script/layout_dom/element.rs @@ -69,6 +69,10 @@ impl<'dom> ServoLayoutElement<'dom> { ServoLayoutElement { element: el } } + pub(super) fn is_html_element(&self) -> bool { + self.element.is_html_element() + } + #[inline] fn get_attr_enum(&self, namespace: &Namespace, name: &LocalName) -> Option<&AttrValue> { self.element.get_attr_for_layout(namespace, name) @@ -139,7 +143,7 @@ impl<'dom> style::dom::TElement for ServoLayoutElement<'dom> { } fn is_html_element(&self) -> bool { - self.element.is_html_element() + ServoLayoutElement::is_html_element(self) } fn is_mathml_element(&self) -> bool { diff --git a/components/script/layout_dom/node.rs b/components/script/layout_dom/node.rs index fdbe615513c..f4e014a6a1b 100644 --- a/components/script/layout_dom/node.rs +++ b/components/script/layout_dom/node.rs @@ -313,6 +313,11 @@ impl<'dom> ThreadSafeLayoutNode<'dom> for ServoThreadSafeLayoutNode<'dom> { }) } + fn as_html_element(&self) -> Option<ServoThreadSafeLayoutElement<'dom>> { + self.as_element() + .filter(|element| element.element.is_html_element()) + } + fn style_data(&self) -> Option<&'dom StyleData> { self.node.style_data() } |