diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-04-28 09:37:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-28 09:37:25 -0400 |
commit | da43a33fb11d0ebd640d5173f98be9f3571959eb (patch) | |
tree | d803a5f9180d3ab8cfbff08dcc92f3ecd71e8421 /components/style/gecko | |
parent | 625634a0275bb1ea1e918407368ab70990a728f1 (diff) | |
parent | 1eec31ace044963ff15e43e4edf2fe42aaa8ebdd (diff) | |
download | servo-da43a33fb11d0ebd640d5173f98be9f3571959eb.tar.gz servo-da43a33fb11d0ebd640d5173f98be9f3571959eb.zip |
Auto merge of #20692 - emilio:gecko-sync-next, r=emilio,Manishearth,nox
style: Sync more changes from m-c.
<!-- 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/20692)
<!-- Reviewable:end -->
Diffstat (limited to 'components/style/gecko')
-rw-r--r-- | components/style/gecko/generated/bindings.rs | 48 | ||||
-rw-r--r-- | components/style/gecko/generated/structs.rs | 517 | ||||
-rw-r--r-- | components/style/gecko/rules.rs | 108 |
3 files changed, 358 insertions, 315 deletions
diff --git a/components/style/gecko/generated/bindings.rs b/components/style/gecko/generated/bindings.rs index 508f9ce4345..d5c7443b5a3 100644 --- a/components/style/gecko/generated/bindings.rs +++ b/components/style/gecko/generated/bindings.rs @@ -232,6 +232,7 @@ use gecko_bindings::structs::nsresult; use gecko_bindings::structs::Loader; use gecko_bindings::structs::LoaderReusableStyleSheets; use gecko_bindings::structs::SheetLoadData; +use gecko_bindings::structs::SheetLoadDataHolder; use gecko_bindings::structs::ServoStyleSheet; use gecko_bindings::structs::ServoComputedData; use gecko_bindings::structs::ComputedStyleStrong; @@ -628,18 +629,36 @@ extern "C" { ) -> RawGeckoNodeBorrowedOrNull; } extern "C" { + pub fn Gecko_AddRefSheetLoadDataHolderArbitraryThread(aPtr: *mut SheetLoadDataHolder); +} +extern "C" { + pub fn Gecko_ReleaseSheetLoadDataHolderArbitraryThread(aPtr: *mut SheetLoadDataHolder); +} +extern "C" { + pub fn Gecko_StyleSheet_FinishAsyncParse( + data: *mut SheetLoadDataHolder, + sheet_contents: RawServoStyleSheetContentsStrong, + ); +} +extern "C" { pub fn Gecko_LoadStyleSheet( loader: *mut Loader, parent: *mut ServoStyleSheet, parent_load_data: *mut SheetLoadData, reusable_sheets: *mut LoaderReusableStyleSheets, - base_url_data: *mut RawGeckoURLExtraData, - url_bytes: *const u8, - url_length: u32, + url: ServoBundledURI, media_list: RawServoMediaListStrong, ) -> *mut ServoStyleSheet; } extern "C" { + pub fn Gecko_LoadStyleSheetAsync( + parent_data: *mut SheetLoadDataHolder, + url: ServoBundledURI, + media_list: RawServoMediaListStrong, + import_rule: RawServoImportRuleStrong, + ); +} +extern "C" { pub fn Gecko_ElementState(element: RawGeckoElementBorrowed) -> u64; } extern "C" { @@ -1996,8 +2015,7 @@ extern "C" { loader: *mut Loader, gecko_stylesheet: *mut ServoStyleSheet, load_data: *mut SheetLoadData, - data: *const u8, - data_len: usize, + bytes: *const nsACString, parsing_mode: SheetParsingMode, extra_data: *mut RawGeckoURLExtraData, line_number_offset: u32, @@ -2006,6 +2024,16 @@ extern "C" { ) -> RawServoStyleSheetContentsStrong; } extern "C" { + pub fn Servo_StyleSheet_FromUTF8BytesAsync( + load_data: *mut SheetLoadDataHolder, + extra_data: *mut RawGeckoURLExtraData, + bytes: *const nsACString, + parsing_mode: SheetParsingMode, + line_number_offset: u32, + quirks_mode: nsCompatibility, + ); +} +extern "C" { pub fn Servo_StyleSheet_Empty( parsing_mode: SheetParsingMode, ) -> RawServoStyleSheetContentsStrong; @@ -2513,12 +2541,22 @@ extern "C" { ) -> bool; } extern "C" { + pub fn Servo_StyleRule_SetSelectorText( + sheet: RawServoStyleSheetContentsBorrowed, + rule: RawServoStyleRuleBorrowed, + text: *const nsAString, + ) -> bool; +} +extern "C" { pub fn Servo_ImportRule_GetHref(rule: RawServoImportRuleBorrowed, result: *mut nsAString); } extern "C" { pub fn Servo_ImportRule_GetSheet(rule: RawServoImportRuleBorrowed) -> *const ServoStyleSheet; } extern "C" { + pub fn Servo_ImportRule_SetSheet(rule: RawServoImportRuleBorrowed, sheet: *mut ServoStyleSheet); +} +extern "C" { pub fn Servo_Keyframe_GetKeyText(keyframe: RawServoKeyframeBorrowed, result: *mut nsAString); } extern "C" { diff --git a/components/style/gecko/generated/structs.rs b/components/style/gecko/generated/structs.rs index ebe6b79afbc..f88b116b646 100644 --- a/components/style/gecko/generated/structs.rs +++ b/components/style/gecko/generated/structs.rs @@ -149,15 +149,15 @@ pub mod root { pub const NS_FONT_WEIGHT_NORMAL: u32 = 400; pub const NS_FONT_WEIGHT_BOLD: u32 = 700; pub const NS_FONT_WEIGHT_THIN: u32 = 100; - pub const NS_FONT_STRETCH_ULTRA_CONDENSED: i32 = -4; - pub const NS_FONT_STRETCH_EXTRA_CONDENSED: i32 = -3; - pub const NS_FONT_STRETCH_CONDENSED: i32 = -2; - pub const NS_FONT_STRETCH_SEMI_CONDENSED: i32 = -1; - pub const NS_FONT_STRETCH_NORMAL: u32 = 0; - pub const NS_FONT_STRETCH_SEMI_EXPANDED: u32 = 1; - pub const NS_FONT_STRETCH_EXPANDED: u32 = 2; - pub const NS_FONT_STRETCH_EXTRA_EXPANDED: u32 = 3; - pub const NS_FONT_STRETCH_ULTRA_EXPANDED: u32 = 4; + pub const NS_FONT_STRETCH_ULTRA_CONDENSED: u32 = 50; + pub const NS_FONT_STRETCH_EXTRA_CONDENSED: u32 = 62; + pub const NS_FONT_STRETCH_CONDENSED: u32 = 75; + pub const NS_FONT_STRETCH_SEMI_CONDENSED: u32 = 87; + pub const NS_FONT_STRETCH_NORMAL: u32 = 100; + pub const NS_FONT_STRETCH_SEMI_EXPANDED: u32 = 112; + pub const NS_FONT_STRETCH_EXPANDED: u32 = 125; + pub const NS_FONT_STRETCH_EXTRA_EXPANDED: u32 = 150; + pub const NS_FONT_STRETCH_ULTRA_EXPANDED: u32 = 200; pub const NS_FONT_SMOOTHING_AUTO: u32 = 0; pub const NS_FONT_SMOOTHING_GRAYSCALE: u32 = 1; pub const NS_FONT_KERNING_AUTO: u32 = 0; @@ -429,15 +429,15 @@ pub mod root { pub const NS_STYLE_FONT_SIZE_LARGER: u32 = 8; pub const NS_STYLE_FONT_SIZE_SMALLER: u32 = 9; pub const NS_STYLE_FONT_SIZE_NO_KEYWORD: u32 = 10; - pub const NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED: i32 = -4; - pub const NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED: i32 = -3; - pub const NS_STYLE_FONT_STRETCH_CONDENSED: i32 = -2; - pub const NS_STYLE_FONT_STRETCH_SEMI_CONDENSED: i32 = -1; - pub const NS_STYLE_FONT_STRETCH_NORMAL: u32 = 0; - pub const NS_STYLE_FONT_STRETCH_SEMI_EXPANDED: u32 = 1; - pub const NS_STYLE_FONT_STRETCH_EXPANDED: u32 = 2; - pub const NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED: u32 = 3; - pub const NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED: u32 = 4; + pub const NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED: u32 = 50; + pub const NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED: u32 = 62; + pub const NS_STYLE_FONT_STRETCH_CONDENSED: u32 = 75; + pub const NS_STYLE_FONT_STRETCH_SEMI_CONDENSED: u32 = 87; + pub const NS_STYLE_FONT_STRETCH_NORMAL: u32 = 100; + pub const NS_STYLE_FONT_STRETCH_SEMI_EXPANDED: u32 = 112; + pub const NS_STYLE_FONT_STRETCH_EXPANDED: u32 = 125; + pub const NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED: u32 = 150; + pub const NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED: u32 = 200; pub const NS_STYLE_FONT_CAPTION: u32 = 1; pub const NS_STYLE_FONT_ICON: u32 = 2; pub const NS_STYLE_FONT_MENU: u32 = 3; @@ -6471,6 +6471,8 @@ pub mod root { __bindgen_bitfield_unit } } + pub type SheetLoadDataHolder = + root::nsMainThreadPtrHolder<root::mozilla::css::SheetLoadData>; #[repr(C)] #[derive(Debug, Copy)] pub struct ImageLoader { @@ -17422,6 +17424,16 @@ pub mod root { ); } #[repr(C)] + #[derive(Debug)] + pub struct nsMainThreadPtrHolder<T> { + pub mRefCnt: root::mozilla::ThreadSafeAutoRefCnt, + pub mRawPtr: *mut T, + pub mStrict: bool, + pub mMainThreadEventTarget: root::nsCOMPtr, + pub mName: *const ::std::os::raw::c_char, + pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>, + } + #[repr(C)] #[derive(Debug, Copy)] pub struct nsISerializable { pub _base: root::nsISupports, @@ -18354,18 +18366,6 @@ pub mod root { pub type nsRefPtrHashKey_KeyTypePointer<T> = *mut T; pub const nsRefPtrHashKey_ALLOW_MEMMOVE: root::nsRefPtrHashKey__bindgen_ty_1 = 0; pub type nsRefPtrHashKey__bindgen_ty_1 = i32; - pub const nsCSSPropertyID_eCSSProperty_COUNT_no_shorthands: root::nsCSSPropertyID = - nsCSSPropertyID::eCSSProperty_all; - pub const nsCSSPropertyID_eCSSProperty_COUNT_DUMMY: root::nsCSSPropertyID = - nsCSSPropertyID::eCSSProperty_z_index; - pub const nsCSSPropertyID_eCSSProperty_COUNT: root::nsCSSPropertyID = - nsCSSPropertyID::eCSSPropertyAlias_WordWrap; - pub const nsCSSPropertyID_eCSSProperty_COUNT_DUMMY2: root::nsCSSPropertyID = - nsCSSPropertyID::eCSSProperty_transition; - pub const nsCSSPropertyID_eCSSProperty_COUNT_with_aliases: root::nsCSSPropertyID = - nsCSSPropertyID::eCSSPropertyExtra_no_properties; - pub const nsCSSPropertyID_eCSSProperty_COUNT_DUMMY3: root::nsCSSPropertyID = - nsCSSPropertyID::eCSSPropertyAlias_WebkitMaskSize; #[repr(i32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum nsCSSPropertyID { @@ -18516,11 +18516,11 @@ pub mod root { eCSSProperty_grid_template_rows = 143, eCSSProperty_height = 144, eCSSProperty_hyphens = 145, - eCSSProperty_initial_letter = 146, - eCSSProperty_image_orientation = 147, - eCSSProperty__moz_image_region = 148, - eCSSProperty_image_rendering = 149, - eCSSProperty_ime_mode = 150, + eCSSProperty_image_orientation = 146, + eCSSProperty__moz_image_region = 147, + eCSSProperty_image_rendering = 148, + eCSSProperty_ime_mode = 149, + eCSSProperty_initial_letter = 150, eCSSProperty_inline_size = 151, eCSSProperty_isolation = 152, eCSSProperty_justify_content = 153, @@ -18587,113 +18587,113 @@ pub mod root { eCSSProperty_outline_width = 214, eCSSProperty_overflow_clip_box_block = 215, eCSSProperty_overflow_clip_box_inline = 216, - eCSSProperty_overflow_x = 217, - eCSSProperty_overflow_y = 218, - eCSSProperty_padding_block_end = 219, - eCSSProperty_padding_block_start = 220, - eCSSProperty_padding_bottom = 221, - eCSSProperty_padding_inline_end = 222, - eCSSProperty_padding_inline_start = 223, - eCSSProperty_padding_left = 224, - eCSSProperty_padding_right = 225, - eCSSProperty_padding_top = 226, - eCSSProperty_page_break_after = 227, - eCSSProperty_page_break_before = 228, - eCSSProperty_page_break_inside = 229, - eCSSProperty_paint_order = 230, - eCSSProperty_perspective = 231, - eCSSProperty_perspective_origin = 232, - eCSSProperty_pointer_events = 233, - eCSSProperty_position = 234, - eCSSProperty_quotes = 235, - eCSSProperty_resize = 236, - eCSSProperty_right = 237, - eCSSProperty_rotate = 238, - eCSSProperty_ruby_align = 239, - eCSSProperty_ruby_position = 240, - eCSSProperty__moz_script_level = 241, - eCSSProperty__moz_script_min_size = 242, - eCSSProperty__moz_script_size_multiplier = 243, - eCSSProperty_scroll_behavior = 244, - eCSSProperty_overscroll_behavior_x = 245, - eCSSProperty_overscroll_behavior_y = 246, - eCSSProperty_scroll_snap_coordinate = 247, - eCSSProperty_scroll_snap_destination = 248, - eCSSProperty_scroll_snap_points_x = 249, - eCSSProperty_scroll_snap_points_y = 250, - eCSSProperty_scroll_snap_type_x = 251, - eCSSProperty_scroll_snap_type_y = 252, - eCSSProperty_shape_image_threshold = 253, - eCSSProperty_shape_outside = 254, - eCSSProperty_shape_rendering = 255, - eCSSProperty__x_span = 256, - eCSSProperty__moz_stack_sizing = 257, - eCSSProperty_stop_color = 258, - eCSSProperty_stop_opacity = 259, - eCSSProperty_stroke = 260, - eCSSProperty_stroke_dasharray = 261, - eCSSProperty_stroke_dashoffset = 262, - eCSSProperty_stroke_linecap = 263, - eCSSProperty_stroke_linejoin = 264, - eCSSProperty_stroke_miterlimit = 265, - eCSSProperty_stroke_opacity = 266, - eCSSProperty_stroke_width = 267, - eCSSProperty__moz_tab_size = 268, - eCSSProperty_table_layout = 269, - eCSSProperty_text_align = 270, - eCSSProperty_text_align_last = 271, - eCSSProperty_text_anchor = 272, - eCSSProperty_text_combine_upright = 273, - eCSSProperty_text_decoration_color = 274, - eCSSProperty_text_decoration_line = 275, - eCSSProperty_text_decoration_style = 276, - eCSSProperty_text_emphasis_color = 277, - eCSSProperty_text_emphasis_position = 278, - eCSSProperty_text_emphasis_style = 279, - eCSSProperty__webkit_text_fill_color = 280, - eCSSProperty_text_indent = 281, - eCSSProperty_text_justify = 282, - eCSSProperty_text_orientation = 283, - eCSSProperty_text_overflow = 284, - eCSSProperty_text_rendering = 285, - eCSSProperty_text_shadow = 286, - eCSSProperty__moz_text_size_adjust = 287, - eCSSProperty__webkit_text_stroke_color = 288, - eCSSProperty__webkit_text_stroke_width = 289, - eCSSProperty_scale = 290, - eCSSProperty_text_transform = 291, - eCSSProperty__x_text_zoom = 292, - eCSSProperty_top = 293, - eCSSProperty__moz_top_layer = 294, - eCSSProperty_touch_action = 295, - eCSSProperty_transform = 296, - eCSSProperty_transform_box = 297, - eCSSProperty_transform_origin = 298, - eCSSProperty_transform_style = 299, - eCSSProperty_transition_delay = 300, - eCSSProperty_transition_duration = 301, - eCSSProperty_transition_property = 302, - eCSSProperty_transition_timing_function = 303, - eCSSProperty_translate = 304, - eCSSProperty_unicode_bidi = 305, - eCSSProperty__moz_user_focus = 306, - eCSSProperty__moz_user_input = 307, - eCSSProperty__moz_user_modify = 308, - eCSSProperty__moz_user_select = 309, - eCSSProperty_vector_effect = 310, - eCSSProperty_vertical_align = 311, - eCSSProperty_visibility = 312, - eCSSProperty_white_space = 313, - eCSSProperty_width = 314, - eCSSProperty_will_change = 315, - eCSSProperty__moz_window_dragging = 316, - eCSSProperty__moz_window_shadow = 317, + eCSSProperty_overflow_wrap = 217, + eCSSProperty_overflow_x = 218, + eCSSProperty_overflow_y = 219, + eCSSProperty_overscroll_behavior_x = 220, + eCSSProperty_overscroll_behavior_y = 221, + eCSSProperty_padding_block_end = 222, + eCSSProperty_padding_block_start = 223, + eCSSProperty_padding_bottom = 224, + eCSSProperty_padding_inline_end = 225, + eCSSProperty_padding_inline_start = 226, + eCSSProperty_padding_left = 227, + eCSSProperty_padding_right = 228, + eCSSProperty_padding_top = 229, + eCSSProperty_page_break_after = 230, + eCSSProperty_page_break_before = 231, + eCSSProperty_page_break_inside = 232, + eCSSProperty_paint_order = 233, + eCSSProperty_perspective = 234, + eCSSProperty_perspective_origin = 235, + eCSSProperty_pointer_events = 236, + eCSSProperty_position = 237, + eCSSProperty_quotes = 238, + eCSSProperty_resize = 239, + eCSSProperty_right = 240, + eCSSProperty_rotate = 241, + eCSSProperty_ruby_align = 242, + eCSSProperty_ruby_position = 243, + eCSSProperty_scale = 244, + eCSSProperty__moz_script_level = 245, + eCSSProperty__moz_script_min_size = 246, + eCSSProperty__moz_script_size_multiplier = 247, + eCSSProperty_scroll_behavior = 248, + eCSSProperty_scroll_snap_coordinate = 249, + eCSSProperty_scroll_snap_destination = 250, + eCSSProperty_scroll_snap_points_x = 251, + eCSSProperty_scroll_snap_points_y = 252, + eCSSProperty_scroll_snap_type_x = 253, + eCSSProperty_scroll_snap_type_y = 254, + eCSSProperty_shape_image_threshold = 255, + eCSSProperty_shape_outside = 256, + eCSSProperty_shape_rendering = 257, + eCSSProperty__x_span = 258, + eCSSProperty__moz_stack_sizing = 259, + eCSSProperty_stop_color = 260, + eCSSProperty_stop_opacity = 261, + eCSSProperty_stroke = 262, + eCSSProperty_stroke_dasharray = 263, + eCSSProperty_stroke_dashoffset = 264, + eCSSProperty_stroke_linecap = 265, + eCSSProperty_stroke_linejoin = 266, + eCSSProperty_stroke_miterlimit = 267, + eCSSProperty_stroke_opacity = 268, + eCSSProperty_stroke_width = 269, + eCSSProperty__moz_tab_size = 270, + eCSSProperty_table_layout = 271, + eCSSProperty_text_align = 272, + eCSSProperty_text_align_last = 273, + eCSSProperty_text_anchor = 274, + eCSSProperty_text_combine_upright = 275, + eCSSProperty_text_decoration_color = 276, + eCSSProperty_text_decoration_line = 277, + eCSSProperty_text_decoration_style = 278, + eCSSProperty_text_emphasis_color = 279, + eCSSProperty_text_emphasis_position = 280, + eCSSProperty_text_emphasis_style = 281, + eCSSProperty__webkit_text_fill_color = 282, + eCSSProperty_text_indent = 283, + eCSSProperty_text_justify = 284, + eCSSProperty_text_orientation = 285, + eCSSProperty_text_overflow = 286, + eCSSProperty_text_rendering = 287, + eCSSProperty_text_shadow = 288, + eCSSProperty__moz_text_size_adjust = 289, + eCSSProperty__webkit_text_stroke_color = 290, + eCSSProperty__webkit_text_stroke_width = 291, + eCSSProperty_text_transform = 292, + eCSSProperty__x_text_zoom = 293, + eCSSProperty_top = 294, + eCSSProperty__moz_top_layer = 295, + eCSSProperty_touch_action = 296, + eCSSProperty_transform = 297, + eCSSProperty_transform_box = 298, + eCSSProperty_transform_origin = 299, + eCSSProperty_transform_style = 300, + eCSSProperty_transition_delay = 301, + eCSSProperty_transition_duration = 302, + eCSSProperty_transition_property = 303, + eCSSProperty_transition_timing_function = 304, + eCSSProperty_translate = 305, + eCSSProperty_unicode_bidi = 306, + eCSSProperty__moz_user_focus = 307, + eCSSProperty__moz_user_input = 308, + eCSSProperty__moz_user_modify = 309, + eCSSProperty__moz_user_select = 310, + eCSSProperty_vector_effect = 311, + eCSSProperty_vertical_align = 312, + eCSSProperty_visibility = 313, + eCSSProperty_white_space = 314, + eCSSProperty_width = 315, + eCSSProperty_will_change = 316, + eCSSProperty__moz_window_dragging = 317, eCSSProperty__moz_window_opacity = 318, - eCSSProperty__moz_window_transform = 319, - eCSSProperty__moz_window_transform_origin = 320, - eCSSProperty_word_break = 321, - eCSSProperty_word_spacing = 322, - eCSSProperty_overflow_wrap = 323, + eCSSProperty__moz_window_shadow = 319, + eCSSProperty__moz_window_transform = 320, + eCSSProperty__moz_window_transform_origin = 321, + eCSSProperty_word_break = 322, + eCSSProperty_word_spacing = 323, eCSSProperty_writing_mode = 324, eCSSProperty_z_index = 325, eCSSProperty_all = 326, @@ -18735,132 +18735,129 @@ pub mod root { eCSSProperty__moz_outline_radius = 362, eCSSProperty_overflow = 363, eCSSProperty_overflow_clip_box = 364, - eCSSProperty_padding = 365, - eCSSProperty_place_content = 366, - eCSSProperty_place_items = 367, - eCSSProperty_place_self = 368, - eCSSProperty_overscroll_behavior = 369, + eCSSProperty_overscroll_behavior = 365, + eCSSProperty_padding = 366, + eCSSProperty_place_content = 367, + eCSSProperty_place_items = 368, + eCSSProperty_place_self = 369, eCSSProperty_scroll_snap_type = 370, eCSSProperty_text_decoration = 371, eCSSProperty_text_emphasis = 372, eCSSProperty__webkit_text_stroke = 373, eCSSProperty_transition = 374, - eCSSPropertyAlias_WordWrap = 375, - eCSSPropertyAlias_MozTransform = 376, - eCSSPropertyAlias_MozTransformOrigin = 377, - eCSSPropertyAlias_MozPerspectiveOrigin = 378, - eCSSPropertyAlias_MozPerspective = 379, - eCSSPropertyAlias_MozTransformStyle = 380, - eCSSPropertyAlias_MozBackfaceVisibility = 381, - eCSSPropertyAlias_MozBorderImage = 382, - eCSSPropertyAlias_MozTransition = 383, - eCSSPropertyAlias_MozTransitionDelay = 384, - eCSSPropertyAlias_MozTransitionDuration = 385, - eCSSPropertyAlias_MozTransitionProperty = 386, - eCSSPropertyAlias_MozTransitionTimingFunction = 387, - eCSSPropertyAlias_MozAnimation = 388, - eCSSPropertyAlias_MozAnimationDelay = 389, - eCSSPropertyAlias_MozAnimationDirection = 390, - eCSSPropertyAlias_MozAnimationDuration = 391, - eCSSPropertyAlias_MozAnimationFillMode = 392, - eCSSPropertyAlias_MozAnimationIterationCount = 393, - eCSSPropertyAlias_MozAnimationName = 394, - eCSSPropertyAlias_MozAnimationPlayState = 395, - eCSSPropertyAlias_MozAnimationTimingFunction = 396, - eCSSPropertyAlias_MozBoxSizing = 397, - eCSSPropertyAlias_MozFontFeatureSettings = 398, - eCSSPropertyAlias_MozFontLanguageOverride = 399, - eCSSPropertyAlias_MozPaddingEnd = 400, - eCSSPropertyAlias_MozPaddingStart = 401, - eCSSPropertyAlias_MozMarginEnd = 402, - eCSSPropertyAlias_MozMarginStart = 403, - eCSSPropertyAlias_MozBorderEnd = 404, - eCSSPropertyAlias_MozBorderEndColor = 405, - eCSSPropertyAlias_MozBorderEndStyle = 406, - eCSSPropertyAlias_MozBorderEndWidth = 407, - eCSSPropertyAlias_MozBorderStart = 408, - eCSSPropertyAlias_MozBorderStartColor = 409, - eCSSPropertyAlias_MozBorderStartStyle = 410, - eCSSPropertyAlias_MozBorderStartWidth = 411, - eCSSPropertyAlias_MozHyphens = 412, - eCSSPropertyAlias_MozColumnCount = 413, - eCSSPropertyAlias_MozColumnFill = 414, - eCSSPropertyAlias_MozColumnGap = 415, - eCSSPropertyAlias_MozColumnRule = 416, - eCSSPropertyAlias_MozColumnRuleColor = 417, - eCSSPropertyAlias_MozColumnRuleStyle = 418, - eCSSPropertyAlias_MozColumnRuleWidth = 419, - eCSSPropertyAlias_MozColumnSpan = 420, - eCSSPropertyAlias_MozColumnWidth = 421, - eCSSPropertyAlias_MozColumns = 422, - eCSSPropertyAlias_WebkitAnimation = 423, - eCSSPropertyAlias_WebkitAnimationDelay = 424, - eCSSPropertyAlias_WebkitAnimationDirection = 425, - eCSSPropertyAlias_WebkitAnimationDuration = 426, - eCSSPropertyAlias_WebkitAnimationFillMode = 427, - eCSSPropertyAlias_WebkitAnimationIterationCount = 428, - eCSSPropertyAlias_WebkitAnimationName = 429, - eCSSPropertyAlias_WebkitAnimationPlayState = 430, - eCSSPropertyAlias_WebkitAnimationTimingFunction = 431, - eCSSPropertyAlias_WebkitFilter = 432, - eCSSPropertyAlias_WebkitTextSizeAdjust = 433, - eCSSPropertyAlias_WebkitTransform = 434, - eCSSPropertyAlias_WebkitTransformOrigin = 435, - eCSSPropertyAlias_WebkitTransformStyle = 436, - eCSSPropertyAlias_WebkitBackfaceVisibility = 437, - eCSSPropertyAlias_WebkitPerspective = 438, - eCSSPropertyAlias_WebkitPerspectiveOrigin = 439, - eCSSPropertyAlias_WebkitTransition = 440, - eCSSPropertyAlias_WebkitTransitionDelay = 441, - eCSSPropertyAlias_WebkitTransitionDuration = 442, - eCSSPropertyAlias_WebkitTransitionProperty = 443, - eCSSPropertyAlias_WebkitTransitionTimingFunction = 444, - eCSSPropertyAlias_WebkitBorderRadius = 445, - eCSSPropertyAlias_WebkitBorderTopLeftRadius = 446, - eCSSPropertyAlias_WebkitBorderTopRightRadius = 447, - eCSSPropertyAlias_WebkitBorderBottomLeftRadius = 448, - eCSSPropertyAlias_WebkitBorderBottomRightRadius = 449, - eCSSPropertyAlias_WebkitBackgroundClip = 450, - eCSSPropertyAlias_WebkitBackgroundOrigin = 451, - eCSSPropertyAlias_WebkitBackgroundSize = 452, - eCSSPropertyAlias_WebkitBorderImage = 453, - eCSSPropertyAlias_WebkitBoxShadow = 454, - eCSSPropertyAlias_WebkitBoxSizing = 455, - eCSSPropertyAlias_WebkitBoxFlex = 456, - eCSSPropertyAlias_WebkitBoxOrdinalGroup = 457, - eCSSPropertyAlias_WebkitBoxOrient = 458, - eCSSPropertyAlias_WebkitBoxDirection = 459, - eCSSPropertyAlias_WebkitBoxAlign = 460, - eCSSPropertyAlias_WebkitBoxPack = 461, - eCSSPropertyAlias_WebkitFlexDirection = 462, - eCSSPropertyAlias_WebkitFlexWrap = 463, - eCSSPropertyAlias_WebkitFlexFlow = 464, - eCSSPropertyAlias_WebkitOrder = 465, - eCSSPropertyAlias_WebkitFlex = 466, - eCSSPropertyAlias_WebkitFlexGrow = 467, - eCSSPropertyAlias_WebkitFlexShrink = 468, - eCSSPropertyAlias_WebkitFlexBasis = 469, - eCSSPropertyAlias_WebkitJustifyContent = 470, - eCSSPropertyAlias_WebkitAlignItems = 471, - eCSSPropertyAlias_WebkitAlignSelf = 472, - eCSSPropertyAlias_WebkitAlignContent = 473, - eCSSPropertyAlias_WebkitUserSelect = 474, - eCSSPropertyAlias_WebkitMask = 475, - eCSSPropertyAlias_WebkitMaskClip = 476, - eCSSPropertyAlias_WebkitMaskComposite = 477, - eCSSPropertyAlias_WebkitMaskImage = 478, - eCSSPropertyAlias_WebkitMaskOrigin = 479, - eCSSPropertyAlias_WebkitMaskPosition = 480, - eCSSPropertyAlias_WebkitMaskPositionX = 481, - eCSSPropertyAlias_WebkitMaskPositionY = 482, - eCSSPropertyAlias_WebkitMaskRepeat = 483, - eCSSPropertyAlias_WebkitMaskSize = 484, + eCSSPropertyAlias__moz_animation = 375, + eCSSPropertyAlias__moz_animation_delay = 376, + eCSSPropertyAlias__moz_animation_direction = 377, + eCSSPropertyAlias__moz_animation_duration = 378, + eCSSPropertyAlias__moz_animation_fill_mode = 379, + eCSSPropertyAlias__moz_animation_iteration_count = 380, + eCSSPropertyAlias__moz_animation_name = 381, + eCSSPropertyAlias__moz_animation_play_state = 382, + eCSSPropertyAlias__moz_animation_timing_function = 383, + eCSSPropertyAlias__moz_backface_visibility = 384, + eCSSPropertyAlias__moz_border_end = 385, + eCSSPropertyAlias__moz_border_end_color = 386, + eCSSPropertyAlias__moz_border_end_style = 387, + eCSSPropertyAlias__moz_border_end_width = 388, + eCSSPropertyAlias__moz_border_image = 389, + eCSSPropertyAlias__moz_border_start = 390, + eCSSPropertyAlias__moz_border_start_color = 391, + eCSSPropertyAlias__moz_border_start_style = 392, + eCSSPropertyAlias__moz_border_start_width = 393, + eCSSPropertyAlias__moz_box_sizing = 394, + eCSSPropertyAlias__moz_column_count = 395, + eCSSPropertyAlias__moz_column_fill = 396, + eCSSPropertyAlias__moz_column_gap = 397, + eCSSPropertyAlias__moz_column_rule = 398, + eCSSPropertyAlias__moz_column_rule_color = 399, + eCSSPropertyAlias__moz_column_rule_style = 400, + eCSSPropertyAlias__moz_column_rule_width = 401, + eCSSPropertyAlias__moz_column_span = 402, + eCSSPropertyAlias__moz_column_width = 403, + eCSSPropertyAlias__moz_columns = 404, + eCSSPropertyAlias__moz_font_feature_settings = 405, + eCSSPropertyAlias__moz_font_language_override = 406, + eCSSPropertyAlias__moz_hyphens = 407, + eCSSPropertyAlias__moz_margin_end = 408, + eCSSPropertyAlias__moz_margin_start = 409, + eCSSPropertyAlias__moz_padding_end = 410, + eCSSPropertyAlias__moz_padding_start = 411, + eCSSPropertyAlias__moz_perspective = 412, + eCSSPropertyAlias__moz_perspective_origin = 413, + eCSSPropertyAlias__moz_transform = 414, + eCSSPropertyAlias__moz_transform_origin = 415, + eCSSPropertyAlias__moz_transform_style = 416, + eCSSPropertyAlias__moz_transition = 417, + eCSSPropertyAlias__moz_transition_delay = 418, + eCSSPropertyAlias__moz_transition_duration = 419, + eCSSPropertyAlias__moz_transition_property = 420, + eCSSPropertyAlias__moz_transition_timing_function = 421, + eCSSPropertyAlias__webkit_align_content = 422, + eCSSPropertyAlias__webkit_align_items = 423, + eCSSPropertyAlias__webkit_align_self = 424, + eCSSPropertyAlias__webkit_animation = 425, + eCSSPropertyAlias__webkit_animation_delay = 426, + eCSSPropertyAlias__webkit_animation_direction = 427, + eCSSPropertyAlias__webkit_animation_duration = 428, + eCSSPropertyAlias__webkit_animation_fill_mode = 429, + eCSSPropertyAlias__webkit_animation_iteration_count = 430, + eCSSPropertyAlias__webkit_animation_name = 431, + eCSSPropertyAlias__webkit_animation_play_state = 432, + eCSSPropertyAlias__webkit_animation_timing_function = 433, + eCSSPropertyAlias__webkit_backface_visibility = 434, + eCSSPropertyAlias__webkit_background_clip = 435, + eCSSPropertyAlias__webkit_background_origin = 436, + eCSSPropertyAlias__webkit_background_size = 437, + eCSSPropertyAlias__webkit_border_bottom_left_radius = 438, + eCSSPropertyAlias__webkit_border_bottom_right_radius = 439, + eCSSPropertyAlias__webkit_border_image = 440, + eCSSPropertyAlias__webkit_border_radius = 441, + eCSSPropertyAlias__webkit_border_top_left_radius = 442, + eCSSPropertyAlias__webkit_border_top_right_radius = 443, + eCSSPropertyAlias__webkit_box_align = 444, + eCSSPropertyAlias__webkit_box_direction = 445, + eCSSPropertyAlias__webkit_box_flex = 446, + eCSSPropertyAlias__webkit_box_ordinal_group = 447, + eCSSPropertyAlias__webkit_box_orient = 448, + eCSSPropertyAlias__webkit_box_pack = 449, + eCSSPropertyAlias__webkit_box_shadow = 450, + eCSSPropertyAlias__webkit_box_sizing = 451, + eCSSPropertyAlias__webkit_filter = 452, + eCSSPropertyAlias__webkit_flex = 453, + eCSSPropertyAlias__webkit_flex_basis = 454, + eCSSPropertyAlias__webkit_flex_direction = 455, + eCSSPropertyAlias__webkit_flex_flow = 456, + eCSSPropertyAlias__webkit_flex_grow = 457, + eCSSPropertyAlias__webkit_flex_shrink = 458, + eCSSPropertyAlias__webkit_flex_wrap = 459, + eCSSPropertyAlias__webkit_justify_content = 460, + eCSSPropertyAlias__webkit_mask = 461, + eCSSPropertyAlias__webkit_mask_clip = 462, + eCSSPropertyAlias__webkit_mask_composite = 463, + eCSSPropertyAlias__webkit_mask_image = 464, + eCSSPropertyAlias__webkit_mask_origin = 465, + eCSSPropertyAlias__webkit_mask_position = 466, + eCSSPropertyAlias__webkit_mask_position_x = 467, + eCSSPropertyAlias__webkit_mask_position_y = 468, + eCSSPropertyAlias__webkit_mask_repeat = 469, + eCSSPropertyAlias__webkit_mask_size = 470, + eCSSPropertyAlias__webkit_order = 471, + eCSSPropertyAlias__webkit_perspective = 472, + eCSSPropertyAlias__webkit_perspective_origin = 473, + eCSSPropertyAlias__webkit_text_size_adjust = 474, + eCSSPropertyAlias__webkit_transform = 475, + eCSSPropertyAlias__webkit_transform_origin = 476, + eCSSPropertyAlias__webkit_transform_style = 477, + eCSSPropertyAlias__webkit_transition = 478, + eCSSPropertyAlias__webkit_transition_delay = 479, + eCSSPropertyAlias__webkit_transition_duration = 480, + eCSSPropertyAlias__webkit_transition_property = 481, + eCSSPropertyAlias__webkit_transition_timing_function = 482, + eCSSPropertyAlias__webkit_user_select = 483, + eCSSPropertyAlias_word_wrap = 484, eCSSPropertyExtra_no_properties = 485, eCSSPropertyExtra_all_properties = 486, - eCSSPropertyExtra_x_none_value = 487, - eCSSPropertyExtra_x_auto_value = 488, - eCSSPropertyExtra_variable = 489, - eCSSProperty_DOM = 490, + eCSSPropertyExtra_variable = 487, } #[repr(i32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] diff --git a/components/style/gecko/rules.rs b/components/style/gecko/rules.rs index 2f144279656..a57314a418c 100644 --- a/components/style/gecko/rules.rs +++ b/components/style/gecko/rules.rs @@ -5,17 +5,18 @@ //! Bindings for CSS Rule objects use byteorder::{BigEndian, WriteBytesExt}; -use computed_values::{font_stretch, font_style, font_weight}; use counter_style::{self, CounterBound}; use cssparser::UnicodeRange; -use font_face::{FontDisplay, FontWeight, Source}; +use font_face::{FontDisplay, FontWeight, FontStretch, FontStyle, Source}; use gecko_bindings::structs::{self, nsCSSValue}; use gecko_bindings::sugar::ns_css_value::ToNsCssValue; use properties::longhands::font_language_override; use std::str; use values::computed::font::FamilyName; use values::generics::font::FontTag; +use values::specified::font::{AbsoluteFontWeight, FontStretch as SpecifiedFontStretch}; use values::specified::font::{SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings}; +use values::specified::font::SpecifiedFontStyle; impl<'a> ToNsCssValue for &'a FamilyName { fn convert(self, nscssvalue: &mut nsCSSValue) { @@ -23,19 +24,20 @@ impl<'a> ToNsCssValue for &'a FamilyName { } } -impl ToNsCssValue for font_weight::T { +impl<'a> ToNsCssValue for &'a SpecifiedFontStretch { fn convert(self, nscssvalue: &mut nsCSSValue) { - nscssvalue.set_font_weight(self.0) + let number = match *self { + SpecifiedFontStretch::Stretch(ref p) => p.get(), + SpecifiedFontStretch::Keyword(ref kw) => kw.compute().0, + SpecifiedFontStretch::System(..) => unreachable!(), + }; + nscssvalue.set_font_stretch(number); } } -impl<'a> ToNsCssValue for &'a FontWeight { +impl<'a> ToNsCssValue for &'a AbsoluteFontWeight { fn convert(self, nscssvalue: &mut nsCSSValue) { - match *self { - FontWeight::Normal => nscssvalue.set_enum(structs::NS_FONT_WEIGHT_NORMAL as i32), - FontWeight::Bold => nscssvalue.set_enum(structs::NS_FONT_WEIGHT_BOLD as i32), - FontWeight::Weight(weight) => nscssvalue.set_font_weight(weight.0), - } + nscssvalue.set_font_weight(self.compute().0) } } @@ -77,6 +79,52 @@ impl<'a> ToNsCssValue for &'a SpecifiedFontVariationSettings { } } +macro_rules! descriptor_range_conversion { + ($name:ident) => { + impl<'a> ToNsCssValue for &'a $name { + fn convert(self, nscssvalue: &mut nsCSSValue) { + let $name(ref first, ref second) = *self; + let second = match *second { + None => { + nscssvalue.set_from(first); + return; + } + Some(ref second) => second, + }; + + let mut a = nsCSSValue::null(); + let mut b = nsCSSValue::null(); + + a.set_from(first); + b.set_from(second); + + nscssvalue.set_pair(&a, &b); + } + } + } +} + +descriptor_range_conversion!(FontWeight); +descriptor_range_conversion!(FontStretch); + +impl<'a> ToNsCssValue for &'a FontStyle { + fn convert(self, nscssvalue: &mut nsCSSValue) { + match *self { + FontStyle::Normal => nscssvalue.set_normal(), + FontStyle::Italic => nscssvalue.set_enum(structs::NS_FONT_STYLE_ITALIC as i32), + FontStyle::Oblique(ref first, ref second) => { + let mut a = nsCSSValue::null(); + let mut b = nsCSSValue::null(); + + a.set_font_style(SpecifiedFontStyle::compute_angle(first).degrees()); + b.set_font_style(SpecifiedFontStyle::compute_angle(second).degrees()); + + nscssvalue.set_pair(&a, &b); + } + } + } +} + impl<'a> ToNsCssValue for &'a font_language_override::SpecifiedValue { fn convert(self, nscssvalue: &mut nsCSSValue) { match *self { @@ -90,46 +138,6 @@ impl<'a> ToNsCssValue for &'a font_language_override::SpecifiedValue { } } -macro_rules! map_enum { - ( - $( - $prop:ident { - $($servo:ident => $gecko:ident,)+ - } - )+ - ) => { - $( - impl<'a> ToNsCssValue for &'a $prop::T { - fn convert(self, nscssvalue: &mut nsCSSValue) { - nscssvalue.set_enum(match *self { - $( $prop::T::$servo => structs::$gecko as i32, )+ - }) - } - } - )+ - } -} - -map_enum! { - font_style { - Normal => NS_FONT_STYLE_NORMAL, - Italic => NS_FONT_STYLE_ITALIC, - Oblique => NS_FONT_STYLE_OBLIQUE, - } - - font_stretch { - Normal => NS_FONT_STRETCH_NORMAL, - UltraCondensed => NS_FONT_STRETCH_ULTRA_CONDENSED, - ExtraCondensed => NS_FONT_STRETCH_EXTRA_CONDENSED, - Condensed => NS_FONT_STRETCH_CONDENSED, - SemiCondensed => NS_FONT_STRETCH_SEMI_CONDENSED, - SemiExpanded => NS_FONT_STRETCH_SEMI_EXPANDED, - Expanded => NS_FONT_STRETCH_EXPANDED, - ExtraExpanded => NS_FONT_STRETCH_EXTRA_EXPANDED, - UltraExpanded => NS_FONT_STRETCH_ULTRA_EXPANDED, - } -} - impl<'a> ToNsCssValue for &'a Vec<Source> { fn convert(self, nscssvalue: &mut nsCSSValue) { let src_len = self.iter().fold(0, |acc, src| { |