Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: Move font-variant-alternates outside of mako #19167

Merged
merged 1 commit into from Nov 11, 2017

Conversation

CYBAI
Copy link
Member

@CYBAI CYBAI commented Nov 9, 2017

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



This change is Reviewable

@highfive
Copy link

highfive commented Nov 9, 2017

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/gecko.mako.rs, components/style/values/specified/font.rs, components/style/values/specified/mod.rs, components/style/values/computed/mod.rs, components/style/values/computed/font.rs and 1 more
  • @canaltinova: components/style/properties/gecko.mako.rs, components/style/values/specified/font.rs, components/style/values/specified/mod.rs, components/style/values/computed/mod.rs, components/style/values/computed/font.rs and 1 more
  • @emilio: components/style/properties/gecko.mako.rs, components/style/values/specified/font.rs, components/style/values/specified/mod.rs, components/style/values/computed/mod.rs, components/style/values/computed/font.rs and 1 more

@highfive
Copy link

highfive commented Nov 9, 2017

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 Nov 9, 2017
},
VariantAlternates::HistoricalForms => {
dest.write_str("historical-forms")
},
Copy link
Member Author

Choose a reason for hiding this comment

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

Every dest.write_str write with different string for each variant so I just type them by hand.
Not sure if there's any better and graceful way to write this pattern matching.
If yes, I'm willing to update it!

cc @jdm @emilio

Copy link
Member

Choose a reason for hiding this comment

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

I think you could derive(ToCss) here using #[css(function)] annotations.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll try to implement ToCss for Box<[CustomIdent]> in another PR.
Then, I'll update this.

Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Looks great! Just one bug I noticed, and a couple nits. Thanks as always!

@@ -36,7 +36,10 @@ pub use self::angle::Angle;
pub use self::background::{BackgroundSize, BackgroundRepeat};
pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth};
pub use self::border::{BorderRadius, BorderCornerRadius, BorderSpacing};
pub use self::font::{FontSize, FontSizeAdjust, FontWeight, MozScriptLevel, MozScriptMinSize, XTextZoom};
pub use self::font::{
Copy link
Member

Choose a reason for hiding this comment

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

nit: Use two lines for imports instead of breaking them into multiple lines, see the border imports on the line above.

bitflags! {
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
/// Flags of variant alternates in bit
pub struct ParsingFlags: u8 {
Copy link
Member

Choose a reason for hiding this comment

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

Let's call this something more specific like VariantAlternatesParsingFlags.

Copy link
Member

Choose a reason for hiding this comment

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

Also, no need for pub I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, sorry for that I forgot to remove the pub. I'll update it!

// FIXME: remove clone() when lifetimes are non-lexical
match input.next()?.clone() {
Token::Ident(ref ident) => {
if *ident == "historical-forms" {
Copy link
Member

Choose a reason for hiding this comment

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

This should be ident.eq_ignore_ascii_case("historical-forms"), could you add a test for this?

Something in the lines of:

<!doctype html>
<div style="font-variant-alternates: Historical-Forms"></div>
<script>
getComputedStyle(document.querySelector('div')).fontVariantAlternates == "historical-forms"
</script>

Though... I guess it would need to be a test for Firefox, not servo, so let's fix it and I'll land the test in https://bugzilla.mozilla.org/show_bug.cgi?id=1415946

let idents = i.parse_comma_separated(|i| {
let location = i.current_source_location();
CustomIdent::from_ident(location, i.expect_ident()?, &[])
})?;
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, the duplication here is slightly worrying, but it's not too much, so I guess it's fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm... yes, I also would like to improve them with checking with multiple patterns of pattern matching; however, there're very small different inside the match body. If there's a good way to solve this problem, I think we can reduce this match.

@@ -30,7 +30,10 @@ pub use self::align::{AlignItems, AlignJustifyContent, AlignJustifySelf, Justify
pub use self::background::{BackgroundRepeat, BackgroundSize};
pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth};
pub use self::border::{BorderImageSideWidth, BorderRadius, BorderSideWidth, BorderSpacing};
pub use self::font::{FontSize, FontSizeAdjust, FontWeight, MozScriptLevel, MozScriptMinSize, XTextZoom};
pub use self::font::{
FontSize, FontSizeAdjust, FontWeight, FontVariantAlternates,
Copy link
Member

Choose a reason for hiding this comment

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

Same regarding multiline imports.

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #19165) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Nov 10, 2017
@CYBAI CYBAI force-pushed the font-variant-alternates-out-of-mako branch from 5d96982 to 773e7fc Compare November 10, 2017 18:15
@CYBAI CYBAI force-pushed the font-variant-alternates-out-of-mako branch from 773e7fc to aeae311 Compare November 10, 2017 18:21
@emilio
Copy link
Member

emilio commented Nov 10, 2017

Looks good! Let's try to derive it in a followup.

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit aeae311 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. S-needs-rebase There are merge conflict errors. labels Nov 10, 2017
@bors-servo
Copy link
Contributor

⌛ Testing commit aeae311 with merge 33fa728...

bors-servo pushed a commit that referenced this pull request Nov 10, 2017
…milio

style: Move font-variant-alternates 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 #19166  (github issue number if applicable).
- [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/19167)
<!-- Reviewable:end -->
@bors-servo
Copy link
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 33fa728 to master...

@bors-servo bors-servo merged commit aeae311 into servo:master Nov 11, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 11, 2017
@CYBAI CYBAI deleted the font-variant-alternates-out-of-mako branch November 11, 2017 02:45
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 font-variant-alternates outside of mako.
4 participants