mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Make LayoutShadowRootHelpers::get_host_for_layout be safe
This commit is contained in:
parent
68d5cfffd5
commit
f712b0bcf8
3 changed files with 10 additions and 8 deletions
|
@ -240,7 +240,7 @@ impl ShadowRootMethods for ShadowRoot {
|
|||
|
||||
#[allow(unsafe_code)]
|
||||
pub trait LayoutShadowRootHelpers<'dom> {
|
||||
unsafe fn get_host_for_layout(self) -> LayoutDom<'dom, Element>;
|
||||
fn get_host_for_layout(self) -> LayoutDom<'dom, Element>;
|
||||
unsafe fn get_style_data_for_layout(self) -> &'dom AuthorStyles<StyleSheetInDocument>;
|
||||
unsafe fn flush_stylesheets<E: TElement>(
|
||||
self,
|
||||
|
@ -253,11 +253,13 @@ pub trait LayoutShadowRootHelpers<'dom> {
|
|||
impl<'dom> LayoutShadowRootHelpers<'dom> for LayoutDom<'dom, ShadowRoot> {
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn get_host_for_layout(self) -> LayoutDom<'dom, Element> {
|
||||
(*self.unsafe_get())
|
||||
.host
|
||||
.get_inner_as_layout()
|
||||
.expect("We should never do layout on a detached shadow root")
|
||||
fn get_host_for_layout(self) -> LayoutDom<'dom, Element> {
|
||||
unsafe {
|
||||
self.unsafe_get()
|
||||
.host
|
||||
.get_inner_as_layout()
|
||||
.expect("We should never do layout on a detached shadow root")
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue