mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add Servo_RestyleSubtree.
This commit is contained in:
parent
a04e30d247
commit
bbc89a2726
2 changed files with 22 additions and 7 deletions
|
@ -73,13 +73,9 @@ pub extern "C" fn Servo_Initialize() -> () {
|
|||
env_logger::init().unwrap();
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_RestyleDocument(doc: *mut RawGeckoDocument, raw_data: *mut RawServoStyleSet) -> () {
|
||||
let document = unsafe { GeckoDocument::from_raw(doc) };
|
||||
let node = match document.root_node() {
|
||||
Some(x) => x,
|
||||
None => return,
|
||||
};
|
||||
fn restyle_subtree(node: GeckoNode, raw_data: *mut RawServoStyleSet) {
|
||||
debug_assert!(node.is_element() || node.is_text_node());
|
||||
|
||||
let data = unsafe { &mut *(raw_data as *mut PerDocumentStyleData) };
|
||||
|
||||
// Force the creation of our lazily-constructed initial computed values on
|
||||
|
@ -112,6 +108,23 @@ pub extern "C" fn Servo_RestyleDocument(doc: *mut RawGeckoDocument, raw_data: *m
|
|||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_RestyleSubtree(node: *mut RawGeckoNode,
|
||||
raw_data: *mut RawServoStyleSet) -> () {
|
||||
let node = unsafe { GeckoNode::from_raw(node) };
|
||||
restyle_subtree(node, raw_data);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_RestyleDocument(doc: *mut RawGeckoDocument, raw_data: *mut RawServoStyleSet) -> () {
|
||||
let document = unsafe { GeckoDocument::from_raw(doc) };
|
||||
let node = match document.root_node() {
|
||||
Some(x) => x,
|
||||
None => return,
|
||||
};
|
||||
restyle_subtree(node, raw_data);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_DropNodeData(data: *mut ServoNodeData) -> () {
|
||||
unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue