Skip to content

style: Move outline-style outside of mako - #19548

Merged
bors-servo merged 1 commit into
servo:masterfrom
CYBAI:move-outline-style-out-of-mako
Dec 14, 2017
Merged

bors-servo merged 1 commit into
servo:masterfrom
CYBAI:move-outline-style-out-of-mako

Conversation

@CYBAI

@CYBAI CYBAI commented Dec 12, 2017 •

Copy link
Copy Markdown
Member

This is a sub-PR of #19015
r? emilio



This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @bholley: components/style/values/computed/outline.rs, components/style/properties/longhand/outline.mako.rs, components/style/values/specified/mod.rs, components/style/values/specified/outline.rs, components/style/values/computed/mod.rs
  • @canaltinova: components/style/values/computed/outline.rs, components/style/properties/longhand/outline.mako.rs, components/style/values/specified/mod.rs, components/style/values/specified/outline.rs, components/style/values/computed/mod.rs
  • @emilio: components/style/values/computed/outline.rs, components/style/properties/longhand/outline.mako.rs, components/style/values/specified/mod.rs, components/style/values/specified/outline.rs, components/style/values/computed/mod.rs

@highfive

Copy link
Copy Markdown

warning Warning warning

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

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Dec 12, 2017
@@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

*/ should move to next line?

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 think maybe it's okay.
I just copied this License from other files.


//! Computed values for outline properties

pub use values::specified::OutlineStyle; No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

need a new line at the end

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.

Fixed! Thanks.

@CYBAI
CYBAI force-pushed the move-outline-style-out-of-mako branch from 03e955e to 0172705 Compare December 12, 2017 15:19
}

/// Parse outline-style
pub fn parse<'i, 't>(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, so this is weird, how are we parsing auto now?

Before that, we used Parse, and then reject BorderStyle::Hidden, now that's not happening.

Let's change OutlineStyle to not be Either, but just be:

#[derive(ToCss, ToComputedValue, ...)]
pub enum OutlineStyle {
    Auto,
    Other(BorderStyle),
}

And parse Auto manually.

@CYBAI CYBAI Dec 12, 2017 •

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.

Thanks!
I think using enum is more reasonable for this attribute.
I'm going to fix it.

_ => Ok(Either::Second(result))
}
} else {
Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent("hidden".into())))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is wrong, this is returning an "unexpected token: hidden" error, when BorderStyle doesn't parse.

Instead we should propagate the error up.

So, with the above, it'd look something like:

if let Ok(border_style) = input.try(|i| BorderStyle::parse(context, i)) {
    if matches!(border_style, BorderStyle::Hidden) {
        return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent("hidden".into()))) 
    }
    return Ok(OutlineStyle::Other(border_style));
}

input.expect_ident_matching("auto")?;
Ok(OutlineStyle::Auto)

@CYBAI
CYBAI force-pushed the move-outline-style-out-of-mako branch 2 times, most recently from 7208f16 to e70bdbf Compare December 13, 2017 02:35
@CYBAI
CYBAI force-pushed the move-outline-style-out-of-mako branch from e70bdbf to b9b91b3 Compare December 13, 2017 03:42

@emilio emilio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great, thanks @CYBAI!

@emilio

emilio commented Dec 14, 2017

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit b9b91b3 has been approved by emilio

@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 Dec 14, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit b9b91b3 with merge 714c1b2...

bors-servo pushed a commit that referenced this pull request Dec 14, 2017
style: Move outline-style outside of mako

This is a sub-PR of #19015
r? emilio

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #19546
- [x] These changes do not require tests

<!-- 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/19548)
<!-- Reviewable:end -->
@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-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: emilio
Pushing 714c1b2 to master...

@bors-servo
bors-servo merged commit b9b91b3 into servo:master Dec 14, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Dec 14, 2017
@bors-servo bors-servo mentioned this pull request Dec 14, 2017
4 of 5 tasks
@CYBAI
CYBAI deleted the move-outline-style-out-of-mako branch December 14, 2017 02:29
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.

Move outline-style outside of mako.

5 participants