mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Make LayoutShadowRootHelpers::get_style_data_for_layout return a &CascadeData
That return type is Sync, which thus means that the method can be safe.
This commit is contained in:
parent
ebd2892158
commit
295f120425
3 changed files with 8 additions and 5 deletions
|
@ -177,7 +177,7 @@ impl<'lr> TShadowRoot for ServoShadowRoot<'lr> {
|
||||||
where
|
where
|
||||||
Self: 'a,
|
Self: 'a,
|
||||||
{
|
{
|
||||||
Some(unsafe { &self.shadow_root.get_style_data_for_layout().data })
|
Some(&self.shadow_root.get_style_data_for_layout())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ impl<'lr> TShadowRoot for ServoShadowRoot<'lr> {
|
||||||
where
|
where
|
||||||
Self: 'a,
|
Self: 'a,
|
||||||
{
|
{
|
||||||
Some(unsafe { &self.shadow_root.get_style_data_for_layout().data })
|
Some(&self.shadow_root.get_style_data_for_layout())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ use style::dom::TElement;
|
||||||
use style::media_queries::Device;
|
use style::media_queries::Device;
|
||||||
use style::shared_lock::SharedRwLockReadGuard;
|
use style::shared_lock::SharedRwLockReadGuard;
|
||||||
use style::stylesheets::Stylesheet;
|
use style::stylesheets::Stylesheet;
|
||||||
|
use style::stylist::CascadeData;
|
||||||
|
|
||||||
/// Whether a shadow root hosts an User Agent widget.
|
/// Whether a shadow root hosts an User Agent widget.
|
||||||
#[derive(JSTraceable, MallocSizeOf, PartialEq)]
|
#[derive(JSTraceable, MallocSizeOf, PartialEq)]
|
||||||
|
@ -241,7 +242,7 @@ impl ShadowRootMethods for ShadowRoot {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub trait LayoutShadowRootHelpers<'dom> {
|
pub trait LayoutShadowRootHelpers<'dom> {
|
||||||
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>;
|
fn get_style_data_for_layout(self) -> &'dom CascadeData;
|
||||||
unsafe fn flush_stylesheets<E: TElement>(
|
unsafe fn flush_stylesheets<E: TElement>(
|
||||||
self,
|
self,
|
||||||
device: &Device,
|
device: &Device,
|
||||||
|
@ -264,8 +265,10 @@ impl<'dom> LayoutShadowRootHelpers<'dom> for LayoutDom<'dom, ShadowRoot> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn get_style_data_for_layout(self) -> &'dom AuthorStyles<StyleSheetInDocument> {
|
fn get_style_data_for_layout(self) -> &'dom CascadeData {
|
||||||
(*self.unsafe_get()).author_styles.borrow_for_layout()
|
fn is_sync<T: Sync>() {}
|
||||||
|
let _ = is_sync::<CascadeData>;
|
||||||
|
unsafe { &self.unsafe_get().author_styles.borrow_for_layout().data }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue