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
style: Move font-variant-alternates outside of mako #19167
Conversation
Heads up! This PR modifies the following files:
|
}, | ||
VariantAlternates::HistoricalForms => { | ||
dest.write_str("historical-forms") | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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::{ |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" { |
There was a problem hiding this comment.
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()?, &[]) | ||
})?; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same regarding multiline imports.
☔ The latest upstream changes (presumably #19165) made this pull request unmergeable. Please resolve the merge conflicts. |
5d96982
to
773e7fc
Compare
773e7fc
to
aeae311
Compare
Looks good! Let's try to derive it in a followup. @bors-servo r+ |
📌 Commit aeae311 has been approved by |
…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 -->
☀️ 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 |
This is a sub-PR of #19015
r? emilio
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is