mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #9284 - bholley:bootstrap_stylo, r=SimonSapin
Add Partial Implementation of style DOM traits for Gecko, and some basic glue to let Gecko call into Servo The wrapper stuff is partially-complete, modulo some unimplemented methods. The glue code is just a toy for now. Regardless, I think it's worth getting some of this stuff in-tree to minimize breakage. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9284) <!-- Reviewable:end -->
This commit is contained in:
commit
77d3fbcca3
11 changed files with 700 additions and 21 deletions
|
@ -275,14 +275,6 @@ impl<'ln> TNode<'ln> for ServoLayoutNode<'ln> {
|
|||
self.node.next_sibling_ref().map(|node| self.new_with_this_lifetime(&node))
|
||||
}
|
||||
}
|
||||
|
||||
fn style(&self) -> Ref<Arc<ComputedValues>> {
|
||||
Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap())
|
||||
}
|
||||
|
||||
fn unstyle(self) {
|
||||
self.mutate_data().unwrap().style = None;
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ln> LayoutNode<'ln> for ServoLayoutNode<'ln> {
|
||||
|
@ -300,7 +292,7 @@ impl<'ln> LayoutNode<'ln> for ServoLayoutNode<'ln> {
|
|||
|
||||
unsafe fn borrow_layout_data_unchecked(&self) -> Option<*const PrivateLayoutData> {
|
||||
self.get_jsmanaged().get_style_and_layout_data().map(|opaque| {
|
||||
let container: NonOpaqueStyleAndLayoutData = transmute(opaque.ptr);
|
||||
let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
|
||||
&(*(*container).as_unsafe_cell().get()) as *const PrivateLayoutData
|
||||
})
|
||||
}
|
||||
|
@ -308,7 +300,7 @@ impl<'ln> LayoutNode<'ln> for ServoLayoutNode<'ln> {
|
|||
fn borrow_layout_data(&self) -> Option<Ref<PrivateLayoutData>> {
|
||||
unsafe {
|
||||
self.get_jsmanaged().get_style_and_layout_data().map(|opaque| {
|
||||
let container: NonOpaqueStyleAndLayoutData = transmute(opaque.ptr);
|
||||
let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
|
||||
(*container).borrow()
|
||||
})
|
||||
}
|
||||
|
@ -317,7 +309,7 @@ impl<'ln> LayoutNode<'ln> for ServoLayoutNode<'ln> {
|
|||
fn mutate_layout_data(&self) -> Option<RefMut<PrivateLayoutData>> {
|
||||
unsafe {
|
||||
self.get_jsmanaged().get_style_and_layout_data().map(|opaque| {
|
||||
let container: NonOpaqueStyleAndLayoutData = transmute(opaque.ptr);
|
||||
let container = *opaque.ptr as NonOpaqueStyleAndLayoutData;
|
||||
(*container).borrow_mut()
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue