Page MenuHomePhabricator

Bug 1559276 - Part 2: Retire the support for 3-valued syntax for position.
ClosedPublic

Authored by boris on Jul 5 2019, 9:13 PM.

Details

Summary

According to this resolved spec issue:
https://github.com/w3c/csswg-drafts/issues/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')

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

boris created this revision.Jul 5 2019, 9:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2019, 9:13 PM
phab-bot requested review of this revision.Jul 5 2019, 9:13 PM
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: Restricted Project.
boris updated this revision to Diff 128006.Jul 5 2019, 9:13 PM
boris retitled this revision from Bug 1559276 - Retire the support for 3-valued syntax for <position>. to Bug 1559276 - Part 2: Retire the support for 3-valued syntax for <position>..
boris updated this revision to Diff 128007.Jul 5 2019, 9:14 PM
boris retitled this revision from Bug 1559276 - Part 2: Retire the support for 3-valued syntax for <position>. to Bug 1559276 - Part 2: Retire the support for 3-valued syntax for position..
boris updated this revision to Diff 128008.Jul 5 2019, 9:16 PM
boris edited the summary of this revision. (Show Details)
boris added a comment.Jul 5 2019, 9:18 PM

hmm, still need to update property_database.js...

boris updated this revision to Diff 128037.Jul 5 2019, 10:05 PM
boris planned changes to this revision.Jul 5 2019, 11:27 PM
boris updated this revision to Diff 128069.Jul 6 2019, 12:12 AM
boris updated this revision to Diff 128711.Jul 8 2019, 6:30 PM
boris updated this revision to Diff 128881.Jul 8 2019, 10:27 PM
boris added a comment.Jul 8 2019, 10:30 PM

Most files are related to test update. The files in testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/* will be dropped after dbraon's sync (from Part 1). Basically, only need to check servo/*. (Other files could be verified by try.)

emilio added a comment.Jul 9 2019, 2:20 PM

Hmm, so this is a bit complicated and position parsing was a bit nasty already... What do you think of the following?

Adding the following bits:

impl<S> PositionComponent<S> {
    fn component_count(&self) -> usize {
        match *self {
            PositionComponent::Length(..) |
            PositionComponent::Center => 1,
            PositionComponent::Side(_, ref lp) => {
                if lp.is_some() { 2 } else { 1 }
            }
        }
    }
}

impl Position {
    fn is_three_value_syntax(&self) -> bool {
        self.horizontal.component_count() != self.vertical.component_count()
        // or maybe self.horizontal.component_count() + self.vertical.component_count() == 3
    }
}

Rename the current implementation of parse_quirky to parse_three_value_quirky.

Make Position::parse do something like:

let position = Self::parse_three_value_quirky(..)?;
if position.is_three_value_syntax() {
    return Err(..);
}
Ok(position)

I think that'd be simpler over all. It feels a bit weird that we detect three-value syntax sometimes before, sometimes after, otherwise.

servo/components/style/properties/shorthands/background.mako.rs
216

(If you don't take my suggestion above, can we make this boolean parameter an enum?)

emilio requested changes to this revision.Jul 9 2019, 2:40 PM

Requesting changes since it's more of a question than anything, to ensure you see it. But it's more of a question than anything else.

This revision now requires changes to proceed.Jul 9 2019, 2:40 PM
boris added a comment.Jul 9 2019, 6:15 PM

That's ok with me. Using the count of the values to check it is one of my options while working on this, but I'm not sure which way is better. For readability, it's reasonable to address your idea. Thanks.

boris updated this revision to Diff 129489.Jul 9 2019, 7:36 PM
boris marked an inline comment as done.Jul 9 2019, 7:37 PM
emilio accepted this revision.Jul 9 2019, 10:26 PM

Thank you!

This revision is now accepted and ready to land.Jul 9 2019, 10:26 PM
boris added a comment.Jul 10 2019, 1:23 AM

I forgot to update the parser of background shorthand [1]. Will update it by using parse_three_value_quirky().

[1] https://searchfox.org/mozilla-central/rev/40ef22080910c2e2c27d9e2120642376b1d8b8b2/servo/components/style/properties/shorthands/background.mako.rs#67

boris updated this revision to Diff 129654.Jul 10 2019, 1:34 AM
boris updated this revision to Diff 130225.Jul 10 2019, 8:25 PM