Bug 1368610 - Part 5: Implements properties that need to change only the animation type animatable. r?hiro
In this patch, implements following properties:
* contain
* hyphens
* outline-style
* scroll-snap-type-y
* text-align
* text-align-last
* text-justify
* -moz-text-size-adjust
* text-transform
* white-space
* word-break
* overflow-wrap
MozReview-Commit-ID: 1rzofeSd7aw
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -2591,17 +2591,17 @@ fn static_assert() {
}
${impl_animation_count('iteration_count', 'IterationCount')}
${impl_copy_animation_value('iteration_count', 'IterationCount')}
${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, need_clone=False)}
+ ${impl_keyword('scroll_snap_type_y', 'mScrollSnapTypeY', scroll_snap_type_keyword, need_clone=True)}
pub fn set_perspective_origin(&mut self, v: longhands::perspective_origin::computed_value::T) {
self.gecko.mPerspectiveOrigin[0].set(v.horizontal);
self.gecko.mPerspectiveOrigin[1].set(v.vertical);
}
pub fn copy_perspective_origin_from(&mut self, other: &Self) {
self.gecko.mPerspectiveOrigin[0].copy_from(&other.gecko.mPerspectiveOrigin[0]);
@@ -3532,17 +3532,17 @@ fn static_assert() {
vertical: Au(self.gecko.mBorderSpacingRow)
}
}
</%self:impl_trait>
<%self:impl_trait style_struct_name="InheritedText"
skip_longhands="text-align text-emphasis-style text-shadow line-height letter-spacing word-spacing
- -webkit-text-stroke-width text-emphasis-position -moz-tab-size -moz-text-size-adjust">
+ -webkit-text-stroke-width text-emphasis-position -moz-tab-size">
<% text_align_keyword = Keyword("text-align",
"start end left right center justify -moz-center -moz-left -moz-right char",
gecko_strip_moz_prefix=False) %>
${impl_keyword('text_align', 'mTextAlign', text_align_keyword, need_clone=False)}
${impl_keyword_clone('text_align', 'mTextAlign', text_align_keyword)}
pub fn set_text_shadow<I>(&mut self, v: I)
@@ -3698,21 +3698,16 @@ fn static_assert() {
}
Either::First(au) => {
self.gecko.mTabSize.set(au);
}
}
}
<%call expr="impl_coord_copy('_moz_tab_size', 'mTabSize')"></%call>
-
- <% text_size_adjust_keyword = Keyword("text-size-adjust", "auto none") %>
-
- ${impl_keyword('_moz_text_size_adjust', 'mTextSizeAdjust', text_size_adjust_keyword, need_clone=False)}
-
</%self:impl_trait>
<%self:impl_trait style_struct_name="Text"
skip_longhands="text-decoration-line text-overflow initial-letter"
skip_additionals="*">
${impl_simple_type_with_conversion("text_decoration_line")}
--- a/servo/components/style/properties/longhand/box.mako.rs
+++ b/servo/components/style/properties/longhand/box.mako.rs
@@ -1607,17 +1607,17 @@
${helpers.single_keyword("scroll-snap-type-x",
"none mandatory proximity",
products="gecko",
gecko_constant_prefix="NS_STYLE_SCROLL_SNAP_TYPE",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-x)",
animation_value_type="discrete")}
-<%helpers:longhand products="gecko" name="scroll-snap-type-y" animation_value_type="none"
+<%helpers:longhand products="gecko" name="scroll-snap-type-y" animation_value_type="discrete"
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type-x)">
pub use super::scroll_snap_type_x::SpecifiedValue;
pub use super::scroll_snap_type_x::computed_value;
pub use super::scroll_snap_type_x::get_initial_value;
pub use super::scroll_snap_type_x::parse;
</%helpers:longhand>
// Compositing and Blending Level 1
@@ -1705,17 +1705,17 @@
animation_value_type="ComputedValue",
extra_prefixes="moz webkit",
boxed=True,
spec="https://drafts.csswg.org/css-transforms/#transform-origin-property")}
// FIXME: `size` and `content` values are not implemented and `strict` is implemented
// like `content`(layout style paint) in gecko. We should implement `size` and `content`,
// also update the glue once they are implemented in gecko.
-<%helpers:longhand name="contain" animation_value_type="none" products="gecko" need_clone="True"
+<%helpers:longhand name="contain" animation_value_type="discrete" products="gecko" need_clone="True"
flags="FIXPOS_CB"
spec="https://drafts.csswg.org/css-contain/#contain-property">
use std::fmt;
use style_traits::ToCss;
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
--- a/servo/components/style/properties/longhand/inherited_text.mako.rs
+++ b/servo/components/style/properties/longhand/inherited_text.mako.rs
@@ -13,61 +13,64 @@
spec="https://drafts.csswg.org/css2/visudet.html#propdef-line-height")}
// CSS Text Module Level 3
// TODO(pcwalton): `full-width`
${helpers.single_keyword("text-transform",
"none capitalize uppercase lowercase",
extra_gecko_values="full-width",
- animation_value_type="none",
+ animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-text-transform")}
${helpers.single_keyword("hyphens", "manual none auto",
gecko_enum_prefix="StyleHyphens",
- products="gecko", animation_value_type="none", extra_prefixes="moz",
+ gecko_inexhaustive=True,
+ products="gecko", animation_value_type="discrete", extra_prefixes="moz",
spec="https://drafts.csswg.org/css-text/#propdef-hyphens")}
// TODO: Support <percentage>
${helpers.single_keyword("-moz-text-size-adjust", "auto none",
gecko_constant_prefix="NS_STYLE_TEXT_SIZE_ADJUST",
- products="gecko", animation_value_type="none",
+ gecko_ffi_name="mTextSizeAdjust",
+ products="gecko", animation_value_type="discrete",
spec="https://drafts.csswg.org/css-size-adjust/#adjustment-control",
alias="-webkit-text-size-adjust")}
${helpers.predefined_type("text-indent",
"LengthOrPercentage",
"computed::LengthOrPercentage::Length(Au(0))",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-text/#propdef-text-indent",
allow_quirks=True)}
// Also known as "word-wrap" (which is more popular because of IE), but this is the preferred
// name per CSS-TEXT 6.2.
${helpers.single_keyword("overflow-wrap",
"normal break-word",
gecko_constant_prefix="NS_STYLE_OVERFLOWWRAP",
- animation_value_type="none",
+ animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-overflow-wrap",
alias="word-wrap")}
// TODO(pcwalton): Support `word-break: keep-all` once we have better CJK support.
${helpers.single_keyword("word-break",
"normal break-all keep-all",
gecko_constant_prefix="NS_STYLE_WORDBREAK",
- animation_value_type="none",
+ animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-word-break")}
// TODO(pcwalton): Support `text-justify: distribute`.
<%helpers:single_keyword_computed name="text-justify"
values="auto none inter-word"
extra_gecko_values="inter-character"
extra_specified="${'distribute' if product == 'gecko' else ''}"
gecko_enum_prefix="StyleTextJustify"
- animation_value_type="none"
+ gecko_inexhaustive="True"
+ animation_value_type="discrete"
spec="https://drafts.csswg.org/css-text/#propdef-text-justify">
no_viewport_percentage!(SpecifiedValue);
impl ToComputedValue for SpecifiedValue {
type ComputedValue = computed_value::T;
#[inline]
fn to_computed_value(&self, _: &Context) -> computed_value::T {
@@ -96,21 +99,21 @@
}
}
</%helpers:single_keyword_computed>
${helpers.single_keyword("text-align-last",
"auto start end left right center justify",
products="gecko",
gecko_constant_prefix="NS_STYLE_TEXT_ALIGN",
- animation_value_type="none",
+ animation_value_type="discrete",
spec="https://drafts.csswg.org/css-text/#propdef-text-align-last")}
// TODO make this a shorthand and implement text-align-last/text-align-all
-<%helpers:longhand name="text-align" animation_value_type="none" need_clone="True"
+<%helpers:longhand name="text-align" animation_value_type="discrete"
spec="https://drafts.csswg.org/css-text/#propdef-text-align">
no_viewport_percentage!(SpecifiedValue);
pub mod computed_value {
use style_traits::ToCss;
macro_rules! define_text_align {
( $( $name: ident ( $string: expr ) => $discriminant: expr, )+ ) => {
define_css_keyword_enum! { T:
$(
@@ -355,17 +358,18 @@
}
</%helpers:longhand>
<%helpers:single_keyword_computed name="white-space"
values="normal pre nowrap pre-wrap pre-line"
extra_gecko_values="-moz-pre-space"
gecko_enum_prefix="StyleWhiteSpace"
needs_conversion="True"
- animation_value_type="none"
+ gecko_inexhaustive="True"
+ animation_value_type="discrete"
spec="https://drafts.csswg.org/css-text/#propdef-white-space">
use values::computed::ComputedValueAsSpecified;
impl ComputedValueAsSpecified for SpecifiedValue {}
no_viewport_percentage!(SpecifiedValue);
% if product != "gecko":
impl SpecifiedValue {
pub fn allow_wrap(&self) -> bool {
--- a/servo/components/style/properties/longhand/outline.mako.rs
+++ b/servo/components/style/properties/longhand/outline.mako.rs
@@ -11,17 +11,17 @@
// TODO(pcwalton): `invert`
${helpers.predefined_type("outline-color", "Color", "computed_value::T::currentcolor()",
initial_specified_value="specified::Color::currentcolor()",
animation_value_type="IntermediateColor", need_clone=True,
ignored_when_colors_disabled=True,
spec="https://drafts.csswg.org/css-ui/#propdef-outline-color")}
-<%helpers:longhand name="outline-style" need_clone="True" animation_value_type="none"
+<%helpers:longhand name="outline-style" animation_value_type="discrete"
spec="https://drafts.csswg.org/css-ui/#propdef-outline-style">
use values::specified::BorderStyle;
pub type SpecifiedValue = Either<Auto, BorderStyle>;
impl SpecifiedValue {
#[inline]
pub fn none_or_hidden(&self) -> bool {