mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #10888 - heycam:computed-node, r=bholley
Make Servo_GetComputedValues take a node rather than an element. r? @bholley https://bugzilla.mozilla.org/show_bug.cgi?id=1268392 is the Gecko side <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10888) <!-- Reviewable:end -->
This commit is contained in:
commit
0b2c248042
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_InitStyleSet() -> *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;
|
||||
pub fn Servo_GetComputedValuesForAnonymousBox(parentStyleOrNull:
|
||||
*mut ServoComputedValues,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#![allow(unsafe_code)]
|
||||
|
||||
use app_units::Au;
|
||||
use bindings::{RawGeckoDocument, RawGeckoElement};
|
||||
use bindings::{RawGeckoDocument, RawGeckoNode};
|
||||
use bindings::{RawServoStyleSet, RawServoStyleSheet, ServoComputedValues, ServoNodeData};
|
||||
use bindings::{nsIAtom};
|
||||
use data::PerDocumentStyleData;
|
||||
|
@ -173,9 +173,9 @@ pub extern "C" fn Servo_ReleaseStyleSheet(sheet: *mut RawServoStyleSheet) -> ()
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_GetComputedValues(element: *mut RawGeckoElement)
|
||||
pub extern "C" fn Servo_GetComputedValues(node: *mut RawGeckoNode)
|
||||
-> *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());
|
||||
arc_cv.map_or(ptr::null_mut(), |arc| unsafe { transmute(arc) })
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ pub struct 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 {
|
||||
node: n,
|
||||
chain: PhantomData,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue