Auto merge of #20386 - emilio:computed-style-rename, r=jwatt

style: Rename StyleContext to ComputedStyle.

Bug: 1447483
Reviewed-by: jwatt
MozReview-Commit-ID: KATZ6DkmpVY

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20386)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-03-22 13:48:24 -04:00 committed by GitHub
commit 563f0ec824
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 5503 additions and 6715 deletions

View file

@ -116,19 +116,19 @@ pub unsafe extern "C" fn Servo_RuleNode_Release(obj: &RawServoRuleNode) {
ptr::read(ptr as *const StrongRuleNode); ptr::read(ptr as *const StrongRuleNode);
} }
// ServoStyleContext is not an opaque type on any side of FFI. // ComputedStyle is not an opaque type on any side of FFI.
// This means that doing the HasArcFFI type trick is actually unsound, // This means that doing the HasArcFFI type trick is actually unsound,
// since it gives us a way to construct an Arc<ServoStyleContext> from // since it gives us a way to construct an Arc<ComputedStyle> from
// an &ServoStyleContext, which in general is not allowed. So we // an &ComputedStyle, which in general is not allowed. So we
// implement the restricted set of arc type functionality we need. // implement the restricted set of arc type functionality we need.
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn Servo_StyleContext_AddRef(obj: &ComputedValues) { pub unsafe extern "C" fn Servo_ComputedStyle_AddRef(obj: &ComputedValues) {
mem::forget(ArcBorrow::from_ref(obj).clone_arc()); mem::forget(ArcBorrow::from_ref(obj).clone_arc());
} }
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn Servo_StyleContext_Release(obj: &ComputedValues) { pub unsafe extern "C" fn Servo_ComputedStyle_Release(obj: &ComputedValues) {
ArcBorrow::from_ref(obj).with_arc(|a: &Arc<ComputedValues>| { ArcBorrow::from_ref(obj).with_arc(|a: &Arc<ComputedValues>| {
let _: Arc<ComputedValues> = ptr::read(a); let _: Arc<ComputedValues> = ptr::read(a);
}); });

View file

@ -980,8 +980,6 @@ cfg_if! {
pub static nsGkAtoms_graphicsSymbol: *mut nsStaticAtom; pub static nsGkAtoms_graphicsSymbol: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms4gridE"] #[link_name = "_ZN9nsGkAtoms4gridE"]
pub static nsGkAtoms_grid: *mut nsStaticAtom; pub static nsGkAtoms_grid: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms6grippyE"]
pub static nsGkAtoms_grippy: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms5groupE"] #[link_name = "_ZN9nsGkAtoms5groupE"]
pub static nsGkAtoms_group: *mut nsStaticAtom; pub static nsGkAtoms_group: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms8groupboxE"] #[link_name = "_ZN9nsGkAtoms8groupboxE"]
@ -3286,10 +3284,14 @@ cfg_if! {
pub static nsGkAtoms_saturate: *mut nsStaticAtom; pub static nsGkAtoms_saturate: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms10saturationE"] #[link_name = "_ZN9nsGkAtoms10saturationE"]
pub static nsGkAtoms_saturation: *mut nsStaticAtom; pub static nsGkAtoms_saturation: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms3setE"]
pub static nsGkAtoms_set: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms4seedE"] #[link_name = "_ZN9nsGkAtoms4seedE"]
pub static nsGkAtoms_seed: *mut nsStaticAtom; pub static nsGkAtoms_seed: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms15shape_renderingE"] #[link_name = "_ZN9nsGkAtoms15shape_renderingE"]
pub static nsGkAtoms_shape_rendering: *mut nsStaticAtom; pub static nsGkAtoms_shape_rendering: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms16simpleScopeChainE"]
pub static nsGkAtoms_simpleScopeChain: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms5skewXE"] #[link_name = "_ZN9nsGkAtoms5skewXE"]
pub static nsGkAtoms_skewX: *mut nsStaticAtom; pub static nsGkAtoms_skewX: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms5skewYE"] #[link_name = "_ZN9nsGkAtoms5skewYE"]
@ -3934,8 +3936,6 @@ cfg_if! {
pub static nsGkAtoms_sep_: *mut nsStaticAtom; pub static nsGkAtoms_sep_: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms8setdiff_E"] #[link_name = "_ZN9nsGkAtoms8setdiff_E"]
pub static nsGkAtoms_setdiff_: *mut nsStaticAtom; pub static nsGkAtoms_setdiff_: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms4set_E"]
pub static nsGkAtoms_set_: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms6share_E"] #[link_name = "_ZN9nsGkAtoms6share_E"]
pub static nsGkAtoms_share_: *mut nsStaticAtom; pub static nsGkAtoms_share_: *mut nsStaticAtom;
#[link_name = "_ZN9nsGkAtoms6shift_E"] #[link_name = "_ZN9nsGkAtoms6shift_E"]
@ -6205,8 +6205,6 @@ cfg_if! {
pub static nsGkAtoms_graphicsSymbol: *mut nsStaticAtom; pub static nsGkAtoms_graphicsSymbol: *mut nsStaticAtom;
#[link_name = "?grid@nsGkAtoms@@2PEAVnsStaticAtom@@EA"] #[link_name = "?grid@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_grid: *mut nsStaticAtom; pub static nsGkAtoms_grid: *mut nsStaticAtom;
#[link_name = "?grippy@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_grippy: *mut nsStaticAtom;
#[link_name = "?group@nsGkAtoms@@2PEAVnsStaticAtom@@EA"] #[link_name = "?group@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_group: *mut nsStaticAtom; pub static nsGkAtoms_group: *mut nsStaticAtom;
#[link_name = "?groupbox@nsGkAtoms@@2PEAVnsStaticAtom@@EA"] #[link_name = "?groupbox@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
@ -8511,10 +8509,14 @@ cfg_if! {
pub static nsGkAtoms_saturate: *mut nsStaticAtom; pub static nsGkAtoms_saturate: *mut nsStaticAtom;
#[link_name = "?saturation@nsGkAtoms@@2PEAVnsStaticAtom@@EA"] #[link_name = "?saturation@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_saturation: *mut nsStaticAtom; pub static nsGkAtoms_saturation: *mut nsStaticAtom;
#[link_name = "?set@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_set: *mut nsStaticAtom;
#[link_name = "?seed@nsGkAtoms@@2PEAVnsStaticAtom@@EA"] #[link_name = "?seed@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_seed: *mut nsStaticAtom; pub static nsGkAtoms_seed: *mut nsStaticAtom;
#[link_name = "?shape_rendering@nsGkAtoms@@2PEAVnsStaticAtom@@EA"] #[link_name = "?shape_rendering@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_shape_rendering: *mut nsStaticAtom; pub static nsGkAtoms_shape_rendering: *mut nsStaticAtom;
#[link_name = "?simpleScopeChain@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_simpleScopeChain: *mut nsStaticAtom;
#[link_name = "?skewX@nsGkAtoms@@2PEAVnsStaticAtom@@EA"] #[link_name = "?skewX@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_skewX: *mut nsStaticAtom; pub static nsGkAtoms_skewX: *mut nsStaticAtom;
#[link_name = "?skewY@nsGkAtoms@@2PEAVnsStaticAtom@@EA"] #[link_name = "?skewY@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
@ -9159,8 +9161,6 @@ cfg_if! {
pub static nsGkAtoms_sep_: *mut nsStaticAtom; pub static nsGkAtoms_sep_: *mut nsStaticAtom;
#[link_name = "?setdiff_@nsGkAtoms@@2PEAVnsStaticAtom@@EA"] #[link_name = "?setdiff_@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_setdiff_: *mut nsStaticAtom; pub static nsGkAtoms_setdiff_: *mut nsStaticAtom;
#[link_name = "?set_@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_set_: *mut nsStaticAtom;
#[link_name = "?share_@nsGkAtoms@@2PEAVnsStaticAtom@@EA"] #[link_name = "?share_@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
pub static nsGkAtoms_share_: *mut nsStaticAtom; pub static nsGkAtoms_share_: *mut nsStaticAtom;
#[link_name = "?shift_@nsGkAtoms@@2PEAVnsStaticAtom@@EA"] #[link_name = "?shift_@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
@ -11430,8 +11430,6 @@ cfg_if! {
pub static nsGkAtoms_graphicsSymbol: *mut nsStaticAtom; pub static nsGkAtoms_graphicsSymbol: *mut nsStaticAtom;
#[link_name = "\x01?grid@nsGkAtoms@@2PAVnsStaticAtom@@A"] #[link_name = "\x01?grid@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_grid: *mut nsStaticAtom; pub static nsGkAtoms_grid: *mut nsStaticAtom;
#[link_name = "\x01?grippy@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_grippy: *mut nsStaticAtom;
#[link_name = "\x01?group@nsGkAtoms@@2PAVnsStaticAtom@@A"] #[link_name = "\x01?group@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_group: *mut nsStaticAtom; pub static nsGkAtoms_group: *mut nsStaticAtom;
#[link_name = "\x01?groupbox@nsGkAtoms@@2PAVnsStaticAtom@@A"] #[link_name = "\x01?groupbox@nsGkAtoms@@2PAVnsStaticAtom@@A"]
@ -13736,10 +13734,14 @@ cfg_if! {
pub static nsGkAtoms_saturate: *mut nsStaticAtom; pub static nsGkAtoms_saturate: *mut nsStaticAtom;
#[link_name = "\x01?saturation@nsGkAtoms@@2PAVnsStaticAtom@@A"] #[link_name = "\x01?saturation@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_saturation: *mut nsStaticAtom; pub static nsGkAtoms_saturation: *mut nsStaticAtom;
#[link_name = "\x01?set@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_set: *mut nsStaticAtom;
#[link_name = "\x01?seed@nsGkAtoms@@2PAVnsStaticAtom@@A"] #[link_name = "\x01?seed@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_seed: *mut nsStaticAtom; pub static nsGkAtoms_seed: *mut nsStaticAtom;
#[link_name = "\x01?shape_rendering@nsGkAtoms@@2PAVnsStaticAtom@@A"] #[link_name = "\x01?shape_rendering@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_shape_rendering: *mut nsStaticAtom; pub static nsGkAtoms_shape_rendering: *mut nsStaticAtom;
#[link_name = "\x01?simpleScopeChain@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_simpleScopeChain: *mut nsStaticAtom;
#[link_name = "\x01?skewX@nsGkAtoms@@2PAVnsStaticAtom@@A"] #[link_name = "\x01?skewX@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_skewX: *mut nsStaticAtom; pub static nsGkAtoms_skewX: *mut nsStaticAtom;
#[link_name = "\x01?skewY@nsGkAtoms@@2PAVnsStaticAtom@@A"] #[link_name = "\x01?skewY@nsGkAtoms@@2PAVnsStaticAtom@@A"]
@ -14384,8 +14386,6 @@ cfg_if! {
pub static nsGkAtoms_sep_: *mut nsStaticAtom; pub static nsGkAtoms_sep_: *mut nsStaticAtom;
#[link_name = "\x01?setdiff_@nsGkAtoms@@2PAVnsStaticAtom@@A"] #[link_name = "\x01?setdiff_@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_setdiff_: *mut nsStaticAtom; pub static nsGkAtoms_setdiff_: *mut nsStaticAtom;
#[link_name = "\x01?set_@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_set_: *mut nsStaticAtom;
#[link_name = "\x01?share_@nsGkAtoms@@2PAVnsStaticAtom@@A"] #[link_name = "\x01?share_@nsGkAtoms@@2PAVnsStaticAtom@@A"]
pub static nsGkAtoms_share_: *mut nsStaticAtom; pub static nsGkAtoms_share_: *mut nsStaticAtom;
#[link_name = "\x01?shift_@nsGkAtoms@@2PAVnsStaticAtom@@A"] #[link_name = "\x01?shift_@nsGkAtoms@@2PAVnsStaticAtom@@A"]
@ -16658,8 +16658,6 @@ macro_rules! atom {
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_graphicsSymbol as *mut _) } }}; {{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_graphicsSymbol as *mut _) } }};
("grid") => ("grid") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_grid as *mut _) } }}; {{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_grid as *mut _) } }};
("grippy") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_grippy as *mut _) } }};
("group") => ("group") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_group as *mut _) } }}; {{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_group as *mut _) } }};
("groupbox") => ("groupbox") =>
@ -18964,10 +18962,14 @@ macro_rules! atom {
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_saturate as *mut _) } }}; {{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_saturate as *mut _) } }};
("saturation") => ("saturation") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_saturation as *mut _) } }}; {{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_saturation as *mut _) } }};
("set") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_set as *mut _) } }};
("seed") => ("seed") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_seed as *mut _) } }}; {{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_seed as *mut _) } }};
("shape-rendering") => ("shape-rendering") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_shape_rendering as *mut _) } }}; {{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_shape_rendering as *mut _) } }};
("simpleScopeChain") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_simpleScopeChain as *mut _) } }};
("skewX") => ("skewX") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_skewX as *mut _) } }}; {{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_skewX as *mut _) } }};
("skewY") => ("skewY") =>
@ -19612,8 +19614,6 @@ macro_rules! atom {
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_sep_ as *mut _) } }}; {{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_sep_ as *mut _) } }};
("setdiff") => ("setdiff") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_setdiff_ as *mut _) } }}; {{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_setdiff_ as *mut _) } }};
("set") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_set_ as *mut _) } }};
("share") => ("share") =>
{{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_share_ as *mut _) } }}; {{ #[allow(unsafe_code)] #[allow(unused_unsafe)]unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_share_ as *mut _) } }};
("shift") => ("shift") =>

View file

@ -5,8 +5,8 @@ use gecko_bindings::structs::nsStyleTransformMatrix;
use gecko_bindings::structs::nsTArray; use gecko_bindings::structs::nsTArray;
type nsACString_internal = nsACString; type nsACString_internal = nsACString;
type nsAString_internal = nsAString; type nsAString_internal = nsAString;
pub type ServoStyleContextBorrowed<'a> = &'a ::properties::ComputedValues; pub type ComputedStyleBorrowed<'a> = &'a ::properties::ComputedValues;
pub type ServoStyleContextBorrowedOrNull<'a> = Option<&'a ::properties::ComputedValues>; pub type ComputedStyleBorrowedOrNull<'a> = Option<&'a ::properties::ComputedValues>;
pub type ServoComputedDataBorrowed<'a> = &'a ServoComputedData; pub type ServoComputedDataBorrowed<'a> = &'a ServoComputedData;
pub type RawServoAnimationValueTableBorrowed<'a> = &'a (); pub type RawServoAnimationValueTableBorrowed<'a> = &'a ();
use gecko_bindings::structs::mozilla::css::GridTemplateAreasValue; use gecko_bindings::structs::mozilla::css::GridTemplateAreasValue;
@ -118,9 +118,7 @@ unsafe impl Sync for nsStyleContentData_CounterFunction {}
use gecko_bindings::structs::nsStyleContentType; use gecko_bindings::structs::nsStyleContentType;
unsafe impl Send for nsStyleContentType {} unsafe impl Send for nsStyleContentType {}
unsafe impl Sync for nsStyleContentType {} unsafe impl Sync for nsStyleContentType {}
use gecko_bindings::structs::nsStyleContext; use gecko_bindings::structs::ComputedStyle;
unsafe impl Send for nsStyleContext {}
unsafe impl Sync for nsStyleContext {}
use gecko_bindings::structs::nsStyleCoord; use gecko_bindings::structs::nsStyleCoord;
unsafe impl Send for nsStyleCoord {} unsafe impl Send for nsStyleCoord {}
unsafe impl Sync for nsStyleCoord {} unsafe impl Sync for nsStyleCoord {}
@ -238,8 +236,7 @@ use gecko_bindings::structs::LoaderReusableStyleSheets;
use gecko_bindings::structs::SheetLoadData; use gecko_bindings::structs::SheetLoadData;
use gecko_bindings::structs::ServoStyleSheet; use gecko_bindings::structs::ServoStyleSheet;
use gecko_bindings::structs::ServoComputedData; use gecko_bindings::structs::ServoComputedData;
use gecko_bindings::structs::ServoStyleContext; use gecko_bindings::structs::ComputedStyleStrong;
use gecko_bindings::structs::ServoStyleContextStrong;
use gecko_bindings::structs::EffectCompositor_CascadeLevel; use gecko_bindings::structs::EffectCompositor_CascadeLevel;
use gecko_bindings::structs::UpdateAnimationsTasks; use gecko_bindings::structs::UpdateAnimationsTasks;
use gecko_bindings::structs::ParsingMode; use gecko_bindings::structs::ParsingMode;
@ -586,9 +583,9 @@ extern "C" {
pub fn Gecko_DestroyAnonymousContentList(anon_content: *mut nsTArray<*mut nsIContent>); pub fn Gecko_DestroyAnonymousContentList(anon_content: *mut nsTArray<*mut nsIContent>);
} }
extern "C" { extern "C" {
pub fn Gecko_ServoStyleContext_Init( pub fn Gecko_ComputedStyle_Init(
context: *mut ServoStyleContext, context: *mut ComputedStyle,
parent_context: ServoStyleContextBorrowedOrNull, parent_context: ComputedStyleBorrowedOrNull,
pres_context: RawGeckoPresContextBorrowed, pres_context: RawGeckoPresContextBorrowed,
values: ServoComputedDataBorrowed, values: ServoComputedDataBorrowed,
pseudo_type: CSSPseudoElementType, pseudo_type: CSSPseudoElementType,
@ -596,7 +593,7 @@ extern "C" {
); );
} }
extern "C" { extern "C" {
pub fn Gecko_ServoStyleContext_Destroy(context: *mut ServoStyleContext); pub fn Gecko_ComputedStyle_Destroy(context: *mut ComputedStyle);
} }
extern "C" { extern "C" {
pub fn Gecko_ConstructStyleChildrenIterator( pub fn Gecko_ConstructStyleChildrenIterator(
@ -879,8 +876,8 @@ extern "C" {
extern "C" { extern "C" {
pub fn Gecko_UpdateAnimations( pub fn Gecko_UpdateAnimations(
aElementOrPseudo: RawGeckoElementBorrowed, aElementOrPseudo: RawGeckoElementBorrowed,
aOldComputedValues: ServoStyleContextBorrowedOrNull, aOldComputedValues: ComputedStyleBorrowedOrNull,
aComputedValues: ServoStyleContextBorrowedOrNull, aComputedValues: ComputedStyleBorrowedOrNull,
aTasks: UpdateAnimationsTasks, aTasks: UpdateAnimationsTasks,
); );
} }
@ -1173,8 +1170,8 @@ extern "C" {
} }
extern "C" { extern "C" {
pub fn Gecko_CalcStyleDifference( pub fn Gecko_CalcStyleDifference(
old_style: ServoStyleContextBorrowed, old_style: ComputedStyleBorrowed,
new_style: ServoStyleContextBorrowed, new_style: ComputedStyleBorrowed,
any_style_changed: *mut bool, any_style_changed: *mut bool,
reset_only_changed: *mut bool, reset_only_changed: *mut bool,
) -> u32; ) -> u32;
@ -1989,7 +1986,7 @@ extern "C" {
extern "C" { extern "C" {
pub fn Servo_Element_GetPrimaryComputedValues( pub fn Servo_Element_GetPrimaryComputedValues(
node: RawGeckoElementBorrowed, node: RawGeckoElementBorrowed,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_Element_HasPseudoComputedValues( pub fn Servo_Element_HasPseudoComputedValues(
@ -2001,7 +1998,7 @@ extern "C" {
pub fn Servo_Element_GetPseudoComputedValues( pub fn Servo_Element_GetPseudoComputedValues(
node: RawGeckoElementBorrowed, node: RawGeckoElementBorrowed,
index: usize, index: usize,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_Element_IsDisplayNone(element: RawGeckoElementBorrowed) -> bool; pub fn Servo_Element_IsDisplayNone(element: RawGeckoElementBorrowed) -> bool;
@ -2160,9 +2157,9 @@ extern "C" {
extern "C" { extern "C" {
pub fn Servo_StyleSet_ResolveForDeclarations( pub fn Servo_StyleSet_ResolveForDeclarations(
set: RawServoStyleSetBorrowed, set: RawServoStyleSetBorrowed,
parent_style: ServoStyleContextBorrowedOrNull, parent_style: ComputedStyleBorrowedOrNull,
declarations: RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_SelectorList_Parse(selector_list: *const nsACString) -> *mut RawServoSelectorList; pub fn Servo_SelectorList_Parse(selector_list: *const nsACString) -> *mut RawServoSelectorList;
@ -2257,10 +2254,10 @@ extern "C" {
) -> usize; ) -> usize;
} }
extern "C" { extern "C" {
pub fn Servo_StyleContext_AddRef(ctx: ServoStyleContextBorrowed); pub fn Servo_ComputedStyle_AddRef(ctx: ComputedStyleBorrowed);
} }
extern "C" { extern "C" {
pub fn Servo_StyleContext_Release(ctx: ServoStyleContextBorrowed); pub fn Servo_ComputedStyle_Release(ctx: ComputedStyleBorrowed);
} }
extern "C" { extern "C" {
pub fn Servo_StyleSet_MightHaveAttributeDependency( pub fn Servo_StyleSet_MightHaveAttributeDependency(
@ -2637,20 +2634,20 @@ extern "C" {
pub fn Servo_GetComputedKeyframeValues( pub fn Servo_GetComputedKeyframeValues(
keyframes: RawGeckoKeyframeListBorrowed, keyframes: RawGeckoKeyframeListBorrowed,
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
style: ServoStyleContextBorrowed, style: ComputedStyleBorrowed,
set: RawServoStyleSetBorrowed, set: RawServoStyleSetBorrowed,
result: RawGeckoComputedKeyframeValuesListBorrowedMut, result: RawGeckoComputedKeyframeValuesListBorrowedMut,
); );
} }
extern "C" { extern "C" {
pub fn Servo_ComputedValues_ExtractAnimationValue( pub fn Servo_ComputedValues_ExtractAnimationValue(
computed_values: ServoStyleContextBorrowed, computed_values: ComputedStyleBorrowed,
property: nsCSSPropertyID, property: nsCSSPropertyID,
) -> RawServoAnimationValueStrong; ) -> RawServoAnimationValueStrong;
} }
extern "C" { extern "C" {
pub fn Servo_ComputedValues_SpecifiesAnimationsOrTransitions( pub fn Servo_ComputedValues_SpecifiesAnimationsOrTransitions(
computed_values: ServoStyleContextBorrowed, computed_values: ComputedStyleBorrowed,
) -> bool; ) -> bool;
} }
extern "C" { extern "C" {
@ -2682,7 +2679,7 @@ extern "C" {
pub fn Servo_GetAnimationValues( pub fn Servo_GetAnimationValues(
declarations: RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
style: ServoStyleContextBorrowed, style: ComputedStyleBorrowed,
style_set: RawServoStyleSetBorrowed, style_set: RawServoStyleSetBorrowed,
animation_values: RawGeckoServoAnimationValueListBorrowedMut, animation_values: RawGeckoServoAnimationValueListBorrowedMut,
); );
@ -2770,7 +2767,7 @@ extern "C" {
pub fn Servo_AnimationValue_Compute( pub fn Servo_AnimationValue_Compute(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
declarations: RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
style: ServoStyleContextBorrowed, style: ComputedStyleBorrowed,
raw_data: RawServoStyleSetBorrowed, raw_data: RawServoStyleSetBorrowed,
) -> RawServoAnimationValueStrong; ) -> RawServoAnimationValueStrong;
} }
@ -2807,7 +2804,7 @@ extern "C" {
declarations: RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property: nsCSSPropertyID, property: nsCSSPropertyID,
buffer: *mut nsAString, buffer: *mut nsAString,
computed_values: ServoStyleContextBorrowedOrNull, computed_values: ComputedStyleBorrowedOrNull,
custom_properties: RawServoDeclarationBlockBorrowedOrNull, custom_properties: RawServoDeclarationBlockBorrowedOrNull,
); );
} }
@ -3049,21 +3046,21 @@ extern "C" {
} }
extern "C" { extern "C" {
pub fn Servo_ComputedValues_GetForAnonymousBox( pub fn Servo_ComputedValues_GetForAnonymousBox(
parent_style_or_null: ServoStyleContextBorrowedOrNull, parent_style_or_null: ComputedStyleBorrowedOrNull,
pseudo_tag: *mut nsAtom, pseudo_tag: *mut nsAtom,
set: RawServoStyleSetBorrowed, set: RawServoStyleSetBorrowed,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_ComputedValues_Inherit( pub fn Servo_ComputedValues_Inherit(
set: RawServoStyleSetBorrowed, set: RawServoStyleSetBorrowed,
pseudo_tag: *mut nsAtom, pseudo_tag: *mut nsAtom,
parent_style: ServoStyleContextBorrowedOrNull, parent_style: ComputedStyleBorrowedOrNull,
target: InheritTarget, target: InheritTarget,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_ComputedValues_GetStyleBits(values: ServoStyleContextBorrowed) -> u64; pub fn Servo_ComputedValues_GetStyleBits(values: ComputedStyleBorrowed) -> u64;
} }
extern "C" { extern "C" {
pub fn Servo_ComputedValues_EqualCustomProperties( pub fn Servo_ComputedValues_EqualCustomProperties(
@ -3073,7 +3070,7 @@ extern "C" {
} }
extern "C" { extern "C" {
pub fn Servo_ComputedValues_GetStyleRuleList( pub fn Servo_ComputedValues_GetStyleRuleList(
values: ServoStyleContextBorrowed, values: ComputedStyleBorrowed,
rules: RawGeckoServoStyleRuleListBorrowedMut, rules: RawGeckoServoStyleRuleListBorrowedMut,
); );
} }
@ -3100,35 +3097,35 @@ extern "C" {
pub fn Servo_ResolveStyle( pub fn Servo_ResolveStyle(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
set: RawServoStyleSetBorrowed, set: RawServoStyleSetBorrowed,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_ResolvePseudoStyle( pub fn Servo_ResolvePseudoStyle(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
pseudo_type: CSSPseudoElementType, pseudo_type: CSSPseudoElementType,
is_probe: bool, is_probe: bool,
inherited_style: ServoStyleContextBorrowedOrNull, inherited_style: ComputedStyleBorrowedOrNull,
set: RawServoStyleSetBorrowed, set: RawServoStyleSetBorrowed,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_ComputedValues_ResolveXULTreePseudoStyle( pub fn Servo_ComputedValues_ResolveXULTreePseudoStyle(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
pseudo_tag: *mut nsAtom, pseudo_tag: *mut nsAtom,
inherited_style: ServoStyleContextBorrowed, inherited_style: ComputedStyleBorrowed,
input_word: *const AtomArray, input_word: *const AtomArray,
set: RawServoStyleSetBorrowed, set: RawServoStyleSetBorrowed,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_SetExplicitStyle( pub fn Servo_SetExplicitStyle(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
primary_style: ServoStyleContextBorrowed, primary_style: ComputedStyleBorrowed,
); );
} }
extern "C" { extern "C" {
pub fn Servo_HasAuthorSpecifiedRules( pub fn Servo_HasAuthorSpecifiedRules(
style: ServoStyleContextBorrowed, style: ComputedStyleBorrowed,
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
pseudo_type: CSSPseudoElementType, pseudo_type: CSSPseudoElementType,
rule_type_mask: u32, rule_type_mask: u32,
@ -3142,17 +3139,17 @@ extern "C" {
rule_inclusion: StyleRuleInclusion, rule_inclusion: StyleRuleInclusion,
snapshots: *const ServoElementSnapshotTable, snapshots: *const ServoElementSnapshotTable,
set: RawServoStyleSetBorrowed, set: RawServoStyleSetBorrowed,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_ReparentStyle( pub fn Servo_ReparentStyle(
style_to_reparent: ServoStyleContextBorrowed, style_to_reparent: ComputedStyleBorrowed,
parent_style: ServoStyleContextBorrowed, parent_style: ComputedStyleBorrowed,
parent_style_ignoring_first_line: ServoStyleContextBorrowed, parent_style_ignoring_first_line: ComputedStyleBorrowed,
layout_parent_style: ServoStyleContextBorrowed, layout_parent_style: ComputedStyleBorrowed,
element: RawGeckoElementBorrowedOrNull, element: RawGeckoElementBorrowedOrNull,
set: RawServoStyleSetBorrowed, set: RawServoStyleSetBorrowed,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_TraverseSubtree( pub fn Servo_TraverseSubtree(
@ -3175,18 +3172,18 @@ extern "C" {
pub fn Servo_StyleSet_GetBaseComputedValuesForElement( pub fn Servo_StyleSet_GetBaseComputedValuesForElement(
set: RawServoStyleSetBorrowed, set: RawServoStyleSetBorrowed,
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
existing_style: ServoStyleContextBorrowed, existing_style: ComputedStyleBorrowed,
snapshots: *const ServoElementSnapshotTable, snapshots: *const ServoElementSnapshotTable,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_StyleSet_GetComputedValuesByAddingAnimation( pub fn Servo_StyleSet_GetComputedValuesByAddingAnimation(
set: RawServoStyleSetBorrowed, set: RawServoStyleSetBorrowed,
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
existing_style: ServoStyleContextBorrowed, existing_style: ComputedStyleBorrowed,
snapshots: *const ServoElementSnapshotTable, snapshots: *const ServoElementSnapshotTable,
animation: RawServoAnimationValueBorrowed, animation: RawServoAnimationValueBorrowed,
) -> ServoStyleContextStrong; ) -> ComputedStyleStrong;
} }
extern "C" { extern "C" {
pub fn Servo_SerializeFontValueForCanvas( pub fn Servo_SerializeFontValueForCanvas(
@ -3196,17 +3193,17 @@ extern "C" {
} }
extern "C" { extern "C" {
pub fn Servo_GetCustomPropertyValue( pub fn Servo_GetCustomPropertyValue(
computed_values: ServoStyleContextBorrowed, computed_values: ComputedStyleBorrowed,
name: *const nsAString, name: *const nsAString,
value: *mut nsAString, value: *mut nsAString,
) -> bool; ) -> bool;
} }
extern "C" { extern "C" {
pub fn Servo_GetCustomPropertiesCount(computed_values: ServoStyleContextBorrowed) -> u32; pub fn Servo_GetCustomPropertiesCount(computed_values: ComputedStyleBorrowed) -> u32;
} }
extern "C" { extern "C" {
pub fn Servo_GetCustomPropertyNameAt( pub fn Servo_GetCustomPropertyNameAt(
arg1: ServoStyleContextBorrowed, arg1: ComputedStyleBorrowed,
index: u32, index: u32,
name: *mut nsAString, name: *mut nsAString,
) -> bool; ) -> bool;
@ -3287,6 +3284,9 @@ extern "C" {
weight: nsCSSValueBorrowedMut, weight: nsCSSValueBorrowedMut,
) -> bool; ) -> bool;
} }
extern "C" {
pub fn Servo_Property_IsShorthand(name: *const nsACString, found: *mut bool) -> bool;
}
extern "C" { extern "C" {
pub fn Gecko_CreateCSSErrorReporter( pub fn Gecko_CreateCSSErrorReporter(
sheet: *mut ServoStyleSheet, sheet: *mut ServoStyleSheet,

File diff suppressed because it is too large Load diff

View file

@ -78,7 +78,7 @@ pub mod style_structs {
pub type ComputedValuesInner = ::gecko_bindings::structs::ServoComputedData; pub type ComputedValuesInner = ::gecko_bindings::structs::ServoComputedData;
#[repr(C)] #[repr(C)]
pub struct ComputedValues(::gecko_bindings::structs::mozilla::ServoStyleContext); pub struct ComputedValues(::gecko_bindings::structs::mozilla::ComputedStyle);
impl ComputedValues { impl ComputedValues {
pub fn new( pub fn new(
@ -126,7 +126,7 @@ impl ComputedValues {
pub fn pseudo(&self) -> Option<PseudoElement> { pub fn pseudo(&self) -> Option<PseudoElement> {
use string_cache::Atom; use string_cache::Atom;
let atom = (self.0)._base.mPseudoTag.mRawPtr; let atom = (self.0).mPseudoTag.mRawPtr;
if atom.is_null() { if atom.is_null() {
return None; return None;
} }
@ -136,7 +136,7 @@ impl ComputedValues {
} }
fn get_pseudo_type(&self) -> CSSPseudoElementType { fn get_pseudo_type(&self) -> CSSPseudoElementType {
let bits = (self.0)._base.mBits; let bits = (self.0).mBits;
let our_type = bits >> NS_STYLE_CONTEXT_TYPE_SHIFT; let our_type = bits >> NS_STYLE_CONTEXT_TYPE_SHIFT;
unsafe { transmute(our_type as u8) } unsafe { transmute(our_type as u8) }
} }
@ -167,7 +167,7 @@ impl ComputedValues {
impl Drop for ComputedValues { impl Drop for ComputedValues {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
bindings::Gecko_ServoStyleContext_Destroy(&mut self.0); bindings::Gecko_ComputedStyle_Destroy(&mut self.0);
} }
} }
} }
@ -197,7 +197,7 @@ impl Clone for ComputedValuesInner {
} }
type PseudoInfo = (*mut structs::nsAtom, structs::CSSPseudoElementType); type PseudoInfo = (*mut structs::nsAtom, structs::CSSPseudoElementType);
type ParentStyleContextInfo<'a> = Option< &'a ComputedValues>; type ParentComputedStyleInfo<'a> = Option< &'a ComputedValues>;
impl ComputedValuesInner { impl ComputedValuesInner {
pub fn new(custom_properties: Option<Arc<CustomPropertiesMap>>, pub fn new(custom_properties: Option<Arc<CustomPropertiesMap>>,
@ -224,7 +224,7 @@ impl ComputedValuesInner {
fn to_outer( fn to_outer(
self, self,
pres_context: RawGeckoPresContextBorrowed, pres_context: RawGeckoPresContextBorrowed,
parent: ParentStyleContextInfo, parent: ParentComputedStyleInfo,
info: Option<PseudoInfo> info: Option<PseudoInfo>
) -> Arc<ComputedValues> { ) -> Arc<ComputedValues> {
let (tag, ty) = if let Some(info) = info { let (tag, ty) = if let Some(info) = info {
@ -239,13 +239,13 @@ impl ComputedValuesInner {
unsafe fn to_outer_helper( unsafe fn to_outer_helper(
self, self,
pres_context: bindings::RawGeckoPresContextBorrowed, pres_context: bindings::RawGeckoPresContextBorrowed,
parent: ParentStyleContextInfo, parent: ParentComputedStyleInfo,
pseudo_ty: structs::CSSPseudoElementType, pseudo_ty: structs::CSSPseudoElementType,
pseudo_tag: *mut structs::nsAtom pseudo_tag: *mut structs::nsAtom
) -> Arc<ComputedValues> { ) -> Arc<ComputedValues> {
let arc = { let arc = {
let arc: Arc<ComputedValues> = Arc::new(uninitialized()); let arc: Arc<ComputedValues> = Arc::new(uninitialized());
bindings::Gecko_ServoStyleContext_Init(&arc.0 as *const _ as *mut _, bindings::Gecko_ComputedStyle_Init(&arc.0 as *const _ as *mut _,
parent, pres_context, parent, pres_context,
&self, pseudo_ty, pseudo_tag); &self, pseudo_ty, pseudo_tag);
// We're simulating a move by having C++ do a memcpy and then forgetting // We're simulating a move by having C++ do a memcpy and then forgetting

View file

@ -2422,10 +2422,11 @@ pub struct ComputedValuesInner {
pub struct ComputedValues { pub struct ComputedValues {
/// The actual computed values /// The actual computed values
/// ///
/// In Gecko the outer ComputedValues is actually a style context, /// In Gecko the outer ComputedValues is actually a ComputedStyle, whereas
/// whereas ComputedValuesInner is the core set of computed values. /// ComputedValuesInner is the core set of computed values.
/// ///
/// We maintain this distinction in servo to reduce the amount of special casing. /// We maintain this distinction in servo to reduce the amount of special
/// casing.
inner: ComputedValuesInner, inner: ComputedValuesInner,
} }

View file

@ -667,8 +667,7 @@ impl<E: TElement> StyleSharingCache<E> {
} }
// We do not ignore visited state here, because Gecko needs to store // We do not ignore visited state here, because Gecko needs to store
// extra bits on visited style contexts, so these contexts cannot be // extra bits on visited styles, so these contexts cannot be shared.
// shared.
if target.element.state() != candidate.state() { if target.element.state() != candidate.state() {
trace!("Miss: User and Author State"); trace!("Miss: User and Author State");
return None; return None;

View file

@ -598,7 +598,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
/// into the cascade. /// into the cascade.
/// ///
/// When comparing to Gecko, this is similar to the work done by /// When comparing to Gecko, this is similar to the work done by
/// `nsStyleContext::ApplyStyleFixups`, plus some parts of /// `ComputedStyle::ApplyStyleFixups`, plus some parts of
/// `nsStyleSet::GetContext`. /// `nsStyleSet::GetContext`.
pub fn adjust<E>( pub fn adjust<E>(
&mut self, &mut self,

View file

@ -53,10 +53,11 @@ use style::gecko_bindings::bindings::{RawServoSelectorListBorrowed, RawServoSele
use style::gecko_bindings::bindings::{RawServoSourceSizeListBorrowedOrNull, RawServoSourceSizeListOwned}; use style::gecko_bindings::bindings::{RawServoSourceSizeListBorrowedOrNull, RawServoSourceSizeListOwned};
use style::gecko_bindings::bindings::{RawServoStyleSetBorrowed, RawServoStyleSetBorrowedOrNull, RawServoStyleSetOwned}; use style::gecko_bindings::bindings::{RawServoStyleSetBorrowed, RawServoStyleSetBorrowedOrNull, RawServoStyleSetOwned};
use style::gecko_bindings::bindings::{RawServoStyleSheetContentsBorrowed, ServoComputedDataBorrowed}; use style::gecko_bindings::bindings::{RawServoStyleSheetContentsBorrowed, ServoComputedDataBorrowed};
use style::gecko_bindings::bindings::{RawServoStyleSheetContentsStrong, ServoStyleContextBorrowed}; use style::gecko_bindings::bindings::{RawServoStyleSheetContentsStrong, ComputedStyleBorrowed};
use style::gecko_bindings::bindings::{RawServoSupportsRule, RawServoSupportsRuleBorrowed}; use style::gecko_bindings::bindings::{RawServoSupportsRule, RawServoSupportsRuleBorrowed};
use style::gecko_bindings::bindings::{ServoCssRulesBorrowed, ServoCssRulesStrong}; use style::gecko_bindings::bindings::{ServoCssRulesBorrowed, ServoCssRulesStrong};
use style::gecko_bindings::bindings::{nsACString, nsAString, nsCSSPropertyIDSetBorrowedMut}; use style::gecko_bindings::bindings::{nsACString, nsAString, nsCSSPropertyIDSetBorrowedMut};
use style::gecko_bindings::bindings::ComputedStyleBorrowedOrNull;
use style::gecko_bindings::bindings::Gecko_AddPropertyToSet; use style::gecko_bindings::bindings::Gecko_AddPropertyToSet;
use style::gecko_bindings::bindings::Gecko_AppendPropertyValuePair; use style::gecko_bindings::bindings::Gecko_AppendPropertyValuePair;
use style::gecko_bindings::bindings::Gecko_ConstructFontFeatureValueSet; use style::gecko_bindings::bindings::Gecko_ConstructFontFeatureValueSet;
@ -81,7 +82,6 @@ use style::gecko_bindings::bindings::RawServoAnimationValueTableBorrowed;
use style::gecko_bindings::bindings::RawServoDeclarationBlockBorrowedOrNull; use style::gecko_bindings::bindings::RawServoDeclarationBlockBorrowedOrNull;
use style::gecko_bindings::bindings::RawServoStyleRuleBorrowed; use style::gecko_bindings::bindings::RawServoStyleRuleBorrowed;
use style::gecko_bindings::bindings::RawServoStyleSet; use style::gecko_bindings::bindings::RawServoStyleSet;
use style::gecko_bindings::bindings::ServoStyleContextBorrowedOrNull;
use style::gecko_bindings::bindings::nsCSSValueBorrowedMut; use style::gecko_bindings::bindings::nsCSSValueBorrowedMut;
use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t; use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
use style::gecko_bindings::bindings::nsTimingFunctionBorrowed; use style::gecko_bindings::bindings::nsTimingFunctionBorrowed;
@ -89,7 +89,7 @@ use style::gecko_bindings::bindings::nsTimingFunctionBorrowedMut;
use style::gecko_bindings::structs; use style::gecko_bindings::structs;
use style::gecko_bindings::structs::{CallerType, CSSPseudoElementType, CompositeOperation}; use style::gecko_bindings::structs::{CallerType, CSSPseudoElementType, CompositeOperation};
use style::gecko_bindings::structs::{Loader, LoaderReusableStyleSheets}; use style::gecko_bindings::structs::{Loader, LoaderReusableStyleSheets};
use style::gecko_bindings::structs::{RawServoStyleRule, ServoStyleContextStrong, RustString}; use style::gecko_bindings::structs::{RawServoStyleRule, ComputedStyleStrong, RustString};
use style::gecko_bindings::structs::{ServoStyleSheet, SheetLoadData, SheetParsingMode, nsAtom, nsCSSPropertyID}; use style::gecko_bindings::structs::{ServoStyleSheet, SheetLoadData, SheetParsingMode, nsAtom, nsCSSPropertyID};
use style::gecko_bindings::structs::{nsCSSFontDesc, nsCSSFontFaceRule, nsCSSCounterStyleRule}; use style::gecko_bindings::structs::{nsCSSFontDesc, nsCSSFontFaceRule, nsCSSCounterStyleRule};
use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint, PropertyValuePair}; use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint, PropertyValuePair};
@ -833,9 +833,9 @@ fn resolve_rules_for_element_with_context<'a>(
pub extern "C" fn Servo_StyleSet_GetBaseComputedValuesForElement( pub extern "C" fn Servo_StyleSet_GetBaseComputedValuesForElement(
raw_style_set: RawServoStyleSetBorrowed, raw_style_set: RawServoStyleSetBorrowed,
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
computed_values: ServoStyleContextBorrowed, computed_values: ComputedStyleBorrowed,
snapshots: *const ServoElementSnapshotTable, snapshots: *const ServoElementSnapshotTable,
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
debug_assert!(!snapshots.is_null()); debug_assert!(!snapshots.is_null());
let computed_values = unsafe { ArcBorrow::from_ref(computed_values) }; let computed_values = unsafe { ArcBorrow::from_ref(computed_values) };
@ -872,14 +872,14 @@ pub extern "C" fn Servo_StyleSet_GetBaseComputedValuesForElement(
pub extern "C" fn Servo_StyleSet_GetComputedValuesByAddingAnimation( pub extern "C" fn Servo_StyleSet_GetComputedValuesByAddingAnimation(
raw_style_set: RawServoStyleSetBorrowed, raw_style_set: RawServoStyleSetBorrowed,
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
computed_values: ServoStyleContextBorrowed, computed_values: ComputedStyleBorrowed,
snapshots: *const ServoElementSnapshotTable, snapshots: *const ServoElementSnapshotTable,
animation_value: RawServoAnimationValueBorrowed, animation_value: RawServoAnimationValueBorrowed,
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
debug_assert!(!snapshots.is_null()); debug_assert!(!snapshots.is_null());
let computed_values = unsafe { ArcBorrow::from_ref(computed_values) }; let computed_values = unsafe { ArcBorrow::from_ref(computed_values) };
let rules = match computed_values.rules { let rules = match computed_values.rules {
None => return ServoStyleContextStrong::null(), None => return ComputedStyleStrong::null(),
Some(ref rules) => rules, Some(ref rules) => rules,
}; };
@ -900,7 +900,7 @@ pub extern "C" fn Servo_StyleSet_GetComputedValuesByAddingAnimation(
let element = GeckoElement(element); let element = GeckoElement(element);
if element.borrow_data().is_none() { if element.borrow_data().is_none() {
return ServoStyleContextStrong::null(); return ComputedStyleStrong::null();
} }
let shared = create_shared_context(&global_style_data, let shared = create_shared_context(&global_style_data,
@ -919,7 +919,7 @@ pub extern "C" fn Servo_StyleSet_GetComputedValuesByAddingAnimation(
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ComputedValues_ExtractAnimationValue( pub extern "C" fn Servo_ComputedValues_ExtractAnimationValue(
computed_values: ServoStyleContextBorrowed, computed_values: ComputedStyleBorrowed,
property_id: nsCSSPropertyID, property_id: nsCSSPropertyID,
) -> RawServoAnimationValueStrong { ) -> RawServoAnimationValueStrong {
let property = match LonghandId::from_nscsspropertyid(property_id) { let property = match LonghandId::from_nscsspropertyid(property_id) {
@ -1013,7 +1013,7 @@ pub extern "C" fn Servo_Element_HasPrimaryComputedValues(element: RawGeckoElemen
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_Element_GetPrimaryComputedValues( pub extern "C" fn Servo_Element_GetPrimaryComputedValues(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
let element = GeckoElement(element); let element = GeckoElement(element);
let data = element.borrow_data().expect("Getting CVs on unstyled element"); let data = element.borrow_data().expect("Getting CVs on unstyled element");
data.styles.primary().clone().into() data.styles.primary().clone().into()
@ -1033,7 +1033,7 @@ pub extern "C" fn Servo_Element_HasPseudoComputedValues(
pub extern "C" fn Servo_Element_GetPseudoComputedValues( pub extern "C" fn Servo_Element_GetPseudoComputedValues(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
index: usize, index: usize,
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
let element = GeckoElement(element); let element = GeckoElement(element);
let data = element.borrow_data().expect("Getting CVs that aren't present"); let data = element.borrow_data().expect("Getting CVs that aren't present");
data.styles.pseudos.as_array()[index].as_ref().expect("Getting CVs that aren't present") data.styles.pseudos.as_array()[index].as_ref().expect("Getting CVs that aren't present")
@ -2185,10 +2185,10 @@ pub extern "C" fn Servo_FontFeatureValuesRule_GetValueText(
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn Servo_ComputedValues_GetForAnonymousBox( pub unsafe extern "C" fn Servo_ComputedValues_GetForAnonymousBox(
parent_style_or_null: ServoStyleContextBorrowedOrNull, parent_style_or_null: ComputedStyleBorrowedOrNull,
pseudo_tag: *mut nsAtom, pseudo_tag: *mut nsAtom,
raw_data: RawServoStyleSetBorrowed, raw_data: RawServoStyleSetBorrowed,
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
let guard = global_style_data.shared_lock.read(); let guard = global_style_data.shared_lock.read();
let guards = StylesheetGuards::same(&guard); let guards = StylesheetGuards::same(&guard);
@ -2243,9 +2243,9 @@ pub extern "C" fn Servo_ResolvePseudoStyle(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
pseudo_type: CSSPseudoElementType, pseudo_type: CSSPseudoElementType,
is_probe: bool, is_probe: bool,
inherited_style: ServoStyleContextBorrowedOrNull, inherited_style: ComputedStyleBorrowedOrNull,
raw_data: RawServoStyleSetBorrowed, raw_data: RawServoStyleSetBorrowed,
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
let element = GeckoElement(element); let element = GeckoElement(element);
let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
@ -2317,10 +2317,10 @@ fn debug_atom_array(atoms: &AtomArray) -> String {
pub extern "C" fn Servo_ComputedValues_ResolveXULTreePseudoStyle( pub extern "C" fn Servo_ComputedValues_ResolveXULTreePseudoStyle(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
pseudo_tag: *mut nsAtom, pseudo_tag: *mut nsAtom,
inherited_style: ServoStyleContextBorrowed, inherited_style: ComputedStyleBorrowed,
input_word: *const AtomArray, input_word: *const AtomArray,
raw_data: RawServoStyleSetBorrowed raw_data: RawServoStyleSetBorrowed
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
let element = GeckoElement(element); let element = GeckoElement(element);
let data = element.borrow_data() let data = element.borrow_data()
.expect("Calling ResolveXULTreePseudoStyle on unstyled element?"); .expect("Calling ResolveXULTreePseudoStyle on unstyled element?");
@ -2362,7 +2362,7 @@ pub extern "C" fn Servo_ComputedValues_ResolveXULTreePseudoStyle(
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_SetExplicitStyle( pub extern "C" fn Servo_SetExplicitStyle(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
style: ServoStyleContextBorrowed, style: ComputedStyleBorrowed,
) { ) {
let element = GeckoElement(element); let element = GeckoElement(element);
debug!("Servo_SetExplicitStyle: {:?}", element); debug!("Servo_SetExplicitStyle: {:?}", element);
@ -2375,7 +2375,7 @@ pub extern "C" fn Servo_SetExplicitStyle(
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_HasAuthorSpecifiedRules( pub extern "C" fn Servo_HasAuthorSpecifiedRules(
style: ServoStyleContextBorrowed, style: ComputedStyleBorrowed,
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
pseudo_type: CSSPseudoElementType, pseudo_type: CSSPseudoElementType,
rule_type_mask: u32, rule_type_mask: u32,
@ -2498,9 +2498,9 @@ fn get_pseudo_style(
pub unsafe extern "C" fn Servo_ComputedValues_Inherit( pub unsafe extern "C" fn Servo_ComputedValues_Inherit(
raw_data: RawServoStyleSetBorrowed, raw_data: RawServoStyleSetBorrowed,
pseudo_tag: *mut nsAtom, pseudo_tag: *mut nsAtom,
parent_style_context: ServoStyleContextBorrowedOrNull, parent_style_context: ComputedStyleBorrowedOrNull,
target: structs::InheritTarget target: structs::InheritTarget
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
let for_text = target == structs::InheritTarget::Text; let for_text = target == structs::InheritTarget::Text;
@ -2522,7 +2522,7 @@ pub unsafe extern "C" fn Servo_ComputedValues_Inherit(
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ComputedValues_GetStyleBits(values: ServoStyleContextBorrowed) -> u64 { pub extern "C" fn Servo_ComputedValues_GetStyleBits(values: ComputedStyleBorrowed) -> u64 {
use style::properties::computed_value_flags::ComputedValueFlags; use style::properties::computed_value_flags::ComputedValueFlags;
// FIXME(emilio): We could do this more efficiently I'm quite sure. // FIXME(emilio): We could do this more efficiently I'm quite sure.
let flags = values.flags; let flags = values.flags;
@ -2550,7 +2550,7 @@ pub extern "C" fn Servo_ComputedValues_GetStyleBits(values: ServoStyleContextBor
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ComputedValues_SpecifiesAnimationsOrTransitions( pub extern "C" fn Servo_ComputedValues_SpecifiesAnimationsOrTransitions(
values: ServoStyleContextBorrowed, values: ComputedStyleBorrowed,
) -> bool { ) -> bool {
let b = values.get_box(); let b = values.get_box();
b.specifies_animations() || b.specifies_transitions() b.specifies_animations() || b.specifies_transitions()
@ -2566,7 +2566,7 @@ pub extern "C" fn Servo_ComputedValues_EqualCustomProperties(
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ComputedValues_GetStyleRuleList( pub extern "C" fn Servo_ComputedValues_GetStyleRuleList(
values: ServoStyleContextBorrowed, values: ComputedStyleBorrowed,
rules: RawGeckoServoStyleRuleListBorrowedMut, rules: RawGeckoServoStyleRuleListBorrowedMut,
) { ) {
let rule_node = match values.rules { let rule_node = match values.rules {
@ -2839,7 +2839,7 @@ pub extern "C" fn Servo_DeclarationBlock_GetCssText(declarations: RawServoDeclar
pub extern "C" fn Servo_DeclarationBlock_SerializeOneValue( pub extern "C" fn Servo_DeclarationBlock_SerializeOneValue(
declarations: RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
property_id: nsCSSPropertyID, buffer: *mut nsAString, property_id: nsCSSPropertyID, buffer: *mut nsAString,
computed_values: ServoStyleContextBorrowedOrNull, computed_values: ComputedStyleBorrowedOrNull,
custom_properties: RawServoDeclarationBlockBorrowedOrNull, custom_properties: RawServoDeclarationBlockBorrowedOrNull,
) { ) {
let property_id = get_property_id_from_nscsspropertyid!(property_id, ()); let property_id = get_property_id_from_nscsspropertyid!(property_id, ());
@ -3682,7 +3682,7 @@ pub extern "C" fn Servo_TakeChangeHint(
pub extern "C" fn Servo_ResolveStyle( pub extern "C" fn Servo_ResolveStyle(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
_raw_data: RawServoStyleSetBorrowed, _raw_data: RawServoStyleSetBorrowed,
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
let element = GeckoElement(element); let element = GeckoElement(element);
debug!("Servo_ResolveStyle: {:?}", element); debug!("Servo_ResolveStyle: {:?}", element);
let data = let data =
@ -3700,7 +3700,7 @@ pub extern "C" fn Servo_ResolveStyleLazily(
rule_inclusion: StyleRuleInclusion, rule_inclusion: StyleRuleInclusion,
snapshots: *const ServoElementSnapshotTable, snapshots: *const ServoElementSnapshotTable,
raw_data: RawServoStyleSetBorrowed, raw_data: RawServoStyleSetBorrowed,
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
debug_assert!(!snapshots.is_null()); debug_assert!(!snapshots.is_null());
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
let guard = global_style_data.shared_lock.read(); let guard = global_style_data.shared_lock.read();
@ -3775,13 +3775,13 @@ pub extern "C" fn Servo_ResolveStyleLazily(
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ReparentStyle( pub extern "C" fn Servo_ReparentStyle(
style_to_reparent: ServoStyleContextBorrowed, style_to_reparent: ComputedStyleBorrowed,
parent_style: ServoStyleContextBorrowed, parent_style: ComputedStyleBorrowed,
parent_style_ignoring_first_line: ServoStyleContextBorrowed, parent_style_ignoring_first_line: ComputedStyleBorrowed,
layout_parent_style: ServoStyleContextBorrowed, layout_parent_style: ComputedStyleBorrowed,
element: RawGeckoElementBorrowedOrNull, element: RawGeckoElementBorrowedOrNull,
raw_data: RawServoStyleSetBorrowed, raw_data: RawServoStyleSetBorrowed,
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
let guard = global_style_data.shared_lock.read(); let guard = global_style_data.shared_lock.read();
let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
@ -3891,7 +3891,7 @@ impl<'a> Iterator for PrioritizedPropertyIter<'a> {
pub extern "C" fn Servo_GetComputedKeyframeValues( pub extern "C" fn Servo_GetComputedKeyframeValues(
keyframes: RawGeckoKeyframeListBorrowed, keyframes: RawGeckoKeyframeListBorrowed,
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
style: ServoStyleContextBorrowed, style: ComputedStyleBorrowed,
raw_data: RawServoStyleSetBorrowed, raw_data: RawServoStyleSetBorrowed,
computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut
) { ) {
@ -4001,7 +4001,7 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(
pub extern "C" fn Servo_GetAnimationValues( pub extern "C" fn Servo_GetAnimationValues(
declarations: RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
style: ServoStyleContextBorrowed, style: ComputedStyleBorrowed,
raw_data: RawServoStyleSetBorrowed, raw_data: RawServoStyleSetBorrowed,
animation_values: RawGeckoServoAnimationValueListBorrowedMut, animation_values: RawGeckoServoAnimationValueListBorrowedMut,
) { ) {
@ -4044,7 +4044,7 @@ pub extern "C" fn Servo_GetAnimationValues(
pub extern "C" fn Servo_AnimationValue_Compute( pub extern "C" fn Servo_AnimationValue_Compute(
element: RawGeckoElementBorrowed, element: RawGeckoElementBorrowed,
declarations: RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
style: ServoStyleContextBorrowed, style: ComputedStyleBorrowed,
raw_data: RawServoStyleSetBorrowed, raw_data: RawServoStyleSetBorrowed,
) -> RawServoAnimationValueStrong { ) -> RawServoAnimationValueStrong {
let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
@ -4408,9 +4408,9 @@ pub extern "C" fn Servo_StyleSet_BuildFontFeatureValueSet(
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_StyleSet_ResolveForDeclarations( pub extern "C" fn Servo_StyleSet_ResolveForDeclarations(
raw_data: RawServoStyleSetBorrowed, raw_data: RawServoStyleSetBorrowed,
parent_style_context: ServoStyleContextBorrowedOrNull, parent_style_context: ComputedStyleBorrowedOrNull,
declarations: RawServoDeclarationBlockBorrowed, declarations: RawServoDeclarationBlockBorrowed,
) -> ServoStyleContextStrong { ) -> ComputedStyleStrong {
let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow(); let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
let global_style_data = &*GLOBAL_STYLE_DATA; let global_style_data = &*GLOBAL_STYLE_DATA;
let guard = global_style_data.shared_lock.read(); let guard = global_style_data.shared_lock.read();
@ -4505,7 +4505,7 @@ pub extern "C" fn Servo_StyleSet_HasDocumentStateDependency(
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn Servo_GetCustomPropertyValue( pub unsafe extern "C" fn Servo_GetCustomPropertyValue(
computed_values: ServoStyleContextBorrowed, computed_values: ComputedStyleBorrowed,
name: *const nsAString, name: *const nsAString,
value: *mut nsAString, value: *mut nsAString,
) -> bool { ) -> bool {
@ -4525,7 +4525,7 @@ pub unsafe extern "C" fn Servo_GetCustomPropertyValue(
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_GetCustomPropertiesCount(computed_values: ServoStyleContextBorrowed) -> u32 { pub extern "C" fn Servo_GetCustomPropertiesCount(computed_values: ComputedStyleBorrowed) -> u32 {
match computed_values.custom_properties() { match computed_values.custom_properties() {
Some(p) => p.len() as u32, Some(p) => p.len() as u32,
None => 0, None => 0,
@ -4534,7 +4534,7 @@ pub extern "C" fn Servo_GetCustomPropertiesCount(computed_values: ServoStyleCont
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_GetCustomPropertyNameAt( pub extern "C" fn Servo_GetCustomPropertyNameAt(
computed_values: ServoStyleContextBorrowed, computed_values: ComputedStyleBorrowed,
index: u32, index: u32,
name: *mut nsAString, name: *mut nsAString,
) -> bool { ) -> bool {