mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Give a lifetime parameter to LayoutDom
This commit is contained in:
parent
60ca98b753
commit
dba6a635e5
26 changed files with 145 additions and 235 deletions
|
@ -241,7 +241,7 @@ pub trait AttrHelpersForLayout {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
impl AttrHelpersForLayout for LayoutDom<Attr> {
|
||||
impl AttrHelpersForLayout for LayoutDom<'_, Attr> {
|
||||
#[inline]
|
||||
unsafe fn value_forever(&self) -> &'static AttrValue {
|
||||
// This transmute is used to cheat the lifetime restriction.
|
||||
|
|
|
@ -331,6 +331,7 @@ impl<T> Dom<T> {
|
|||
debug_assert!(thread_state::get().is_layout());
|
||||
LayoutDom {
|
||||
ptr: self.ptr.clone(),
|
||||
marker: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -413,13 +414,17 @@ where
|
|||
/// An unrooted reference to a DOM object for use in layout. `Layout*Helpers`
|
||||
/// traits must be implemented on this.
|
||||
#[unrooted_must_root_lint::allow_unrooted_interior]
|
||||
pub struct LayoutDom<T> {
|
||||
pub struct LayoutDom<'dom, T> {
|
||||
ptr: ptr::NonNull<T>,
|
||||
marker: PhantomData<&'dom T>,
|
||||
}
|
||||
|
||||
impl<T: Castable> LayoutDom<T> {
|
||||
impl<'dom, T> LayoutDom<'dom, T>
|
||||
where
|
||||
T: Castable,
|
||||
{
|
||||
/// Cast a DOM object root upwards to one of the interfaces it derives from.
|
||||
pub fn upcast<U>(&self) -> LayoutDom<U>
|
||||
pub fn upcast<U>(&self) -> LayoutDom<'dom, U>
|
||||
where
|
||||
U: Castable,
|
||||
T: DerivedFrom<U>,
|
||||
|
@ -428,11 +433,12 @@ impl<T: Castable> LayoutDom<T> {
|
|||
let ptr: *mut T = self.ptr.as_ptr();
|
||||
LayoutDom {
|
||||
ptr: unsafe { ptr::NonNull::new_unchecked(ptr as *mut U) },
|
||||
marker: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
/// Cast a DOM object downwards to one of the interfaces it might implement.
|
||||
pub fn downcast<U>(&self) -> Option<LayoutDom<U>>
|
||||
pub fn downcast<U>(&self) -> Option<LayoutDom<'dom, U>>
|
||||
where
|
||||
U: DerivedFrom<T>,
|
||||
{
|
||||
|
@ -442,6 +448,7 @@ impl<T: Castable> LayoutDom<T> {
|
|||
let ptr: *mut T = self.ptr.as_ptr();
|
||||
Some(LayoutDom {
|
||||
ptr: ptr::NonNull::new_unchecked(ptr as *mut U),
|
||||
marker: PhantomData,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
@ -450,7 +457,10 @@ impl<T: Castable> LayoutDom<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: DomObject> LayoutDom<T> {
|
||||
impl<T> LayoutDom<'_, T>
|
||||
where
|
||||
T: DomObject,
|
||||
{
|
||||
/// Get the reflector.
|
||||
pub unsafe fn get_jsobject(&self) -> *mut JSObject {
|
||||
debug_assert!(thread_state::get().is_layout());
|
||||
|
@ -458,7 +468,7 @@ impl<T: DomObject> LayoutDom<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Copy for LayoutDom<T> {}
|
||||
impl<T> Copy for LayoutDom<'_, T> {}
|
||||
|
||||
impl<T> PartialEq for Dom<T> {
|
||||
fn eq(&self, other: &Dom<T>) -> bool {
|
||||
|
@ -474,13 +484,13 @@ impl<'a, T: DomObject> PartialEq<&'a T> for Dom<T> {
|
|||
|
||||
impl<T> Eq for Dom<T> {}
|
||||
|
||||
impl<T> PartialEq for LayoutDom<T> {
|
||||
fn eq(&self, other: &LayoutDom<T>) -> bool {
|
||||
impl<T> PartialEq for LayoutDom<'_, T> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.ptr.as_ptr() == other.ptr.as_ptr()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Eq for LayoutDom<T> {}
|
||||
impl<T> Eq for LayoutDom<'_, T> {}
|
||||
|
||||
impl<T> Hash for Dom<T> {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
|
@ -488,7 +498,7 @@ impl<T> Hash for Dom<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Hash for LayoutDom<T> {
|
||||
impl<T> Hash for LayoutDom<'_, T> {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.ptr.as_ptr().hash(state)
|
||||
}
|
||||
|
@ -497,7 +507,7 @@ impl<T> Hash for LayoutDom<T> {
|
|||
impl<T> Clone for Dom<T> {
|
||||
#[inline]
|
||||
#[allow(unrooted_must_root)]
|
||||
fn clone(&self) -> Dom<T> {
|
||||
fn clone(&self) -> Self {
|
||||
debug_assert!(thread_state::get().is_script());
|
||||
Dom {
|
||||
ptr: self.ptr.clone(),
|
||||
|
@ -505,24 +515,26 @@ impl<T> Clone for Dom<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> Clone for LayoutDom<T> {
|
||||
impl<T> Clone for LayoutDom<'_, T> {
|
||||
#[inline]
|
||||
fn clone(&self) -> LayoutDom<T> {
|
||||
fn clone(&self) -> Self {
|
||||
debug_assert!(thread_state::get().is_layout());
|
||||
LayoutDom {
|
||||
ptr: self.ptr.clone(),
|
||||
marker: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl LayoutDom<Node> {
|
||||
impl LayoutDom<'_, Node> {
|
||||
/// Create a new JS-owned value wrapped from an address known to be a
|
||||
/// `Node` pointer.
|
||||
pub unsafe fn from_trusted_node_address(inner: TrustedNodeAddress) -> LayoutDom<Node> {
|
||||
pub unsafe fn from_trusted_node_address(inner: TrustedNodeAddress) -> Self {
|
||||
debug_assert!(thread_state::get().is_layout());
|
||||
let TrustedNodeAddress(addr) = inner;
|
||||
LayoutDom {
|
||||
ptr: ptr::NonNull::new_unchecked(addr as *const Node as *mut Node),
|
||||
marker: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -624,7 +636,7 @@ impl<T: DomObject> MutNullableDom<T> {
|
|||
#[allow(unrooted_must_root)]
|
||||
pub unsafe fn get_inner_as_layout(&self) -> Option<LayoutDom<T>> {
|
||||
debug_assert!(thread_state::get().is_layout());
|
||||
ptr::read(self.ptr.get()).map(|js| js.to_layout())
|
||||
(*self.ptr.get()).as_ref().map(|js| js.to_layout())
|
||||
}
|
||||
|
||||
/// Get a rooted value out of this object
|
||||
|
@ -732,7 +744,10 @@ unsafe impl<T: DomObject> JSTraceable for DomOnceCell<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: DomObject> LayoutDom<T> {
|
||||
impl<'dom, T> LayoutDom<'dom, T>
|
||||
where
|
||||
T: 'dom + DomObject,
|
||||
{
|
||||
/// Returns an unsafe pointer to the interior of this JS object. This is
|
||||
/// the only method that be safely accessed from layout. (The fact that
|
||||
/// this is unsafe is what necessitates the layout wrappers.)
|
||||
|
|
|
@ -157,7 +157,7 @@ pub trait LayoutCanvasRenderingContext2DHelpers {
|
|||
unsafe fn get_canvas_id(&self) -> CanvasId;
|
||||
}
|
||||
|
||||
impl LayoutCanvasRenderingContext2DHelpers for LayoutDom<CanvasRenderingContext2D> {
|
||||
impl LayoutCanvasRenderingContext2DHelpers for LayoutDom<'_, CanvasRenderingContext2D> {
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn get_ipc_renderer(&self) -> IpcSender<CanvasMsg> {
|
||||
(*self.unsafe_get())
|
||||
|
|
|
@ -286,7 +286,7 @@ pub trait LayoutCharacterDataHelpers {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
impl LayoutCharacterDataHelpers for LayoutDom<CharacterData> {
|
||||
impl LayoutCharacterDataHelpers for LayoutDom<'_, CharacterData> {
|
||||
#[inline]
|
||||
unsafe fn data_for_layout(&self) -> &str {
|
||||
&(*self.unsafe_get()).data.borrow_for_layout()
|
||||
|
|
|
@ -2617,7 +2617,7 @@ pub trait LayoutDocumentHelpers {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
impl LayoutDocumentHelpers for LayoutDom<Document> {
|
||||
impl LayoutDocumentHelpers for LayoutDom<'_, Document> {
|
||||
#[inline]
|
||||
unsafe fn is_html_document_for_layout(&self) -> bool {
|
||||
(*self.unsafe_get()).is_html_document
|
||||
|
|
|
@ -567,11 +567,11 @@ pub trait RawLayoutElementHelpers {
|
|||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
pub unsafe fn get_attr_for_layout<'a>(
|
||||
elem: &'a Element,
|
||||
pub unsafe fn get_attr_for_layout<'dom>(
|
||||
elem: &'dom Element,
|
||||
namespace: &Namespace,
|
||||
name: &LocalName,
|
||||
) -> Option<LayoutDom<Attr>> {
|
||||
) -> Option<LayoutDom<'dom, Attr>> {
|
||||
// cast to point to T in RefCell<T> directly
|
||||
let attrs = elem.attrs.borrow_for_layout();
|
||||
attrs
|
||||
|
@ -620,7 +620,7 @@ impl RawLayoutElementHelpers for Element {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait LayoutElementHelpers {
|
||||
pub trait LayoutElementHelpers<'dom> {
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn has_class_for_layout(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool;
|
||||
#[allow(unsafe_code)]
|
||||
|
@ -646,10 +646,10 @@ pub trait LayoutElementHelpers {
|
|||
fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool;
|
||||
/// The shadow root this element is a host of.
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn get_shadow_root_for_layout(&self) -> Option<LayoutDom<ShadowRoot>>;
|
||||
unsafe fn get_shadow_root_for_layout(&self) -> Option<LayoutDom<'dom, ShadowRoot>>;
|
||||
}
|
||||
|
||||
impl LayoutElementHelpers for LayoutDom<Element> {
|
||||
impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
||||
#[allow(unsafe_code)]
|
||||
#[inline]
|
||||
unsafe fn has_class_for_layout(&self, name: &Atom, case_sensitivity: CaseSensitivity) -> bool {
|
||||
|
@ -1095,7 +1095,7 @@ impl LayoutElementHelpers for LayoutDom<Element> {
|
|||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn get_shadow_root_for_layout(&self) -> Option<LayoutDom<ShadowRoot>> {
|
||||
unsafe fn get_shadow_root_for_layout(&self) -> Option<LayoutDom<'dom, ShadowRoot>> {
|
||||
(*self.unsafe_get())
|
||||
.rare_data_for_layout()
|
||||
.as_ref()?
|
||||
|
|
|
@ -99,7 +99,7 @@ pub trait HTMLBodyElementLayoutHelpers {
|
|||
fn get_background(&self) -> Option<ServoUrl>;
|
||||
}
|
||||
|
||||
impl HTMLBodyElementLayoutHelpers for LayoutDom<HTMLBodyElement> {
|
||||
impl HTMLBodyElementLayoutHelpers for LayoutDom<'_, HTMLBodyElement> {
|
||||
#[allow(unsafe_code)]
|
||||
fn get_background_color(&self) -> Option<RGBA> {
|
||||
unsafe {
|
||||
|
|
|
@ -120,7 +120,7 @@ pub trait LayoutHTMLCanvasElementHelpers {
|
|||
fn get_canvas_id_for_layout(&self) -> CanvasId;
|
||||
}
|
||||
|
||||
impl LayoutHTMLCanvasElementHelpers for LayoutDom<HTMLCanvasElement> {
|
||||
impl LayoutHTMLCanvasElementHelpers for LayoutDom<'_, HTMLCanvasElement> {
|
||||
#[allow(unsafe_code)]
|
||||
fn data(&self) -> HTMLCanvasData {
|
||||
unsafe {
|
||||
|
|
|
@ -106,7 +106,7 @@ pub trait HTMLFontElementLayoutHelpers {
|
|||
fn get_size(&self) -> Option<u32>;
|
||||
}
|
||||
|
||||
impl HTMLFontElementLayoutHelpers for LayoutDom<HTMLFontElement> {
|
||||
impl HTMLFontElementLayoutHelpers for LayoutDom<'_, HTMLFontElement> {
|
||||
#[allow(unsafe_code)]
|
||||
fn get_color(&self) -> Option<RGBA> {
|
||||
unsafe {
|
||||
|
|
|
@ -70,7 +70,7 @@ pub trait HTMLHRLayoutHelpers {
|
|||
fn get_width(&self) -> LengthOrPercentageOrAuto;
|
||||
}
|
||||
|
||||
impl HTMLHRLayoutHelpers for LayoutDom<HTMLHRElement> {
|
||||
impl HTMLHRLayoutHelpers for LayoutDom<'_, HTMLHRElement> {
|
||||
#[allow(unsafe_code)]
|
||||
fn get_color(&self) -> Option<RGBA> {
|
||||
unsafe {
|
||||
|
|
|
@ -486,7 +486,7 @@ pub trait HTMLIFrameElementLayoutMethods {
|
|||
fn get_height(&self) -> LengthOrPercentageOrAuto;
|
||||
}
|
||||
|
||||
impl HTMLIFrameElementLayoutMethods for LayoutDom<HTMLIFrameElement> {
|
||||
impl HTMLIFrameElementLayoutMethods for LayoutDom<'_, HTMLIFrameElement> {
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
fn pipeline_id(&self) -> Option<PipelineId> {
|
||||
|
|
|
@ -1382,7 +1382,7 @@ pub trait LayoutHTMLImageElementHelpers {
|
|||
fn get_height(&self) -> LengthOrPercentageOrAuto;
|
||||
}
|
||||
|
||||
impl LayoutHTMLImageElementHelpers for LayoutDom<HTMLImageElement> {
|
||||
impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement> {
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn image(&self) -> Option<Arc<Image>> {
|
||||
(*self.unsafe_get())
|
||||
|
|
|
@ -726,11 +726,14 @@ unsafe fn get_raw_textinput_value(input: LayoutDom<HTMLInputElement>) -> DOMStri
|
|||
.get_content()
|
||||
}
|
||||
|
||||
impl LayoutHTMLInputElementHelpers for LayoutDom<HTMLInputElement> {
|
||||
impl LayoutHTMLInputElementHelpers for LayoutDom<'_, HTMLInputElement> {
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn value_for_layout(self) -> String {
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn get_raw_attr_value(input: LayoutDom<HTMLInputElement>, default: &str) -> String {
|
||||
unsafe fn get_raw_attr_value(
|
||||
input: LayoutDom<'_, HTMLInputElement>,
|
||||
default: &str,
|
||||
) -> String {
|
||||
let elem = input.upcast::<Element>();
|
||||
let value = (*elem.unsafe_get())
|
||||
.get_attr_val_for_layout(&ns!(), &local_name!("value"))
|
||||
|
|
|
@ -2447,7 +2447,7 @@ pub trait LayoutHTMLMediaElementHelpers {
|
|||
fn data(&self) -> HTMLMediaData;
|
||||
}
|
||||
|
||||
impl LayoutHTMLMediaElementHelpers for LayoutDom<HTMLMediaElement> {
|
||||
impl LayoutHTMLMediaElementHelpers for LayoutDom<'_, HTMLMediaElement> {
|
||||
#[allow(unsafe_code)]
|
||||
fn data(&self) -> HTMLMediaData {
|
||||
let media = unsafe { &*self.unsafe_get() };
|
||||
|
|
|
@ -105,7 +105,7 @@ pub trait HTMLTableCellElementLayoutHelpers {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
impl HTMLTableCellElementLayoutHelpers for LayoutDom<HTMLTableCellElement> {
|
||||
impl HTMLTableCellElementLayoutHelpers for LayoutDom<'_, HTMLTableCellElement> {
|
||||
fn get_background_color(&self) -> Option<RGBA> {
|
||||
unsafe {
|
||||
(&*self.upcast::<Element>().unsafe_get())
|
||||
|
|
|
@ -412,7 +412,7 @@ pub trait HTMLTableElementLayoutHelpers {
|
|||
fn get_width(&self) -> LengthOrPercentageOrAuto;
|
||||
}
|
||||
|
||||
impl HTMLTableElementLayoutHelpers for LayoutDom<HTMLTableElement> {
|
||||
impl HTMLTableElementLayoutHelpers for LayoutDom<'_, HTMLTableElement> {
|
||||
#[allow(unsafe_code)]
|
||||
fn get_background_color(&self) -> Option<RGBA> {
|
||||
unsafe {
|
||||
|
|
|
@ -150,7 +150,7 @@ pub trait HTMLTableRowElementLayoutHelpers {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
impl HTMLTableRowElementLayoutHelpers for LayoutDom<HTMLTableRowElement> {
|
||||
impl HTMLTableRowElementLayoutHelpers for LayoutDom<'_, HTMLTableRowElement> {
|
||||
fn get_background_color(&self) -> Option<RGBA> {
|
||||
unsafe {
|
||||
(&*self.upcast::<Element>().unsafe_get())
|
||||
|
|
|
@ -88,7 +88,7 @@ pub trait HTMLTableSectionElementLayoutHelpers {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
impl HTMLTableSectionElementLayoutHelpers for LayoutDom<HTMLTableSectionElement> {
|
||||
impl HTMLTableSectionElementLayoutHelpers for LayoutDom<'_, HTMLTableSectionElement> {
|
||||
fn get_background_color(&self) -> Option<RGBA> {
|
||||
unsafe {
|
||||
(&*self.upcast::<Element>().unsafe_get())
|
||||
|
|
|
@ -66,7 +66,7 @@ pub trait LayoutHTMLTextAreaElementHelpers {
|
|||
fn get_rows(self) -> u32;
|
||||
}
|
||||
|
||||
impl LayoutHTMLTextAreaElementHelpers for LayoutDom<HTMLTextAreaElement> {
|
||||
impl LayoutHTMLTextAreaElementHelpers for LayoutDom<'_, HTMLTextAreaElement> {
|
||||
#[allow(unrooted_must_root)]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn value_for_layout(self) -> String {
|
||||
|
|
|
@ -1304,17 +1304,17 @@ pub unsafe fn from_untrusted_node_address(
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub trait LayoutNodeHelpers {
|
||||
pub trait LayoutNodeHelpers<'dom> {
|
||||
unsafe fn type_id_for_layout(&self) -> NodeTypeId;
|
||||
|
||||
unsafe fn composed_parent_node_ref(&self) -> Option<LayoutDom<Node>>;
|
||||
unsafe fn first_child_ref(&self) -> Option<LayoutDom<Node>>;
|
||||
unsafe fn last_child_ref(&self) -> Option<LayoutDom<Node>>;
|
||||
unsafe fn prev_sibling_ref(&self) -> Option<LayoutDom<Node>>;
|
||||
unsafe fn next_sibling_ref(&self) -> Option<LayoutDom<Node>>;
|
||||
unsafe fn composed_parent_node_ref(&self) -> Option<LayoutDom<'dom, Node>>;
|
||||
unsafe fn first_child_ref(&self) -> Option<LayoutDom<'dom, Node>>;
|
||||
unsafe fn last_child_ref(&self) -> Option<LayoutDom<'dom, Node>>;
|
||||
unsafe fn prev_sibling_ref(&self) -> Option<LayoutDom<'dom, Node>>;
|
||||
unsafe fn next_sibling_ref(&self) -> Option<LayoutDom<'dom, Node>>;
|
||||
|
||||
unsafe fn owner_doc_for_layout(&self) -> LayoutDom<Document>;
|
||||
unsafe fn containing_shadow_root_for_layout(&self) -> Option<LayoutDom<ShadowRoot>>;
|
||||
unsafe fn owner_doc_for_layout(&self) -> LayoutDom<'dom, Document>;
|
||||
unsafe fn containing_shadow_root_for_layout(&self) -> Option<LayoutDom<'dom, ShadowRoot>>;
|
||||
|
||||
unsafe fn is_element_for_layout(&self) -> bool;
|
||||
unsafe fn get_flag(&self, flag: NodeFlags) -> bool;
|
||||
|
@ -1339,7 +1339,7 @@ pub trait LayoutNodeHelpers {
|
|||
fn opaque(&self) -> OpaqueNode;
|
||||
}
|
||||
|
||||
impl LayoutNodeHelpers for LayoutDom<Node> {
|
||||
impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node> {
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn type_id_for_layout(&self) -> NodeTypeId {
|
||||
|
@ -1354,7 +1354,7 @@ impl LayoutNodeHelpers for LayoutDom<Node> {
|
|||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn composed_parent_node_ref(&self) -> Option<LayoutDom<Node>> {
|
||||
unsafe fn composed_parent_node_ref(&self) -> Option<LayoutDom<'dom, Node>> {
|
||||
let parent = (*self.unsafe_get()).parent_node.get_inner_as_layout();
|
||||
if let Some(ref parent) = parent {
|
||||
if let Some(shadow_root) = parent.downcast::<ShadowRoot>() {
|
||||
|
@ -1366,31 +1366,31 @@ impl LayoutNodeHelpers for LayoutDom<Node> {
|
|||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn first_child_ref(&self) -> Option<LayoutDom<Node>> {
|
||||
unsafe fn first_child_ref(&self) -> Option<LayoutDom<'dom, Node>> {
|
||||
(*self.unsafe_get()).first_child.get_inner_as_layout()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn last_child_ref(&self) -> Option<LayoutDom<Node>> {
|
||||
unsafe fn last_child_ref(&self) -> Option<LayoutDom<'dom, Node>> {
|
||||
(*self.unsafe_get()).last_child.get_inner_as_layout()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn prev_sibling_ref(&self) -> Option<LayoutDom<Node>> {
|
||||
unsafe fn prev_sibling_ref(&self) -> Option<LayoutDom<'dom, Node>> {
|
||||
(*self.unsafe_get()).prev_sibling.get_inner_as_layout()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn next_sibling_ref(&self) -> Option<LayoutDom<Node>> {
|
||||
unsafe fn next_sibling_ref(&self) -> Option<LayoutDom<'dom, Node>> {
|
||||
(*self.unsafe_get()).next_sibling.get_inner_as_layout()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn owner_doc_for_layout(&self) -> LayoutDom<Document> {
|
||||
unsafe fn owner_doc_for_layout(&self) -> LayoutDom<'dom, Document> {
|
||||
(*self.unsafe_get())
|
||||
.owner_doc
|
||||
.get_inner_as_layout()
|
||||
|
@ -1399,7 +1399,7 @@ impl LayoutNodeHelpers for LayoutDom<Node> {
|
|||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn containing_shadow_root_for_layout(&self) -> Option<LayoutDom<ShadowRoot>> {
|
||||
unsafe fn containing_shadow_root_for_layout(&self) -> Option<LayoutDom<'dom, ShadowRoot>> {
|
||||
(*self.unsafe_get())
|
||||
.rare_data_for_layout()
|
||||
.as_ref()?
|
||||
|
|
|
@ -239,8 +239,8 @@ impl ShadowRootMethods for ShadowRoot {
|
|||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub trait LayoutShadowRootHelpers {
|
||||
unsafe fn get_host_for_layout(&self) -> LayoutDom<Element>;
|
||||
pub trait LayoutShadowRootHelpers<'dom> {
|
||||
unsafe fn get_host_for_layout(&self) -> LayoutDom<'dom, Element>;
|
||||
unsafe fn get_style_data_for_layout<'a, E: TElement>(
|
||||
&self,
|
||||
) -> &'a AuthorStyles<StyleSheetInDocument>;
|
||||
|
@ -252,10 +252,10 @@ pub trait LayoutShadowRootHelpers {
|
|||
);
|
||||
}
|
||||
|
||||
impl LayoutShadowRootHelpers for LayoutDom<ShadowRoot> {
|
||||
impl<'dom> LayoutShadowRootHelpers<'dom> for LayoutDom<'dom, ShadowRoot> {
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn get_host_for_layout(&self) -> LayoutDom<Element> {
|
||||
unsafe fn get_host_for_layout(&self) -> LayoutDom<'dom, Element> {
|
||||
(*self.unsafe_get())
|
||||
.host
|
||||
.get_inner_as_layout()
|
||||
|
|
|
@ -52,7 +52,7 @@ pub trait LayoutSVGSVGElementHelpers {
|
|||
fn data(&self) -> SVGSVGData;
|
||||
}
|
||||
|
||||
impl LayoutSVGSVGElementHelpers for LayoutDom<SVGSVGElement> {
|
||||
impl LayoutSVGSVGElementHelpers for LayoutDom<'_, SVGSVGElement> {
|
||||
#[allow(unsafe_code, non_snake_case)]
|
||||
fn data(&self) -> SVGSVGData {
|
||||
unsafe {
|
||||
|
|
|
@ -3884,7 +3884,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
|
|||
}
|
||||
}
|
||||
|
||||
impl LayoutCanvasWebGLRenderingContextHelpers for LayoutDom<WebGL2RenderingContext> {
|
||||
impl LayoutCanvasWebGLRenderingContextHelpers for LayoutDom<'_, WebGL2RenderingContext> {
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn canvas_data_source(&self) -> HTMLCanvasDataSource {
|
||||
let this = &*self.unsafe_get();
|
||||
|
|
|
@ -4450,7 +4450,7 @@ pub trait LayoutCanvasWebGLRenderingContextHelpers {
|
|||
unsafe fn canvas_data_source(&self) -> HTMLCanvasDataSource;
|
||||
}
|
||||
|
||||
impl LayoutCanvasWebGLRenderingContextHelpers for LayoutDom<WebGLRenderingContext> {
|
||||
impl LayoutCanvasWebGLRenderingContextHelpers for LayoutDom<'_, WebGLRenderingContext> {
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn canvas_data_source(&self) -> HTMLCanvasDataSource {
|
||||
(*self.unsafe_get()).layout_handle()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue