mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Rename StyleContext to ComputedStyle.
Bug: 1447483 Reviewed-by: jwatt MozReview-Commit-ID: KATZ6DkmpVY Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
2de89377db
commit
bd70c405b4
8 changed files with 148 additions and 148 deletions
|
@ -116,19 +116,19 @@ pub unsafe extern "C" fn Servo_RuleNode_Release(obj: &RawServoRuleNode) {
|
|||
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,
|
||||
// since it gives us a way to construct an Arc<ServoStyleContext> from
|
||||
// an &ServoStyleContext, which in general is not allowed. So we
|
||||
// since it gives us a way to construct an Arc<ComputedStyle> from
|
||||
// an &ComputedStyle, which in general is not allowed. So we
|
||||
// implement the restricted set of arc type functionality we need.
|
||||
|
||||
#[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());
|
||||
}
|
||||
|
||||
#[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>| {
|
||||
let _: Arc<ComputedValues> = ptr::read(a);
|
||||
});
|
||||
|
|
|
@ -5,8 +5,8 @@ use gecko_bindings::structs::nsStyleTransformMatrix;
|
|||
use gecko_bindings::structs::nsTArray;
|
||||
type nsACString_internal = nsACString;
|
||||
type nsAString_internal = nsAString;
|
||||
pub type ServoStyleContextBorrowed<'a> = &'a ::properties::ComputedValues;
|
||||
pub type ServoStyleContextBorrowedOrNull<'a> = Option<&'a ::properties::ComputedValues>;
|
||||
pub type ComputedStyleBorrowed<'a> = &'a ::properties::ComputedValues;
|
||||
pub type ComputedStyleBorrowedOrNull<'a> = Option<&'a ::properties::ComputedValues>;
|
||||
pub type ServoComputedDataBorrowed<'a> = &'a ServoComputedData;
|
||||
pub type RawServoAnimationValueTableBorrowed<'a> = &'a ();
|
||||
use gecko_bindings::structs::mozilla::css::GridTemplateAreasValue;
|
||||
|
@ -118,9 +118,9 @@ unsafe impl Sync for nsStyleContentData_CounterFunction {}
|
|||
use gecko_bindings::structs::nsStyleContentType;
|
||||
unsafe impl Send for nsStyleContentType {}
|
||||
unsafe impl Sync for nsStyleContentType {}
|
||||
use gecko_bindings::structs::nsStyleContext;
|
||||
unsafe impl Send for nsStyleContext {}
|
||||
unsafe impl Sync for nsStyleContext {}
|
||||
use gecko_bindings::structs::ComputedStyle;
|
||||
unsafe impl Send for ComputedStyle {}
|
||||
unsafe impl Sync for ComputedStyle {}
|
||||
use gecko_bindings::structs::nsStyleCoord;
|
||||
unsafe impl Send for nsStyleCoord {}
|
||||
unsafe impl Sync for nsStyleCoord {}
|
||||
|
@ -238,8 +238,8 @@ use gecko_bindings::structs::LoaderReusableStyleSheets;
|
|||
use gecko_bindings::structs::SheetLoadData;
|
||||
use gecko_bindings::structs::ServoStyleSheet;
|
||||
use gecko_bindings::structs::ServoComputedData;
|
||||
use gecko_bindings::structs::ServoStyleContext;
|
||||
use gecko_bindings::structs::ServoStyleContextStrong;
|
||||
use gecko_bindings::structs::ComputedStyle;
|
||||
use gecko_bindings::structs::ComputedStyleStrong;
|
||||
use gecko_bindings::structs::EffectCompositor_CascadeLevel;
|
||||
use gecko_bindings::structs::UpdateAnimationsTasks;
|
||||
use gecko_bindings::structs::ParsingMode;
|
||||
|
@ -586,9 +586,9 @@ extern "C" {
|
|||
pub fn Gecko_DestroyAnonymousContentList(anon_content: *mut nsTArray<*mut nsIContent>);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_ServoStyleContext_Init(
|
||||
context: *mut ServoStyleContext,
|
||||
parent_context: ServoStyleContextBorrowedOrNull,
|
||||
pub fn Gecko_ComputedStyle_Init(
|
||||
context: *mut ComputedStyle,
|
||||
parent_context: ComputedStyleBorrowedOrNull,
|
||||
pres_context: RawGeckoPresContextBorrowed,
|
||||
values: ServoComputedDataBorrowed,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
|
@ -596,7 +596,7 @@ extern "C" {
|
|||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_ServoStyleContext_Destroy(context: *mut ServoStyleContext);
|
||||
pub fn Gecko_ComputedStyle_Destroy(context: *mut ComputedStyle);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_ConstructStyleChildrenIterator(
|
||||
|
@ -879,8 +879,8 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Gecko_UpdateAnimations(
|
||||
aElementOrPseudo: RawGeckoElementBorrowed,
|
||||
aOldComputedValues: ServoStyleContextBorrowedOrNull,
|
||||
aComputedValues: ServoStyleContextBorrowedOrNull,
|
||||
aOldComputedValues: ComputedStyleBorrowedOrNull,
|
||||
aComputedValues: ComputedStyleBorrowedOrNull,
|
||||
aTasks: UpdateAnimationsTasks,
|
||||
);
|
||||
}
|
||||
|
@ -1173,8 +1173,8 @@ extern "C" {
|
|||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_CalcStyleDifference(
|
||||
old_style: ServoStyleContextBorrowed,
|
||||
new_style: ServoStyleContextBorrowed,
|
||||
old_style: ComputedStyleBorrowed,
|
||||
new_style: ComputedStyleBorrowed,
|
||||
any_style_changed: *mut bool,
|
||||
reset_only_changed: *mut bool,
|
||||
) -> u32;
|
||||
|
@ -1989,7 +1989,7 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Servo_Element_GetPrimaryComputedValues(
|
||||
node: RawGeckoElementBorrowed,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_Element_HasPseudoComputedValues(
|
||||
|
@ -2001,7 +2001,7 @@ extern "C" {
|
|||
pub fn Servo_Element_GetPseudoComputedValues(
|
||||
node: RawGeckoElementBorrowed,
|
||||
index: usize,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_Element_IsDisplayNone(element: RawGeckoElementBorrowed) -> bool;
|
||||
|
@ -2160,9 +2160,9 @@ extern "C" {
|
|||
extern "C" {
|
||||
pub fn Servo_StyleSet_ResolveForDeclarations(
|
||||
set: RawServoStyleSetBorrowed,
|
||||
parent_style: ServoStyleContextBorrowedOrNull,
|
||||
parent_style: ComputedStyleBorrowedOrNull,
|
||||
declarations: RawServoDeclarationBlockBorrowed,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_SelectorList_Parse(selector_list: *const nsACString) -> *mut RawServoSelectorList;
|
||||
|
@ -2257,10 +2257,10 @@ extern "C" {
|
|||
) -> usize;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleContext_AddRef(ctx: ServoStyleContextBorrowed);
|
||||
pub fn Servo_ComputedStyle_AddRef(ctx: ComputedStyleBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleContext_Release(ctx: ServoStyleContextBorrowed);
|
||||
pub fn Servo_ComputedStyle_Release(ctx: ComputedStyleBorrowed);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_MightHaveAttributeDependency(
|
||||
|
@ -2637,20 +2637,20 @@ extern "C" {
|
|||
pub fn Servo_GetComputedKeyframeValues(
|
||||
keyframes: RawGeckoKeyframeListBorrowed,
|
||||
element: RawGeckoElementBorrowed,
|
||||
style: ServoStyleContextBorrowed,
|
||||
style: ComputedStyleBorrowed,
|
||||
set: RawServoStyleSetBorrowed,
|
||||
result: RawGeckoComputedKeyframeValuesListBorrowedMut,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ComputedValues_ExtractAnimationValue(
|
||||
computed_values: ServoStyleContextBorrowed,
|
||||
computed_values: ComputedStyleBorrowed,
|
||||
property: nsCSSPropertyID,
|
||||
) -> RawServoAnimationValueStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ComputedValues_SpecifiesAnimationsOrTransitions(
|
||||
computed_values: ServoStyleContextBorrowed,
|
||||
computed_values: ComputedStyleBorrowed,
|
||||
) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -2682,7 +2682,7 @@ extern "C" {
|
|||
pub fn Servo_GetAnimationValues(
|
||||
declarations: RawServoDeclarationBlockBorrowed,
|
||||
element: RawGeckoElementBorrowed,
|
||||
style: ServoStyleContextBorrowed,
|
||||
style: ComputedStyleBorrowed,
|
||||
style_set: RawServoStyleSetBorrowed,
|
||||
animation_values: RawGeckoServoAnimationValueListBorrowedMut,
|
||||
);
|
||||
|
@ -2770,7 +2770,7 @@ extern "C" {
|
|||
pub fn Servo_AnimationValue_Compute(
|
||||
element: RawGeckoElementBorrowed,
|
||||
declarations: RawServoDeclarationBlockBorrowed,
|
||||
style: ServoStyleContextBorrowed,
|
||||
style: ComputedStyleBorrowed,
|
||||
raw_data: RawServoStyleSetBorrowed,
|
||||
) -> RawServoAnimationValueStrong;
|
||||
}
|
||||
|
@ -2807,7 +2807,7 @@ extern "C" {
|
|||
declarations: RawServoDeclarationBlockBorrowed,
|
||||
property: nsCSSPropertyID,
|
||||
buffer: *mut nsAString,
|
||||
computed_values: ServoStyleContextBorrowedOrNull,
|
||||
computed_values: ComputedStyleBorrowedOrNull,
|
||||
custom_properties: RawServoDeclarationBlockBorrowedOrNull,
|
||||
);
|
||||
}
|
||||
|
@ -3049,21 +3049,21 @@ extern "C" {
|
|||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ComputedValues_GetForAnonymousBox(
|
||||
parent_style_or_null: ServoStyleContextBorrowedOrNull,
|
||||
parent_style_or_null: ComputedStyleBorrowedOrNull,
|
||||
pseudo_tag: *mut nsAtom,
|
||||
set: RawServoStyleSetBorrowed,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ComputedValues_Inherit(
|
||||
set: RawServoStyleSetBorrowed,
|
||||
pseudo_tag: *mut nsAtom,
|
||||
parent_style: ServoStyleContextBorrowedOrNull,
|
||||
parent_style: ComputedStyleBorrowedOrNull,
|
||||
target: InheritTarget,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ComputedValues_GetStyleBits(values: ServoStyleContextBorrowed) -> u64;
|
||||
pub fn Servo_ComputedValues_GetStyleBits(values: ComputedStyleBorrowed) -> u64;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ComputedValues_EqualCustomProperties(
|
||||
|
@ -3073,7 +3073,7 @@ extern "C" {
|
|||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ComputedValues_GetStyleRuleList(
|
||||
values: ServoStyleContextBorrowed,
|
||||
values: ComputedStyleBorrowed,
|
||||
rules: RawGeckoServoStyleRuleListBorrowedMut,
|
||||
);
|
||||
}
|
||||
|
@ -3100,35 +3100,35 @@ extern "C" {
|
|||
pub fn Servo_ResolveStyle(
|
||||
element: RawGeckoElementBorrowed,
|
||||
set: RawServoStyleSetBorrowed,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ResolvePseudoStyle(
|
||||
element: RawGeckoElementBorrowed,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
is_probe: bool,
|
||||
inherited_style: ServoStyleContextBorrowedOrNull,
|
||||
inherited_style: ComputedStyleBorrowedOrNull,
|
||||
set: RawServoStyleSetBorrowed,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ComputedValues_ResolveXULTreePseudoStyle(
|
||||
element: RawGeckoElementBorrowed,
|
||||
pseudo_tag: *mut nsAtom,
|
||||
inherited_style: ServoStyleContextBorrowed,
|
||||
inherited_style: ComputedStyleBorrowed,
|
||||
input_word: *const AtomArray,
|
||||
set: RawServoStyleSetBorrowed,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_SetExplicitStyle(
|
||||
element: RawGeckoElementBorrowed,
|
||||
primary_style: ServoStyleContextBorrowed,
|
||||
primary_style: ComputedStyleBorrowed,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_HasAuthorSpecifiedRules(
|
||||
style: ServoStyleContextBorrowed,
|
||||
style: ComputedStyleBorrowed,
|
||||
element: RawGeckoElementBorrowed,
|
||||
pseudo_type: CSSPseudoElementType,
|
||||
rule_type_mask: u32,
|
||||
|
@ -3142,17 +3142,17 @@ extern "C" {
|
|||
rule_inclusion: StyleRuleInclusion,
|
||||
snapshots: *const ServoElementSnapshotTable,
|
||||
set: RawServoStyleSetBorrowed,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_ReparentStyle(
|
||||
style_to_reparent: ServoStyleContextBorrowed,
|
||||
parent_style: ServoStyleContextBorrowed,
|
||||
parent_style_ignoring_first_line: ServoStyleContextBorrowed,
|
||||
layout_parent_style: ServoStyleContextBorrowed,
|
||||
style_to_reparent: ComputedStyleBorrowed,
|
||||
parent_style: ComputedStyleBorrowed,
|
||||
parent_style_ignoring_first_line: ComputedStyleBorrowed,
|
||||
layout_parent_style: ComputedStyleBorrowed,
|
||||
element: RawGeckoElementBorrowedOrNull,
|
||||
set: RawServoStyleSetBorrowed,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_TraverseSubtree(
|
||||
|
@ -3175,18 +3175,18 @@ extern "C" {
|
|||
pub fn Servo_StyleSet_GetBaseComputedValuesForElement(
|
||||
set: RawServoStyleSetBorrowed,
|
||||
element: RawGeckoElementBorrowed,
|
||||
existing_style: ServoStyleContextBorrowed,
|
||||
existing_style: ComputedStyleBorrowed,
|
||||
snapshots: *const ServoElementSnapshotTable,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_GetComputedValuesByAddingAnimation(
|
||||
set: RawServoStyleSetBorrowed,
|
||||
element: RawGeckoElementBorrowed,
|
||||
existing_style: ServoStyleContextBorrowed,
|
||||
existing_style: ComputedStyleBorrowed,
|
||||
snapshots: *const ServoElementSnapshotTable,
|
||||
animation: RawServoAnimationValueBorrowed,
|
||||
) -> ServoStyleContextStrong;
|
||||
) -> ComputedStyleStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_SerializeFontValueForCanvas(
|
||||
|
@ -3196,17 +3196,17 @@ extern "C" {
|
|||
}
|
||||
extern "C" {
|
||||
pub fn Servo_GetCustomPropertyValue(
|
||||
computed_values: ServoStyleContextBorrowed,
|
||||
computed_values: ComputedStyleBorrowed,
|
||||
name: *const nsAString,
|
||||
value: *mut nsAString,
|
||||
) -> bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_GetCustomPropertiesCount(computed_values: ServoStyleContextBorrowed) -> u32;
|
||||
pub fn Servo_GetCustomPropertiesCount(computed_values: ComputedStyleBorrowed) -> u32;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_GetCustomPropertyNameAt(
|
||||
arg1: ServoStyleContextBorrowed,
|
||||
arg1: ComputedStyleBorrowed,
|
||||
index: u32,
|
||||
name: *mut nsAString,
|
||||
) -> bool;
|
||||
|
|
|
@ -15,7 +15,7 @@ pub type ServoRuleNode = Option<::rule_tree::StrongRuleNode>;
|
|||
pub type ServoVisitedStyle = Option<::servo_arc::RawOffsetArc<::properties::ComputedValues>>;
|
||||
pub type ServoComputedValueFlags = ::properties::computed_value_flags::ComputedValueFlags;
|
||||
pub type ServoRawOffsetArc<T> = ::servo_arc::RawOffsetArc<T>;
|
||||
pub type ServoStyleContextStrong = ::gecko_bindings::sugar::ownership::Strong<::properties::ComputedValues>;
|
||||
pub type ComputedStyleStrong = ::gecko_bindings::sugar::ownership::Strong<::properties::ComputedValues>;
|
||||
|
||||
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
|
||||
pub mod root {
|
||||
|
@ -1130,7 +1130,7 @@ pub mod root {
|
|||
}
|
||||
pub type Conditional_Type<A> = A;
|
||||
pub const ArenaObjectID_eArenaObjectID_DummyBeforeFirstObjectID : root :: mozilla :: ArenaObjectID = 171 ;
|
||||
pub const ArenaObjectID_eArenaObjectID_GeckoStyleContext: root::mozilla::ArenaObjectID =
|
||||
pub const ArenaObjectID_eArenaObjectID_GeckoComputedStyle: root::mozilla::ArenaObjectID =
|
||||
172;
|
||||
pub const ArenaObjectID_eArenaObjectID_nsLineBox: root::mozilla::ArenaObjectID = 173;
|
||||
pub const ArenaObjectID_eArenaObjectID_nsRuleNode: root::mozilla::ArenaObjectID = 174;
|
||||
|
@ -13399,57 +13399,57 @@ pub mod root {
|
|||
);
|
||||
}
|
||||
#[repr(C)]
|
||||
pub struct ServoStyleContext {
|
||||
pub _base: root::nsStyleContext,
|
||||
pub struct ComputedStyle {
|
||||
pub _base: root::ComputedStyle,
|
||||
pub mPresContext: *mut root::nsPresContext,
|
||||
pub mSource: root::ServoComputedData,
|
||||
pub mCachedInheritingStyles: root::mozilla::CachedInheritingStyles,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_ServoStyleContext() {
|
||||
fn bindgen_test_layout_ComputedStyle() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<ServoStyleContext>(),
|
||||
::std::mem::size_of::<ComputedStyle>(),
|
||||
248usize,
|
||||
concat!("Size of: ", stringify!(ServoStyleContext))
|
||||
concat!("Size of: ", stringify!(ComputedStyle))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<ServoStyleContext>(),
|
||||
::std::mem::align_of::<ComputedStyle>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(ServoStyleContext))
|
||||
concat!("Alignment of ", stringify!(ComputedStyle))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<ServoStyleContext>())).mPresContext as *const _ as usize
|
||||
&(*(::std::ptr::null::<ComputedStyle>())).mPresContext as *const _ as usize
|
||||
},
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ServoStyleContext),
|
||||
stringify!(ComputedStyle),
|
||||
"::",
|
||||
stringify!(mPresContext)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<ServoStyleContext>())).mSource as *const _ as usize
|
||||
&(*(::std::ptr::null::<ComputedStyle>())).mSource as *const _ as usize
|
||||
},
|
||||
24usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ServoStyleContext),
|
||||
stringify!(ComputedStyle),
|
||||
"::",
|
||||
stringify!(mSource)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<ServoStyleContext>())).mCachedInheritingStyles
|
||||
&(*(::std::ptr::null::<ComputedStyle>())).mCachedInheritingStyles
|
||||
as *const _ as usize
|
||||
},
|
||||
240usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(ServoStyleContext),
|
||||
stringify!(ComputedStyle),
|
||||
"::",
|
||||
stringify!(mCachedInheritingStyles)
|
||||
)
|
||||
|
@ -17243,7 +17243,7 @@ pub mod root {
|
|||
/// has changed whether the frame is a container for fixed-pos or abs-pos
|
||||
/// elements, but reframing is otherwise not needed.
|
||||
///
|
||||
/// Note that nsStyleContext::CalcStyleDifference adjusts results
|
||||
/// Note that ComputedStyle::CalcStyleDifference adjusts results
|
||||
/// returned by style struct CalcDifference methods to return this hint
|
||||
/// only if there was a change to whether the element's overall style
|
||||
/// indicates that it establishes a containing block.
|
||||
|
@ -24148,8 +24148,8 @@ pub mod root {
|
|||
pub type RawGeckoCSSPropertyIDList = root::nsTArray<root::nsCSSPropertyID>;
|
||||
pub type RawGeckoGfxMatrix4x4 = [root::mozilla::gfx::Float; 16usize];
|
||||
pub type RawGeckoStyleChildrenIterator = root::mozilla::dom::StyleChildrenIterator;
|
||||
pub type ServoStyleContextBorrowed = *const root::mozilla::ServoStyleContext;
|
||||
pub type ServoStyleContextBorrowedOrNull = *const root::mozilla::ServoStyleContext;
|
||||
pub type ComputedStyleBorrowed = *const root::mozilla::ComputedStyle;
|
||||
pub type ComputedStyleBorrowedOrNull = *const root::mozilla::ComputedStyle;
|
||||
pub type ServoComputedDataBorrowed = *const root::ServoComputedData;
|
||||
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
|
||||
pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode;
|
||||
|
@ -40613,7 +40613,7 @@ pub mod root {
|
|||
)
|
||||
);
|
||||
}
|
||||
/// An nsStyleContext represents the computed style data for an element.
|
||||
/// An ComputedStyle represents the computed style data for an element.
|
||||
/// The computed style data are stored in a set of structs (see
|
||||
/// nsStyleStruct.h) that are cached either on the style context or in
|
||||
/// the rule tree (see nsRuleNode.h for a description of this caching and
|
||||
|
@ -40621,7 +40621,7 @@ pub mod root {
|
|||
///
|
||||
/// Since the data in |nsIStyleRule|s and |nsRuleNode|s are immutable
|
||||
/// (with a few exceptions, like system color changes), the data in an
|
||||
/// nsStyleContext are also immutable (with the additional exception of
|
||||
/// ComputedStyle are also immutable (with the additional exception of
|
||||
/// GetUniqueStyleData). When style data change,
|
||||
/// ElementRestyler::Restyle creates a new style context.
|
||||
///
|
||||
|
@ -40632,38 +40632,38 @@ pub mod root {
|
|||
/// expectation, but it makes sense in this case)
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct nsStyleContext {
|
||||
pub struct ComputedStyle {
|
||||
pub mPseudoTag: root::RefPtr<root::nsAtom>,
|
||||
pub mBits: u64,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_nsStyleContext() {
|
||||
fn bindgen_test_layout_ComputedStyle() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<nsStyleContext>(),
|
||||
::std::mem::size_of::<ComputedStyle>(),
|
||||
16usize,
|
||||
concat!("Size of: ", stringify!(nsStyleContext))
|
||||
concat!("Size of: ", stringify!(ComputedStyle))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<nsStyleContext>(),
|
||||
::std::mem::align_of::<ComputedStyle>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(nsStyleContext))
|
||||
concat!("Alignment of ", stringify!(ComputedStyle))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<nsStyleContext>())).mPseudoTag as *const _ as usize },
|
||||
unsafe { &(*(::std::ptr::null::<ComputedStyle>())).mPseudoTag as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(nsStyleContext),
|
||||
stringify!(ComputedStyle),
|
||||
"::",
|
||||
stringify!(mPseudoTag)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<nsStyleContext>())).mBits as *const _ as usize },
|
||||
unsafe { &(*(::std::ptr::null::<ComputedStyle>())).mBits as *const _ as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(nsStyleContext),
|
||||
stringify!(ComputedStyle),
|
||||
"::",
|
||||
stringify!(mBits)
|
||||
)
|
||||
|
@ -50526,21 +50526,21 @@ pub mod root {
|
|||
);
|
||||
}
|
||||
#[test]
|
||||
fn __bindgen_test_layout_RefPtr_open0_ServoStyleContext_close0_instantiation() {
|
||||
fn __bindgen_test_layout_RefPtr_open0_ComputedStyle_close0_instantiation() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<root::RefPtr<root::mozilla::ServoStyleContext>>(),
|
||||
::std::mem::size_of::<root::RefPtr<root::mozilla::ComputedStyle>>(),
|
||||
8usize,
|
||||
concat!(
|
||||
"Size of template specialization: ",
|
||||
stringify!(root::RefPtr<root::mozilla::ServoStyleContext>)
|
||||
stringify!(root::RefPtr<root::mozilla::ComputedStyle>)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<root::RefPtr<root::mozilla::ServoStyleContext>>(),
|
||||
::std::mem::align_of::<root::RefPtr<root::mozilla::ComputedStyle>>(),
|
||||
8usize,
|
||||
concat!(
|
||||
"Alignment of template specialization: ",
|
||||
stringify!(root::RefPtr<root::mozilla::ServoStyleContext>)
|
||||
stringify!(root::RefPtr<root::mozilla::ComputedStyle>)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ pub mod style_structs {
|
|||
pub type ComputedValuesInner = ::gecko_bindings::structs::ServoComputedData;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct ComputedValues(::gecko_bindings::structs::mozilla::ServoStyleContext);
|
||||
pub struct ComputedValues(::gecko_bindings::structs::mozilla::ComputedStyle);
|
||||
|
||||
impl ComputedValues {
|
||||
pub fn new(
|
||||
|
@ -126,7 +126,7 @@ impl ComputedValues {
|
|||
pub fn pseudo(&self) -> Option<PseudoElement> {
|
||||
use string_cache::Atom;
|
||||
|
||||
let atom = (self.0)._base.mPseudoTag.mRawPtr;
|
||||
let atom = (self.0).mPseudoTag.mRawPtr;
|
||||
if atom.is_null() {
|
||||
return None;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ impl ComputedValues {
|
|||
}
|
||||
|
||||
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;
|
||||
unsafe { transmute(our_type as u8) }
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ impl ComputedValues {
|
|||
impl Drop for ComputedValues {
|
||||
fn drop(&mut self) {
|
||||
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 ParentStyleContextInfo<'a> = Option< &'a ComputedValues>;
|
||||
type ParentComputedStyleInfo<'a> = Option< &'a ComputedValues>;
|
||||
|
||||
impl ComputedValuesInner {
|
||||
pub fn new(custom_properties: Option<Arc<CustomPropertiesMap>>,
|
||||
|
@ -224,7 +224,7 @@ impl ComputedValuesInner {
|
|||
fn to_outer(
|
||||
self,
|
||||
pres_context: RawGeckoPresContextBorrowed,
|
||||
parent: ParentStyleContextInfo,
|
||||
parent: ParentComputedStyleInfo,
|
||||
info: Option<PseudoInfo>
|
||||
) -> Arc<ComputedValues> {
|
||||
let (tag, ty) = if let Some(info) = info {
|
||||
|
@ -239,13 +239,13 @@ impl ComputedValuesInner {
|
|||
unsafe fn to_outer_helper(
|
||||
self,
|
||||
pres_context: bindings::RawGeckoPresContextBorrowed,
|
||||
parent: ParentStyleContextInfo,
|
||||
parent: ParentComputedStyleInfo,
|
||||
pseudo_ty: structs::CSSPseudoElementType,
|
||||
pseudo_tag: *mut structs::nsAtom
|
||||
) -> Arc<ComputedValues> {
|
||||
let arc = {
|
||||
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,
|
||||
&self, pseudo_ty, pseudo_tag);
|
||||
// We're simulating a move by having C++ do a memcpy and then forgetting
|
||||
|
|
|
@ -2422,10 +2422,11 @@ pub struct ComputedValuesInner {
|
|||
pub struct ComputedValues {
|
||||
/// The actual computed values
|
||||
///
|
||||
/// In Gecko the outer ComputedValues is actually a style context,
|
||||
/// whereas ComputedValuesInner is the core set of computed values.
|
||||
/// In Gecko the outer ComputedValues is actually a ComputedStyle, whereas
|
||||
/// 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,
|
||||
}
|
||||
|
||||
|
|
|
@ -667,8 +667,7 @@ impl<E: TElement> StyleSharingCache<E> {
|
|||
}
|
||||
|
||||
// We do not ignore visited state here, because Gecko needs to store
|
||||
// extra bits on visited style contexts, so these contexts cannot be
|
||||
// shared.
|
||||
// extra bits on visited styles, so these contexts cannot be shared.
|
||||
if target.element.state() != candidate.state() {
|
||||
trace!("Miss: User and Author State");
|
||||
return None;
|
||||
|
|
|
@ -598,7 +598,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
|||
/// into the cascade.
|
||||
///
|
||||
/// 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`.
|
||||
pub fn adjust<E>(
|
||||
&mut self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue