mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
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 -->
This commit is contained in:
commit
92679480b1
7 changed files with 48 additions and 40 deletions
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
<%def name="predefined_type(name, type, initial_value, parse_method='parse',
|
<%def name="predefined_type(name, type, initial_value, parse_method='parse',
|
||||||
needs_context=True, vector=False, computed_type=None, initial_specified_value=None,
|
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)">
|
<%def name="predefined_type_inner(name, type, initial_value, parse_method)">
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
|
@ -27,7 +27,9 @@
|
||||||
pub use values::computed::${type} as T;
|
pub use values::computed::${type} as T;
|
||||||
% endif
|
% endif
|
||||||
}
|
}
|
||||||
|
% if initial_value:
|
||||||
#[inline] pub fn get_initial_value() -> computed_value::T { ${initial_value} }
|
#[inline] pub fn get_initial_value() -> computed_value::T { ${initial_value} }
|
||||||
|
% endif
|
||||||
% if initial_specified_value:
|
% if initial_specified_value:
|
||||||
#[inline] pub fn get_initial_specified_value() -> SpecifiedValue { ${initial_specified_value} }
|
#[inline] pub fn get_initial_specified_value() -> SpecifiedValue { ${initial_specified_value} }
|
||||||
% endif
|
% endif
|
||||||
|
@ -46,7 +48,9 @@
|
||||||
}
|
}
|
||||||
</%def>
|
</%def>
|
||||||
% if vector:
|
% 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)}
|
${predefined_type_inner(name, type, initial_value, parse_method)}
|
||||||
% if caller:
|
% if caller:
|
||||||
${caller.body()}
|
${caller.body()}
|
||||||
|
@ -202,7 +206,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_initial_value() -> computed_value::T {
|
pub fn get_initial_value() -> computed_value::T {
|
||||||
% if allow_empty:
|
% if allow_empty and allow_empty != "NotInitial":
|
||||||
computed_value::T(SmallVec::new())
|
computed_value::T(SmallVec::new())
|
||||||
% else:
|
% else:
|
||||||
let mut v = SmallVec::new();
|
let mut v = SmallVec::new();
|
||||||
|
|
|
@ -429,17 +429,19 @@ ${helpers.predefined_type("transition-timing-function",
|
||||||
extra_prefixes="moz webkit",
|
extra_prefixes="moz webkit",
|
||||||
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-timing-function")}
|
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-timing-function")}
|
||||||
|
|
||||||
${helpers.predefined_type("transition-property",
|
${helpers.predefined_type(
|
||||||
"TransitionProperty",
|
"transition-property",
|
||||||
"computed::TransitionProperty::All",
|
"TransitionProperty",
|
||||||
initial_specified_value="specified::TransitionProperty::All",
|
"computed::TransitionProperty::All",
|
||||||
vector=True,
|
initial_specified_value="specified::TransitionProperty::All",
|
||||||
allow_empty=True,
|
vector=True,
|
||||||
need_index=True,
|
allow_empty="NotInitial",
|
||||||
needs_context=False,
|
need_index=True,
|
||||||
animation_value_type="none",
|
needs_context=False,
|
||||||
extra_prefixes="moz webkit",
|
animation_value_type="none",
|
||||||
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-property")}
|
extra_prefixes="moz webkit",
|
||||||
|
spec="https://drafts.csswg.org/css-transitions/#propdef-transition-property",
|
||||||
|
)}
|
||||||
|
|
||||||
${helpers.predefined_type("transition-delay",
|
${helpers.predefined_type("transition-delay",
|
||||||
"Time",
|
"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)",
|
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)",
|
||||||
animation_value_type="ComputedValue")}
|
animation_value_type="ComputedValue")}
|
||||||
|
|
||||||
${helpers.predefined_type("scroll-snap-coordinate",
|
${helpers.predefined_type(
|
||||||
"Position",
|
"scroll-snap-coordinate",
|
||||||
"computed::Position::zero()",
|
"Position",
|
||||||
vector=True,
|
"computed::Position::zero()",
|
||||||
products="gecko",
|
vector=True,
|
||||||
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)",
|
products="gecko",
|
||||||
animation_value_type="ComputedValue",
|
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-destination)",
|
||||||
allow_empty=True,
|
animation_value_type="ComputedValue",
|
||||||
delegate_animate=True)}
|
allow_empty="NotInitial",
|
||||||
|
delegate_animate=True,
|
||||||
|
)}
|
||||||
|
|
||||||
<%helpers:longhand name="transform" extra_prefixes="webkit"
|
<%helpers:longhand name="transform" extra_prefixes="webkit"
|
||||||
animation_value_type="ComputedValue"
|
animation_value_type="ComputedValue"
|
||||||
|
|
|
@ -88,17 +88,18 @@ ${helpers.predefined_type("stroke-opacity", "Opacity", "1.0",
|
||||||
products="gecko", animation_value_type="ComputedValue",
|
products="gecko", animation_value_type="ComputedValue",
|
||||||
spec="https://www.w3.org/TR/SVG11/painting.html#StrokeOpacityProperty")}
|
spec="https://www.w3.org/TR/SVG11/painting.html#StrokeOpacityProperty")}
|
||||||
|
|
||||||
${helpers.predefined_type("stroke-dasharray",
|
${helpers.predefined_type(
|
||||||
"LengthOrPercentageOrNumber",
|
"stroke-dasharray",
|
||||||
"Either::First(0.0)",
|
"LengthOrPercentageOrNumber",
|
||||||
"parse_non_negative",
|
None,
|
||||||
vector="True",
|
"parse_non_negative",
|
||||||
delegate_animate="True",
|
vector=True,
|
||||||
allow_empty="True",
|
delegate_animate=True,
|
||||||
products="gecko",
|
products="gecko",
|
||||||
animation_value_type="ComputedValue",
|
animation_value_type="ComputedValue",
|
||||||
space_separated_allowed="True",
|
space_separated_allowed="True",
|
||||||
spec="https://www.w3.org/TR/SVG2/painting.html#StrokeDashing")}
|
spec="https://www.w3.org/TR/SVG2/painting.html#StrokeDashing",
|
||||||
|
)}
|
||||||
|
|
||||||
${helpers.predefined_type(
|
${helpers.predefined_type(
|
||||||
"stroke-dashoffset", "LengthOrPercentageOrNumber",
|
"stroke-dashoffset", "LengthOrPercentageOrNumber",
|
||||||
|
|
|
@ -1765,7 +1765,9 @@ pub mod style_structs {
|
||||||
/// Returns whether there are any transitions specified.
|
/// Returns whether there are any transitions specified.
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
pub fn specifies_transitions(&self) -> bool {
|
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
|
% endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,3 @@
|
||||||
[parse 'all, none']
|
[parse 'all, none']
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[parse 'initial']
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
|
@ -25556,7 +25556,7 @@
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"mozilla/calc.html": [
|
"mozilla/calc.html": [
|
||||||
"a1f441f7fd4b9ab3ae9e1cb5403cfe8de90bb71c",
|
"5d59d5b367a023e778ce6968acdeca6b8b7c3197",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
"mozilla/canvas.initial.reset.2dstate.html": [
|
"mozilla/canvas.initial.reset.2dstate.html": [
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#inner {
|
#inner {
|
||||||
border-style: solid; /* So used border == computed border */
|
border-style: solid; /* So used border == computed border */
|
||||||
outline-style: solid; /* So used outline-width == computed outline-width */
|
outline-style: solid; /* So used outline-width == computed outline-width */
|
||||||
|
transition-property: none; /* so that tests don't occur in the middle of a transition */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue