Bug 1568615 - Accept percentage for shape-image-threshold. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D39241

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Chiou 2019-07-24 21:37:22 +00:00
parent ff39c620e5
commit 0d2240d1bd
6 changed files with 17 additions and 16 deletions

View File

@ -8581,7 +8581,7 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
applies_to_first_letter: true,
initial_values: ["0", "0.0000", "-3"],
initial_values: ["0", "0.0000", "-3", "0%", "-100%"],
other_values: [
"0.4",
"1",
@ -8593,8 +8593,10 @@ var gCSSProperties = {
"3e0",
"3e+0",
"3e-0",
"50%",
"300%",
],
invalid_values: ["0px", "1px", "20%", "default", "auto"],
invalid_values: ["0px", "1px", "default", "auto"],
},
"shape-margin": {
domProp: "shapeMargin",

View File

@ -603,8 +603,9 @@ ${helpers.predefined_type(
// The spec issue for the parse_method: https://github.com/w3c/csswg-drafts/issues/4102.
${helpers.predefined_type(
"shape-image-threshold", "Opacity", "0.0",
parse_method="parse_number",
"shape-image-threshold",
"Opacity",
"0.0",
products="gecko",
animation_value_type="ComputedValue",
spec="https://drafts.csswg.org/css-shapes/#shape-image-threshold-property",

View File

@ -410,17 +410,6 @@ impl Parse for NonNegativeNumberOrPercentage {
)]
pub struct Opacity(Number);
impl Opacity {
/// Parse number value only.
#[inline]
pub fn parse_number<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
Number::parse(context, input).map(Opacity)
}
}
impl Parse for Opacity {
/// Opacity accepts <number> | <percentage>, so we parse it as NumberOrPercentage,
/// and then convert into an Number if it's a Percentage.

View File

@ -15,6 +15,11 @@
test_computed_value("shape-image-threshold", "-7", "0");
test_computed_value("shape-image-threshold", "0.5");
test_computed_value("shape-image-threshold", "12.5", "1");
// https://github.com/w3c/csswg-drafts/issues/4102
test_computed_value("shape-image-threshold", "-100%", "0");
test_computed_value("shape-image-threshold", "50%", "0.5");
test_computed_value("shape-image-threshold", "300%", "1");
</script>
</body>
</html>

View File

@ -14,7 +14,6 @@
<script>
test_invalid_value("shape-image-threshold", "auto");
test_invalid_value("shape-image-threshold", "10px");
test_invalid_value("shape-image-threshold", "100%");
</script>
</body>
</html>

View File

@ -14,6 +14,11 @@
<script>
test_valid_value("shape-image-threshold", "12.5");
test_valid_value("shape-image-threshold", "-7");
// https://github.com/w3c/csswg-drafts/issues/4102
test_valid_value("shape-image-threshold", "-100%", "-1");
test_valid_value("shape-image-threshold", "50%", "0.5");
test_valid_value("shape-image-threshold", "300%", "3");
</script>
</body>
</html>