mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Make Servo_GetComputedValues take a node rather than an element.
This commit is contained in:
parent
fbc575407d
commit
b488e1d1d4
3 changed files with 5 additions and 5 deletions
|
@ -81,7 +81,7 @@ extern "C" {
|
||||||
pub fn Servo_StyleSheetHasRules(sheet: *mut RawServoStyleSheet) -> bool;
|
pub fn Servo_StyleSheetHasRules(sheet: *mut RawServoStyleSheet) -> bool;
|
||||||
pub fn Servo_InitStyleSet() -> *mut RawServoStyleSet;
|
pub fn Servo_InitStyleSet() -> *mut RawServoStyleSet;
|
||||||
pub fn Servo_DropStyleSet(set: *mut RawServoStyleSet);
|
pub fn Servo_DropStyleSet(set: *mut RawServoStyleSet);
|
||||||
pub fn Servo_GetComputedValues(element: *mut RawGeckoElement)
|
pub fn Servo_GetComputedValues(node: *mut RawGeckoNode)
|
||||||
-> *mut ServoComputedValues;
|
-> *mut ServoComputedValues;
|
||||||
pub fn Servo_GetComputedValuesForAnonymousBox(parentStyleOrNull:
|
pub fn Servo_GetComputedValuesForAnonymousBox(parentStyleOrNull:
|
||||||
*mut ServoComputedValues,
|
*mut ServoComputedValues,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#![allow(unsafe_code)]
|
#![allow(unsafe_code)]
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use bindings::{RawGeckoDocument, RawGeckoElement};
|
use bindings::{RawGeckoDocument, RawGeckoNode};
|
||||||
use bindings::{RawServoStyleSet, RawServoStyleSheet, ServoComputedValues, ServoNodeData};
|
use bindings::{RawServoStyleSet, RawServoStyleSheet, ServoComputedValues, ServoNodeData};
|
||||||
use bindings::{nsIAtom};
|
use bindings::{nsIAtom};
|
||||||
use data::PerDocumentStyleData;
|
use data::PerDocumentStyleData;
|
||||||
|
@ -173,9 +173,9 @@ pub extern "C" fn Servo_ReleaseStyleSheet(sheet: *mut RawServoStyleSheet) -> ()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_GetComputedValues(element: *mut RawGeckoElement)
|
pub extern "C" fn Servo_GetComputedValues(node: *mut RawGeckoNode)
|
||||||
-> *mut ServoComputedValues {
|
-> *mut ServoComputedValues {
|
||||||
let node = unsafe { GeckoElement::from_raw(element).as_node() };
|
let node = unsafe { GeckoNode::from_raw(node) };
|
||||||
let arc_cv = node.borrow_data().map(|data| data.style.clone());
|
let arc_cv = node.borrow_data().map(|data| data.style.clone());
|
||||||
arc_cv.map_or(ptr::null_mut(), |arc| unsafe { transmute(arc) })
|
arc_cv.map_or(ptr::null_mut(), |arc| unsafe { transmute(arc) })
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ pub struct GeckoNode<'ln> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ln> GeckoNode<'ln> {
|
impl<'ln> GeckoNode<'ln> {
|
||||||
unsafe fn from_raw(n: *mut RawGeckoNode) -> GeckoNode<'ln> {
|
pub unsafe fn from_raw(n: *mut RawGeckoNode) -> GeckoNode<'ln> {
|
||||||
GeckoNode {
|
GeckoNode {
|
||||||
node: n,
|
node: n,
|
||||||
chain: PhantomData,
|
chain: PhantomData,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue