mirror of
https://github.com/servo/servo.git
synced 2025-06-08 00:23:30 +00:00
style: Use cbindgen for a couple more CSS properties.
Differential Revision: https://phabricator.services.mozilla.com/D13886
This commit is contained in:
parent
499bfcb1dd
commit
626172d64c
5 changed files with 23 additions and 29 deletions
|
@ -59,5 +59,10 @@ include = [
|
||||||
"PathCommand",
|
"PathCommand",
|
||||||
"UnicodeRange",
|
"UnicodeRange",
|
||||||
"UserSelect",
|
"UserSelect",
|
||||||
|
"Float",
|
||||||
|
"OverscrollBehavior",
|
||||||
|
"ScrollSnapType",
|
||||||
|
"OverflowClipBox",
|
||||||
|
"Resize",
|
||||||
]
|
]
|
||||||
item_types = ["enums", "structs", "typedefs"]
|
item_types = ["enums", "structs", "typedefs"]
|
||||||
|
|
|
@ -1389,8 +1389,14 @@ impl Clone for ${style_struct.gecko_struct_name} {
|
||||||
|
|
||||||
# Types used with predefined_type()-defined properties that we can auto-generate.
|
# Types used with predefined_type()-defined properties that we can auto-generate.
|
||||||
predefined_types = {
|
predefined_types = {
|
||||||
|
"Appearance": impl_simple,
|
||||||
|
"OverscrollBehavior": impl_simple,
|
||||||
|
"OverflowClipBox": impl_simple,
|
||||||
|
"ScrollSnapType": impl_simple,
|
||||||
|
"Float": impl_simple,
|
||||||
"BreakBetween": impl_simple,
|
"BreakBetween": impl_simple,
|
||||||
"BreakWithin": impl_simple,
|
"BreakWithin": impl_simple,
|
||||||
|
"Resize": impl_simple,
|
||||||
"Color": impl_color,
|
"Color": impl_color,
|
||||||
"ColorOrAuto": impl_color,
|
"ColorOrAuto": impl_color,
|
||||||
"GreaterThanOrEqualToOneNumber": impl_simple,
|
"GreaterThanOrEqualToOneNumber": impl_simple,
|
||||||
|
@ -3005,20 +3011,18 @@ fn static_assert() {
|
||||||
}
|
}
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<% skip_box_longhands= """display -moz-appearance overflow-y vertical-align
|
<% skip_box_longhands= """display overflow-y vertical-align
|
||||||
animation-name animation-delay animation-duration
|
animation-name animation-delay animation-duration
|
||||||
animation-direction animation-fill-mode animation-play-state
|
animation-direction animation-fill-mode animation-play-state
|
||||||
animation-iteration-count animation-timing-function
|
animation-iteration-count animation-timing-function
|
||||||
transition-duration transition-delay
|
clear transition-duration transition-delay
|
||||||
transition-timing-function transition-property
|
transition-timing-function transition-property
|
||||||
rotate scroll-snap-points-x scroll-snap-points-y
|
rotate scroll-snap-points-x scroll-snap-points-y
|
||||||
scroll-snap-type-x scroll-snap-type-y scroll-snap-coordinate
|
scroll-snap-coordinate
|
||||||
perspective-origin -moz-binding will-change
|
perspective-origin -moz-binding will-change
|
||||||
offset-path overscroll-behavior-x overscroll-behavior-y
|
offset-path perspective-origin -moz-binding
|
||||||
overflow-clip-box-inline overflow-clip-box-block
|
will-change shape-outside contain touch-action
|
||||||
perspective-origin -moz-binding will-change
|
translate scale""" %>
|
||||||
shape-outside contain touch-action translate
|
|
||||||
scale""" %>
|
|
||||||
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
|
<%self:impl_trait style_struct_name="Box" skip_longhands="${skip_box_longhands}">
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_display(&mut self, v: longhands::display::computed_value::T) {
|
pub fn set_display(&mut self, v: longhands::display::computed_value::T) {
|
||||||
|
@ -3051,11 +3055,6 @@ fn static_assert() {
|
||||||
self.gecko.mDisplay
|
self.gecko.mDisplay
|
||||||
}
|
}
|
||||||
|
|
||||||
${impl_simple('_moz_appearance', 'mAppearance')}
|
|
||||||
|
|
||||||
<% float_keyword = Keyword("float", "Left Right None", gecko_enum_prefix="StyleFloat") %>
|
|
||||||
${impl_keyword('float', 'mFloat', float_keyword)}
|
|
||||||
|
|
||||||
<% clear_keyword = Keyword(
|
<% clear_keyword = Keyword(
|
||||||
"clear",
|
"clear",
|
||||||
"Left Right None Both",
|
"Left Right None Both",
|
||||||
|
@ -3064,9 +3063,6 @@ fn static_assert() {
|
||||||
) %>
|
) %>
|
||||||
${impl_keyword('clear', 'mBreakType', clear_keyword)}
|
${impl_keyword('clear', 'mBreakType', clear_keyword)}
|
||||||
|
|
||||||
<% resize_keyword = Keyword("resize", "None Both Horizontal Vertical") %>
|
|
||||||
${impl_keyword('resize', 'mResize', resize_keyword)}
|
|
||||||
|
|
||||||
<% overflow_x = data.longhands_by_name["overflow-x"] %>
|
<% overflow_x = data.longhands_by_name["overflow-x"] %>
|
||||||
pub fn set_overflow_y(&mut self, v: longhands::overflow_y::computed_value::T) {
|
pub fn set_overflow_y(&mut self, v: longhands::overflow_y::computed_value::T) {
|
||||||
use crate::properties::longhands::overflow_x::computed_value::T as BaseType;
|
use crate::properties::longhands::overflow_x::computed_value::T as BaseType;
|
||||||
|
@ -3398,19 +3394,6 @@ fn static_assert() {
|
||||||
|
|
||||||
${impl_animation_timing_function()}
|
${impl_animation_timing_function()}
|
||||||
|
|
||||||
<% scroll_snap_type_keyword = Keyword("scroll-snap-type", "None Mandatory Proximity") %>
|
|
||||||
${impl_keyword('scroll_snap_type_y', 'mScrollSnapTypeY', scroll_snap_type_keyword)}
|
|
||||||
${impl_keyword('scroll_snap_type_x', 'mScrollSnapTypeX', scroll_snap_type_keyword)}
|
|
||||||
|
|
||||||
<% overscroll_behavior_keyword = Keyword("overscroll-behavior", "Auto Contain None",
|
|
||||||
gecko_enum_prefix="StyleOverscrollBehavior") %>
|
|
||||||
${impl_keyword('overscroll_behavior_x', 'mOverscrollBehaviorX', overscroll_behavior_keyword)}
|
|
||||||
${impl_keyword('overscroll_behavior_y', 'mOverscrollBehaviorY', overscroll_behavior_keyword)}
|
|
||||||
|
|
||||||
<% overflow_clip_box_keyword = Keyword("overflow-clip-box", "padding-box content-box") %>
|
|
||||||
${impl_keyword('overflow_clip_box_inline', 'mOverflowClipBoxInline', overflow_clip_box_keyword)}
|
|
||||||
${impl_keyword('overflow_clip_box_block', 'mOverflowClipBoxBlock', overflow_clip_box_keyword)}
|
|
||||||
|
|
||||||
pub fn set_perspective_origin(&mut self, v: longhands::perspective_origin::computed_value::T) {
|
pub fn set_perspective_origin(&mut self, v: longhands::perspective_origin::computed_value::T) {
|
||||||
self.gecko.mPerspectiveOrigin[0].set(v.horizontal);
|
self.gecko.mPerspectiveOrigin[0].set(v.horizontal);
|
||||||
self.gecko.mPerspectiveOrigin[1].set(v.vertical);
|
self.gecko.mPerspectiveOrigin[1].set(v.vertical);
|
||||||
|
|
|
@ -574,6 +574,7 @@ ${helpers.predefined_type(
|
||||||
alias="-webkit-appearance:layout.css.webkit-appearance.enabled",
|
alias="-webkit-appearance:layout.css.webkit-appearance.enabled",
|
||||||
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance)",
|
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance)",
|
||||||
animation_value_type="discrete",
|
animation_value_type="discrete",
|
||||||
|
gecko_ffi_name="mAppearance",
|
||||||
)}
|
)}
|
||||||
|
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
|
|
|
@ -39,6 +39,7 @@ pub type Perspective = GenericPerspective<NonNegativeLength>;
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss,
|
Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToCss,
|
||||||
)]
|
)]
|
||||||
|
#[repr(u8)]
|
||||||
/// A computed value for the `float` property.
|
/// A computed value for the `float` property.
|
||||||
pub enum Float {
|
pub enum Float {
|
||||||
Left,
|
Left,
|
||||||
|
@ -157,6 +158,7 @@ impl ToComputedValue for SpecifiedClear {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToCss)]
|
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||||
|
#[repr(u8)]
|
||||||
pub enum Resize {
|
pub enum Resize {
|
||||||
None,
|
None,
|
||||||
Both,
|
Both,
|
||||||
|
|
|
@ -389,6 +389,7 @@ impl Parse for AnimationName {
|
||||||
ToComputedValue,
|
ToComputedValue,
|
||||||
ToCss,
|
ToCss,
|
||||||
)]
|
)]
|
||||||
|
#[repr(u8)]
|
||||||
pub enum ScrollSnapType {
|
pub enum ScrollSnapType {
|
||||||
None,
|
None,
|
||||||
Mandatory,
|
Mandatory,
|
||||||
|
@ -409,6 +410,7 @@ pub enum ScrollSnapType {
|
||||||
ToComputedValue,
|
ToComputedValue,
|
||||||
ToCss,
|
ToCss,
|
||||||
)]
|
)]
|
||||||
|
#[repr(u8)]
|
||||||
pub enum OverscrollBehavior {
|
pub enum OverscrollBehavior {
|
||||||
Auto,
|
Auto,
|
||||||
Contain,
|
Contain,
|
||||||
|
@ -429,6 +431,7 @@ pub enum OverscrollBehavior {
|
||||||
ToComputedValue,
|
ToComputedValue,
|
||||||
ToCss,
|
ToCss,
|
||||||
)]
|
)]
|
||||||
|
#[repr(u8)]
|
||||||
pub enum OverflowClipBox {
|
pub enum OverflowClipBox {
|
||||||
PaddingBox,
|
PaddingBox,
|
||||||
ContentBox,
|
ContentBox,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue