mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Make layout methods accessing rare data be safe
They don't do anything fancy so there is no additional unsafety calling them compared to using LayoutDom in the first place, the usual story of all those changes.
This commit is contained in:
parent
414d477b54
commit
9c8540af5c
4 changed files with 36 additions and 41 deletions
|
@ -649,21 +649,17 @@ impl<'le> TElement for ServoLayoutElement<'le> {
|
|||
|
||||
/// The shadow root this element is a host of.
|
||||
fn shadow_root(&self) -> Option<ServoShadowRoot<'le>> {
|
||||
unsafe {
|
||||
self.element
|
||||
.get_shadow_root_for_layout()
|
||||
.map(ServoShadowRoot::from_layout_js)
|
||||
}
|
||||
self.element
|
||||
.get_shadow_root_for_layout()
|
||||
.map(ServoShadowRoot::from_layout_js)
|
||||
}
|
||||
|
||||
/// The shadow root which roots the subtree this element is contained in.
|
||||
fn containing_shadow(&self) -> Option<ServoShadowRoot<'le>> {
|
||||
unsafe {
|
||||
self.element
|
||||
.upcast()
|
||||
.containing_shadow_root_for_layout()
|
||||
.map(ServoShadowRoot::from_layout_js)
|
||||
}
|
||||
self.element
|
||||
.upcast()
|
||||
.containing_shadow_root_for_layout()
|
||||
.map(ServoShadowRoot::from_layout_js)
|
||||
}
|
||||
|
||||
fn local_name(&self) -> &LocalName {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue