Skip to content

Commit

Permalink
Bug 1559276 - Part 2: Retire the support for 3-valued syntax for posi…
Browse files Browse the repository at this point in the history
…tion. r=emilio

According to this resolved spec issue:
w3c/csswg-drafts#2140,
we retire the 3-valued <position> on
1. `object-position`
2. `perspective-origin`,
3. `mask-position`
4. `circle()` and `ellipse()`
, but still keep the support for `background-position`.

Besides, I simply run this python script to generate the .ini file:
```
s = sys.argv[1] + ".ini"
with open(s, "w") as f:
    f.write('[{}]\n'.format(sys.argv[1]))
    f.write('  expected: FAIL\n')
    f.write('  bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276\n')
```

Differential Revision: https://phabricator.services.mozilla.com/D37126
  • Loading branch information
BorisChiou committed Jul 10, 2019
1 parent 75245a3 commit c63c934
Show file tree
Hide file tree
Showing 118 changed files with 357 additions and 221 deletions.
23 changes: 10 additions & 13 deletions layout/style/test/property_database.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,8 @@ var validGradientAndElementValues = [
"repeating-radial-gradient(50px 60px at 15% 20%, red, blue)",
"repeating-radial-gradient(7em 8em at 45px, red, blue)",

// FIXME(emilio): We should not be allowing 3-value positions anywhere else
// than on `background-position`, see
// https://github.com/w3c/csswg-drafts/issues/2140.
//
// When that happens this should be moved to the `invalid` list.
"repeating-radial-gradient(circle closest-side at left bottom 7in, hsl(2,2%,5%), rgb(1,6,0))",
"repeating-radial-gradient(circle closest-side at left 0px bottom 7in, hsl(2,2%,5%), rgb(1,6,0))",

"-moz-image-rect(url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==), 2, 10, 10, 2)",
"-moz-image-rect(url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==), 10%, 50%, 30%, 0%)",
Expand Down Expand Up @@ -706,7 +702,7 @@ var basicShapeOtherValues = [

"circle()",
"circle(at center)",
"circle(at top left 20px)",
"circle(at top 0px left 20px)",
"circle(at bottom right)",
"circle(20%)",
"circle(300px)",
Expand All @@ -722,7 +718,7 @@ var basicShapeOtherValues = [

"ellipse()",
"ellipse(at center)",
"ellipse(at top left 20px)",
"ellipse(at top 0px left 20px)",
"ellipse(at bottom right)",
"ellipse(20% 20%)",
"ellipse(300px 50%)",
Expand Down Expand Up @@ -792,6 +788,7 @@ var basicShapeInvalidValues = [
"circle(20% 20%)",
"circle(at farthest-side)",
"circle(calc(20px + rubbish))",
"circle(at top left 20px)",

"ellipse(at)",
"ellipse(at 20% 20% 30%)",
Expand All @@ -804,6 +801,7 @@ var basicShapeInvalidValues = [
"ellipse(20%)",
"ellipse(at farthest-side farthest-side)",
"ellipse(at top left calc(20px + rubbish))",
"ellipse(at top left 20px)",

"polygon(at)",
"polygon(at 20% 20% 30%)",
Expand Down Expand Up @@ -3036,7 +3034,6 @@ var gCSSProperties = {
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
initial_values: [
"top 0% left 0%",
"top 0% left",
"top left",
"left top",
"0% 0%",
Expand Down Expand Up @@ -3096,8 +3093,6 @@ var gCSSProperties = {
"top 3em right 10px",
"left 15px",
"10px top",
"left top 15px",
"left 10px top",
"left 20%",
"right 20%",
],
Expand All @@ -3117,6 +3112,8 @@ var gCSSProperties = {
"top 20px bottom 20px",
"left left",
"0px calc(0px + rubbish)",
"left top 15px",
"left 10px top",
],
},
"mask-position-x": {
Expand Down Expand Up @@ -3983,7 +3980,7 @@ var gCSSProperties = {
"top left / 100px auto",
"top left / 100px 10%",
"top left / 100px calc(20px)",
"bottom right scroll none transparent repeat",
"bottom right 8px scroll none transparent repeat",
"50% transparent",
"transparent 50%",
"50%",
Expand Down Expand Up @@ -6625,8 +6622,6 @@ var gCSSProperties = {
"top 3em right 10px",
"left 15px",
"10px top",
"left top 15px",
"left 10px top",
"left 20%",
"right 20%",
],
Expand All @@ -6645,6 +6640,8 @@ var gCSSProperties = {
"top 20px bottom 20px",
"left left",
"20 20",
"left top 15px",
"left 10px top",
],
},
opacity: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use crate::properties::longhands::background_clip;
use crate::properties::longhands::background_clip::single_value::computed_value::T as Clip;
use crate::properties::longhands::background_origin::single_value::computed_value::T as Origin;
use crate::values::specified::{Color, Position, PositionComponent};
use crate::values::specified::{AllowQuirks, Color, Position, PositionComponent};
use crate::parser::Parse;

// FIXME(emilio): Should be the same type!
Expand Down Expand Up @@ -64,7 +64,9 @@
}
}
if position.is_none() {
if let Ok(value) = input.try(|input| Position::parse(context, input)) {
if let Ok(value) = input.try(|input| {
Position::parse_three_value_quirky(context, input, AllowQuirks::No)
}) {
position = Some(value);

// Parse background size, if applicable.
Expand Down Expand Up @@ -211,7 +213,7 @@
let mut any = false;

input.parse_comma_separated(|input| {
let value = Position::parse_quirky(context, input, AllowQuirks::Yes)?;
let value = Position::parse_three_value_quirky(context, input, AllowQuirks::Yes)?;
position_x.push(value.horizontal);
position_y.push(value.vertical);
any = true;
Expand Down
27 changes: 24 additions & 3 deletions servo/components/style/values/specified/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ impl Parse for Position {
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
Self::parse_quirky(context, input, AllowQuirks::No)
let position = Self::parse_three_value_quirky(context, input, AllowQuirks::No)?;
if position.is_three_value_syntax() {
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
Ok(position)
}
}

impl Position {
/// Parses a `<position>`, with quirks.
pub fn parse_quirky<'i, 't>(
/// Parses a `<bg-position>`, with quirks.
pub fn parse_three_value_quirky<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks,
Expand Down Expand Up @@ -183,6 +187,12 @@ impl Position {
pub fn center() -> Self {
Self::new(PositionComponent::Center, PositionComponent::Center)
}

/// Returns true if this uses a 3 value syntax.
#[inline]
fn is_three_value_syntax(&self) -> bool {
self.horizontal.component_count() != self.vertical.component_count()
}
}

impl ToCss for Position {
Expand Down Expand Up @@ -252,6 +262,17 @@ impl<S> PositionComponent<S> {
pub fn zero() -> Self {
PositionComponent::Length(LengthPercentage::Percentage(Percentage::zero()))
}

/// Returns the count of this component.
fn component_count(&self) -> usize {
match *self {
PositionComponent::Length(..) |
PositionComponent::Center => 1,
PositionComponent::Side(_, ref lp) => {
if lp.is_some() { 2 } else { 1 }
}
}
}
}

impl<S: Side> ToComputedValue for PositionComponent<S> {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[object-fit-contain-png-001e.html]
fuzzy:
if os == "android": maxDifference=26;totalPixels=0-23
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-png-001i.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-png-001o.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-png-001p.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-png-002e.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-png-002i.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-png-002o.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-png-002p.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-001i.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-001p.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-002i.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-002p.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-003i.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-003p.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-004i.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-004p.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-005i.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-005p.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-006i.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[object-fit-contain-svg-006p.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[object-fit-cover-png-001c.html]
expected:
if debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
if not debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if debug and webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): PASS
if not debug and webrender and e10s and (os == "win") and (version == "10.0.17134") and (processor == "x86_64") and (bits == 64): PASS
FAIL
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276
Loading

0 comments on commit c63c934

Please sign in to comment.