Skip to content

style: Multiple cleanups around parsing code. - #16283

Merged
bors-servo merged 3 commits into
servo:masterfrom
emilio:cleanup-parse-non-negative
Apr 6, 2017
Merged

bors-servo merged 3 commits into
servo:masterfrom
emilio:cleanup-parse-non-negative

Conversation

@emilio

@emilio emilio commented Apr 6, 2017 •

Copy link
Copy Markdown
Member

This change is Reviewable

@highfive

highfive commented Apr 6, 2017

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/longhand/inherited_text.mako.rs, components/style/properties/longhand/background.mako.rs, components/style/stylesheets.rs, components/style/properties/shorthand/position.mako.rs, components/style/properties/longhand/font.mako.rs, components/style/properties/longhand/position.mako.rs, components/style/values/specified/length.rs, components/style/viewport.rs, components/style/values/specified/grid.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Apr 6, 2017
@highfive

highfive commented Apr 6, 2017

Copy link
Copy Markdown

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!

@emilio

emilio commented Apr 6, 2017

Copy link
Copy Markdown
Member Author

r? @Wafflespeanut or @Manishearth or @canaltinova

@highfive highfive assigned ghost and unassigned jdm Apr 6, 2017

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup! r=me after addressing the nits

}

try!(input.expect_function_matching("fit-content"));
// FIXME(emilio): This needs a parse_nested_block, doesn't it?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed this as a part of #16067 - could this be removed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that hasn't merged yet, and this needs a rebase anyway, I'd rather leave it there until that merges (btw, let me know when is it ready for re-review! I just saw a bunch of comments addressed that I wouldn't have noticed otherwise).

let inflexible_breadth =
match input.try(LengthOrPercentage::parse_non_negative) {
Ok(lop) => TrackBreadth::Breadth(lop),
Err(..) => TrackBreadth::Keyword(try!(TrackKeyword::parse(input))),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Clearly TrackKeyword::parse(input).map(TrackBreadth::Keyword) is better, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't strictly think so, it creates an unnecessary TrackBreadth when parsing fails, but I could split it like:

let keyword = try!(TrackKeyword::parse(..));
TrackBreadth::Keyword(keyword)

which is a bit nicer to read.

@emilio
emilio force-pushed the cleanup-parse-non-negative branch 2 times, most recently from 06a1376 to d947d98 Compare April 6, 2017 13:08
@emilio

emilio commented Apr 6, 2017

Copy link
Copy Markdown
Member Author

@bors-servo r=WafflesPeanut

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit d947d98 has been approved by WafflesPeanut

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Apr 6, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit d947d98 with merge 9fb8192...

bors-servo pushed a commit that referenced this pull request Apr 6, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-dev-unit

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Apr 6, 2017
@ghost

ghost commented Apr 6, 2017

Copy link
Copy Markdown

Looks like the unit tests need to be updated (just an import).

@emilio
emilio force-pushed the cleanup-parse-non-negative branch from d947d98 to 846c950 Compare April 6, 2017 18:56
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Apr 6, 2017
@emilio

emilio commented Apr 6, 2017

Copy link
Copy Markdown
Member Author

@bors-servo r=Wafflespeanut

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 846c950 has been approved by Wafflespeanut

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Apr 6, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 846c950 with merge 208d5db...

bors-servo pushed a commit that referenced this pull request Apr 6, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev
Approved by: Wafflespeanut
Pushing 208d5db to master...

@bors-servo
bors-servo merged commit 846c950 into servo:master Apr 6, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Apr 6, 2017
@emilio
emilio deleted the cleanup-parse-non-negative branch April 6, 2017 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants