Repository navigation
style: Move text-align outside of the mako file. - #19576
Conversation
|
Heads up! This PR modifies the following files:
|
|
r? @emilio or @Manishearth |
| #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] | ||
| pub enum TextAlign { | ||
| /// Keyword value of text-align property. | ||
| Keyword(ComputedTextAlign), |
There was a problem hiding this comment.
Given that ComputedTextAlign is used in the specified value I'd prefer if it were in this file as TextAlignKeyword and computed::TextAlign is an alias
emilio
left a comment
There was a problem hiding this comment.
r=me with @Manishearth's comment addressed and mine.
| } | ||
| #[cfg(feature = "gecko")] | ||
| { | ||
| if let Ok(_) = input.try(|i| i.expect_ident_matching("match-parent")) { |
There was a problem hiding this comment.
This doesn't need to use if let, just:
input.expect_ident_matching("match_parent")?;
return Ok(TextAlign::MatchParent);| impl TextAlign { | ||
| /// Convert computed TextAlign into u32 | ||
| pub fn to_u32(self) -> u32 { | ||
| match self { |
There was a problem hiding this comment.
This is super stupid btw (not your fault of course). I should just land the patch to derive(Parse) for keywords and use self as u32.
There was a problem hiding this comment.
I'll actually land it, gimme a sec :)
Allow deriving Parse on keywords. This makes patches like #19576 much easier. <!-- 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/19578) <!-- Reviewable:end -->
|
@emilio Added a small commit to do that Parse derive. Could you look at it? |
emilio
left a comment
There was a problem hiding this comment.
Arrg, still unfortunate we need the macros just for from_u32, but it's fine for now. We can maybe auto-generate that in the future.
| input.expect_ident_matching("match_parent")?; | ||
| return Ok(TextAlign::MatchParent); | ||
| } | ||
| return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); |
There was a problem hiding this comment.
Travis has failed because this is unreachable on Gecko.
|
Actually let me create a |
|
Can you look at it again to the new commit? |
|
|
||
| // TODO(canaltinova): We can create a trait for that. | ||
| quote! { | ||
| impl #name { |
There was a problem hiding this comment.
It'd be nice to make it a real trait if possible. also, it's kind of unfortunate that we fix this to u32 enums, isn't it?
I think the macro is ok for now if there's only one use case.
|
Nvm, it doesn't worth the effort. Changed back to macro. |
|
📌 Commit 8c2c478 has been approved by |
| } | ||
| #[cfg(feature = "gecko")] | ||
| { | ||
| input.expect_ident_matching("match_parent")?; |
|
@bors-servo r- |
|
(Feel free to land with that fixed and the rest of the patch sanity-checked, thanks!) |
|
Oops, thanks! |
|
📌 Commit 9882d0b has been approved by |
style: Move text-align outside of the mako file. I will need this refactoring before my next job. I didn't actually fix the FIXME's along the way. My other PR probably will cover these. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors <!-- 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/19576) <!-- 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 |
I will need this refactoring before my next job. I didn't actually fix the FIXME's along the way. My other PR probably will cover these.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is