First bits of shadow dom layout

This commit is contained in:
Fernando Jiménez Moreno 2019-01-31 16:10:26 +01:00
parent be06f1e9b3
commit 7c9e8aa4cc
5 changed files with 118 additions and 30 deletions

View file

@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::{self, ShadowRoo
use crate::dom::bindings::inheritance::Castable;
use crate::dom::bindings::num::Finite;
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom};
use crate::dom::cssstylesheet::CSSStyleSheet;
use crate::dom::document::Document;
use crate::dom::documentfragment::DocumentFragment;
@ -121,3 +121,16 @@ impl ShadowRootMethods for ShadowRoot {
})
}
}
#[allow(unsafe_code)]
pub trait LayoutShadowRootHelpers {
unsafe fn get_host_for_layout(&self) -> LayoutDom<Element>;
}
impl LayoutShadowRootHelpers for LayoutDom<ShadowRoot> {
#[inline]
#[allow(unsafe_code)]
unsafe fn get_host_for_layout(&self) -> LayoutDom<Element> {
(*self.unsafe_get()).host.to_layout()
}
}