stylo: Fix StyleSheetInner/Stylesheet mapping

The key of this patch is the split between Stylesheet and StylesheetContents.

Gecko will use StylesheetContents, which maps to a ServoStyleSheetInner.
This commit is contained in:
Emilio Cobos Álvarez 2017-06-28 12:12:14 -07:00
parent fd65ac8924
commit 1263075776
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
38 changed files with 3818 additions and 2931 deletions

View file

@ -24,6 +24,8 @@ use gecko_bindings::structs::RawGeckoFontFaceRuleList;
use gecko_bindings::structs::RawGeckoNode;
use gecko_bindings::structs::RawServoAnimationValue;
use gecko_bindings::structs::RawGeckoServoAnimationValueList;
use gecko_bindings::structs::RawServoMediaList;
use gecko_bindings::structs::RawServoStyleSheetContents;
use gecko_bindings::structs::RawServoDeclarationBlock;
use gecko_bindings::structs::RawServoStyleRule;
use gecko_bindings::structs::RawGeckoPresContext;
@ -305,11 +307,9 @@ pub type ServoCssRulesBorrowed<'a> = &'a ServoCssRules;
pub type ServoCssRulesBorrowedOrNull<'a> = Option<&'a ServoCssRules>;
enum ServoCssRulesVoid { }
pub struct ServoCssRules(ServoCssRulesVoid);
pub type RawServoStyleSheetStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoStyleSheet>;
pub type RawServoStyleSheetBorrowed<'a> = &'a RawServoStyleSheet;
pub type RawServoStyleSheetBorrowedOrNull<'a> = Option<&'a RawServoStyleSheet>;
enum RawServoStyleSheetVoid { }
pub struct RawServoStyleSheet(RawServoStyleSheetVoid);
pub type RawServoStyleSheetContentsStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoStyleSheetContents>;
pub type RawServoStyleSheetContentsBorrowed<'a> = &'a RawServoStyleSheetContents;
pub type RawServoStyleSheetContentsBorrowedOrNull<'a> = Option<&'a RawServoStyleSheetContents>;
pub type ServoComputedValuesStrong = ::gecko_bindings::sugar::ownership::Strong<ServoComputedValues>;
pub type ServoComputedValuesBorrowed<'a> = &'a ServoComputedValues;
pub type ServoComputedValuesBorrowedOrNull<'a> = Option<&'a ServoComputedValues>;
@ -342,8 +342,6 @@ pub struct RawServoKeyframesRule(RawServoKeyframesRuleVoid);
pub type RawServoMediaListStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoMediaList>;
pub type RawServoMediaListBorrowed<'a> = &'a RawServoMediaList;
pub type RawServoMediaListBorrowedOrNull<'a> = Option<&'a RawServoMediaList>;
enum RawServoMediaListVoid { }
pub struct RawServoMediaList(RawServoMediaListVoid);
pub type RawServoMediaRuleStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoMediaRule>;
pub type RawServoMediaRuleBorrowed<'a> = &'a RawServoMediaRule;
pub type RawServoMediaRuleBorrowedOrNull<'a> = Option<&'a RawServoMediaRule>;
@ -390,10 +388,12 @@ extern "C" {
pub fn Servo_CssRules_Release(ptr: ServoCssRulesBorrowed);
}
extern "C" {
pub fn Servo_StyleSheet_AddRef(ptr: RawServoStyleSheetBorrowed);
pub fn Servo_StyleSheetContents_AddRef(ptr:
RawServoStyleSheetContentsBorrowed);
}
extern "C" {
pub fn Servo_StyleSheet_Release(ptr: RawServoStyleSheetBorrowed);
pub fn Servo_StyleSheetContents_Release(ptr:
RawServoStyleSheetContentsBorrowed);
}
extern "C" {
pub fn Servo_ComputedValues_AddRef(ptr: ServoComputedValuesBorrowed);
@ -544,10 +544,10 @@ extern "C" {
parent: *mut ServoStyleSheet,
reusable_sheets:
*mut LoaderReusableStyleSheets,
child_sheet: RawServoStyleSheetBorrowed,
base_url_data: *mut RawGeckoURLExtraData,
url_bytes: *const u8, url_length: u32,
media_list: RawServoMediaListStrong);
media_list: RawServoMediaListStrong)
-> *mut ServoStyleSheet;
}
extern "C" {
pub fn Gecko_ElementState(element: RawGeckoElementBorrowed) -> u64;
@ -1416,6 +1416,17 @@ extern "C" {
RawGeckoPresContextBorrowed)
-> i32;
}
extern "C" {
pub fn Gecko_StyleSheet_Clone(aSheet: *const ServoStyleSheet,
aNewParentSheet: *const ServoStyleSheet)
-> *mut ServoStyleSheet;
}
extern "C" {
pub fn Gecko_StyleSheet_AddRef(aSheet: *const ServoStyleSheet);
}
extern "C" {
pub fn Gecko_StyleSheet_Release(aSheet: *const ServoStyleSheet);
}
extern "C" {
pub fn Gecko_GetMediaFeatures() -> *const nsMediaFeature;
}
@ -1813,53 +1824,41 @@ extern "C" {
extern "C" {
pub fn Servo_Element_ClearData(node: RawGeckoElementBorrowed);
}
extern "C" {
pub fn Servo_StyleSheet_Empty(parsing_mode: SheetParsingMode)
-> RawServoStyleSheetStrong;
}
extern "C" {
pub fn Servo_StyleSheet_FromUTF8Bytes(loader: *mut Loader,
gecko_stylesheet:
*mut ServoStyleSheet,
data: *const nsACString,
parsing_mode: SheetParsingMode,
media_list:
*const RawServoMediaList,
extra_data:
*mut RawGeckoURLExtraData,
line_number_offset: u32,
quirks_mode: nsCompatibility)
-> RawServoStyleSheetStrong;
-> RawServoStyleSheetContentsStrong;
}
extern "C" {
pub fn Servo_StyleSheet_ClearAndUpdate(stylesheet:
RawServoStyleSheetBorrowed,
loader: *mut Loader,
gecko_stylesheet:
*mut ServoStyleSheet,
data: *const nsACString,
extra_data:
*mut RawGeckoURLExtraData,
line_number_offset: u32,
reusable_sheets:
*mut LoaderReusableStyleSheets);
pub fn Servo_StyleSheet_Empty(parsing_mode: SheetParsingMode)
-> RawServoStyleSheetContentsStrong;
}
extern "C" {
pub fn Servo_StyleSheet_HasRules(sheet: RawServoStyleSheetBorrowed)
pub fn Servo_StyleSheet_HasRules(sheet:
RawServoStyleSheetContentsBorrowed)
-> bool;
}
extern "C" {
pub fn Servo_StyleSheet_GetRules(sheet: RawServoStyleSheetBorrowed)
pub fn Servo_StyleSheet_GetRules(sheet:
RawServoStyleSheetContentsBorrowed)
-> ServoCssRulesStrong;
}
extern "C" {
pub fn Servo_StyleSheet_Clone(sheet: RawServoStyleSheetBorrowed)
-> RawServoStyleSheetStrong;
pub fn Servo_StyleSheet_Clone(sheet: RawServoStyleSheetContentsBorrowed,
reference_sheet: *const ServoStyleSheet)
-> RawServoStyleSheetContentsStrong;
}
extern "C" {
pub fn Servo_StyleSheet_SizeOfIncludingThis(malloc_size_of: MallocSizeOf,
sheet:
RawServoStyleSheetBorrowed)
RawServoStyleSheetContentsBorrowed)
-> usize;
}
extern "C" {
@ -1882,30 +1881,26 @@ extern "C" {
}
extern "C" {
pub fn Servo_StyleSet_AppendStyleSheet(set: RawServoStyleSetBorrowed,
sheet: RawServoStyleSheetBorrowed,
unique_id: u64);
gecko_sheet:
*const ServoStyleSheet);
}
extern "C" {
pub fn Servo_StyleSet_PrependStyleSheet(set: RawServoStyleSetBorrowed,
sheet: RawServoStyleSheetBorrowed,
unique_id: u64);
gecko_sheet:
*const ServoStyleSheet);
}
extern "C" {
pub fn Servo_StyleSet_RemoveStyleSheet(set: RawServoStyleSetBorrowed,
unique_id: u64);
gecko_sheet:
*const ServoStyleSheet);
}
extern "C" {
pub fn Servo_StyleSet_InsertStyleSheetBefore(set:
RawServoStyleSetBorrowed,
sheet:
RawServoStyleSheetBorrowed,
unique_id: u64,
before_unique_id: u64);
}
extern "C" {
pub fn Servo_StyleSet_UpdateStyleSheet(set: RawServoStyleSetBorrowed,
sheet: RawServoStyleSheetBorrowed,
unique_id: u64);
gecko_sheet:
*const ServoStyleSheet,
before:
*const ServoStyleSheet);
}
extern "C" {
pub fn Servo_StyleSet_FlushStyleSheets(set: RawServoStyleSetBorrowed,
@ -1967,7 +1962,8 @@ extern "C" {
}
extern "C" {
pub fn Servo_CssRules_InsertRule(rules: ServoCssRulesBorrowed,
sheet: RawServoStyleSheetBorrowed,
sheet:
RawServoStyleSheetContentsBorrowed,
rule: *const nsACString, index: u32,
nested: bool, loader: *mut Loader,
gecko_stylesheet: *mut ServoStyleSheet,
@ -2154,7 +2150,7 @@ extern "C" {
}
extern "C" {
pub fn Servo_ImportRule_GetSheet(rule: RawServoImportRuleBorrowed)
-> *const RawServoStyleSheet;
-> *const ServoStyleSheet;
}
extern "C" {
pub fn Servo_Keyframe_GetKeyText(keyframe: RawServoKeyframeBorrowed,
@ -2197,7 +2193,8 @@ extern "C" {
}
extern "C" {
pub fn Servo_KeyframesRule_AppendRule(rule: RawServoKeyframesRuleBorrowed,
sheet: RawServoStyleSheetBorrowed,
sheet:
RawServoStyleSheetContentsBorrowed,
css: *const nsACString) -> bool;
}
extern "C" {
@ -2264,6 +2261,11 @@ extern "C" {
nsCSSPropertyID)
-> RawServoAnimationValueStrong;
}
extern "C" {
pub fn Servo_ComputedValues_SpecifiesAnimationsOrTransitions(computed_values:
ServoComputedValuesBorrowed)
-> bool;
}
extern "C" {
pub fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool;
}
@ -2679,6 +2681,10 @@ extern "C" {
set: RawServoStyleSetBorrowed)
-> ServoComputedValuesStrong;
}
extern "C" {
pub fn Servo_SetExplicitStyle(element: RawGeckoElementBorrowed,
primary_style: ServoComputedValuesBorrowed);
}
extern "C" {
pub fn Servo_HasAuthorSpecifiedRules(element: RawGeckoElementBorrowed,
rule_type_mask: u32,