aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-06-23 05:59:49 -0700
committerGitHub <noreply@github.com>2017-06-23 05:59:49 -0700
commit92679480b1dc70007d4de0391327d0cf34015e63 (patch)
tree17d917e48656df8b0234e93331a23c8ce6b0a611 /components
parent567f5e8985c6e4ba86fca85ff8ff46779fe10a4e (diff)
parentf01ea53ac1bd40803a284678355cf253070c2b9e (diff)
downloadservo-92679480b1dc70007d4de0391327d0cf34015e63.tar.gz
servo-92679480b1dc70007d4de0391327d0cf34015e63.zip
Auto merge of #17469 - nox:empty-vs-initial, r=emilio
Distinguish the emptiness of a property from its initial value <!-- 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/17469) <!-- Reviewable:end -->
Diffstat (limited to 'components')
-rw-r--r--components/style/properties/helpers.mako.rs10
-rw-r--r--components/style/properties/longhand/box.mako.rs45
-rw-r--r--components/style/properties/longhand/inherited_svg.mako.rs23
-rw-r--r--components/style/properties/properties.mako.rs4
4 files changed, 46 insertions, 36 deletions
diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs
index 990e9e6646e..8c6701497e4 100644
--- a/components/style/properties/helpers.mako.rs
+++ b/components/style/properties/helpers.mako.rs
@@ -9,7 +9,7 @@
<%def name="predefined_type(name, type, initial_value, parse_method='parse',
needs_context=True, vector=False, computed_type=None, initial_specified_value=None,
- allow_quirks=False, **kwargs)">
+ allow_quirks=False, allow_empty=False, **kwargs)">
<%def name="predefined_type_inner(name, type, initial_value, parse_method)">
#[allow(unused_imports)]
use app_units::Au;
@@ -27,7 +27,9 @@
pub use values::computed::${type} as T;
% endif
}
+ % if initial_value:
#[inline] pub fn get_initial_value() -> computed_value::T { ${initial_value} }
+ % endif
% if initial_specified_value:
#[inline] pub fn get_initial_specified_value() -> SpecifiedValue { ${initial_specified_value} }
% endif
@@ -46,7 +48,9 @@
}
</%def>
% if vector:
- <%call expr="vector_longhand(name, predefined_type=type, **kwargs)">
+ <%call
+ expr="vector_longhand(name, predefined_type=type, allow_empty=allow_empty or not initial_value, **kwargs)"
+ >
${predefined_type_inner(name, type, initial_value, parse_method)}
% if caller:
${caller.body()}
@@ -202,7 +206,7 @@
}
pub fn get_initial_value() -> computed_value::T {
- % if allow_empty:
+ % if allow_empty and allow_empty != "NotInitial":
computed_value::T(SmallVec::new())
% else:
let mut v = SmallVec::new();
diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs
index 4f0449ad0bf..871eb37513d 100644
--- a/components/style/properties/longhand/box.mako.rs
+++ b/components/style/properties/longhand/box.mako.rs
@@ -429,17 +429,19 @@ ${helpers.predefined_type("transition-timing-function",
extra_prefixes="moz webkit",
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-timing-function")}
-${helpers.predefined_type("transition-property",
- "TransitionProperty",
- "computed::TransitionProperty::All",
- initial_specified_value="specified::TransitionProperty::All",
- vector=True,
- allow_empty=True,
- need_index=True,
- needs_context=False,
- animation_value_type="none",
- extra_prefixes="moz webkit",
- spec="https://drafts.csswg.org/css-transitions/#propdef-transition-property")}
+${helpers.predefined_type(
+ "transition-property",
+ "TransitionProperty",
+ "computed::TransitionProperty::All",
+ initial_specified_value="specified::TransitionProperty::All",
+ vector=True,
+ allow_empty="NotInitial",
+ need_index=True,
+ needs_context=False,
+ animation_value_type="none",
+ extra_prefixes="moz webkit",
+ spec="https://drafts.csswg.org/css-transitions/#propdef-transition-property",
+)}
${helpers.predefined_type("transition-delay",
"Time",
@@ -668,16 +670,17 @@ ${helpers.predefined_type("scroll-snap-destination",
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)",
animation_value_type="ComputedValue")}
-${helpers.predefined_type("scroll-snap-coordinate",
- "Position",
- "computed::Position::zero()",
- vector=True,
- products="gecko",
- spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)",
- animation_value_type="ComputedValue",
- allow_empty=True,
- delegate_animate=True)}
-
+${helpers.predefined_type(
+ "scroll-snap-coordinate",
+ "Position",
+ "computed::Position::zero()",
+ vector=True,
+ products="gecko",
+ spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)",
+ animation_value_type="ComputedValue",
+ allow_empty="NotInitial",
+ delegate_animate=True,
+)}
<%helpers:longhand name="transform" extra_prefixes="webkit"
animation_value_type="ComputedValue"
diff --git a/components/style/properties/longhand/inherited_svg.mako.rs b/components/style/properties/longhand/inherited_svg.mako.rs
index 3799c89d3ad..1d7fd7a985a 100644
--- a/components/style/properties/longhand/inherited_svg.mako.rs
+++ b/components/style/properties/longhand/inherited_svg.mako.rs
@@ -88,17 +88,18 @@ ${helpers.predefined_type("stroke-opacity", "Opacity", "1.0",
products="gecko", animation_value_type="ComputedValue",
spec="https://www.w3.org/TR/SVG11/painting.html#StrokeOpacityProperty")}
-${helpers.predefined_type("stroke-dasharray",
- "LengthOrPercentageOrNumber",
- "Either::First(0.0)",
- "parse_non_negative",
- vector="True",
- delegate_animate="True",
- allow_empty="True",
- products="gecko",
- animation_value_type="ComputedValue",
- space_separated_allowed="True",
- spec="https://www.w3.org/TR/SVG2/painting.html#StrokeDashing")}
+${helpers.predefined_type(
+ "stroke-dasharray",
+ "LengthOrPercentageOrNumber",
+ None,
+ "parse_non_negative",
+ vector=True,
+ delegate_animate=True,
+ products="gecko",
+ animation_value_type="ComputedValue",
+ space_separated_allowed="True",
+ spec="https://www.w3.org/TR/SVG2/painting.html#StrokeDashing",
+)}
${helpers.predefined_type(
"stroke-dashoffset", "LengthOrPercentageOrNumber",
diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs
index f7deb43d492..4507ea5119a 100644
--- a/components/style/properties/properties.mako.rs
+++ b/components/style/properties/properties.mako.rs
@@ -1765,7 +1765,9 @@ pub mod style_structs {
/// Returns whether there are any transitions specified.
#[cfg(feature = "servo")]
pub fn specifies_transitions(&self) -> bool {
- self.transition_property_count() > 0
+ self.transition_duration_iter()
+ .take(self.transition_property_count())
+ .any(|t| t.seconds() > 0.)
}
% endif
}