зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #11404 - Add Servo_RestyleSubtree (from heycam:restyle-subtree); r=bholley
Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy --faster` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). Either: - [ ] There are tests for these changes OR - [X] These changes do not require tests because geckolib-only Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. ---- See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1275452 r? @bholley Source-Repo: https://github.com/servo/servo Source-Revision: 0293a3df16384b84ecbfee2838ffd87ca6ed4a01
This commit is contained in:
Родитель
ae4b8643d0
Коммит
ef3928087b
|
@ -223,6 +223,8 @@ extern "C" {
|
|||
pub fn Servo_Initialize();
|
||||
pub fn Servo_RestyleDocument(doc: *mut RawGeckoDocument,
|
||||
set: *mut RawServoStyleSet);
|
||||
pub fn Servo_RestyleSubtree(node: *mut RawGeckoNode,
|
||||
set: *mut RawServoStyleSet);
|
||||
pub fn Gecko_GetAttrAsUTF8(element: *mut RawGeckoElement,
|
||||
ns: *mut nsIAtom, name: *mut nsIAtom,
|
||||
length: *mut u32)
|
||||
|
|
|
@ -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 {
|
||||
|
|
Загрузка…
Ссылка в новой задаче