Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upstyle: Move text-align outside of the mako file. #19576
Conversation
highfive
commented
Dec 15, 2017
|
Heads up! This PR modifies the following files:
|
highfive
commented
Dec 15, 2017
|
r? @emilio or @Manishearth |
| #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] | ||
| pub enum TextAlign { | ||
| /// Keyword value of text-align property. | ||
| Keyword(ComputedTextAlign), |
This comment has been minimized.
This comment has been minimized.
Manishearth
Dec 15, 2017
Member
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
|
r=me with @Manishearth's comment addressed and mine. |
| } | ||
| #[cfg(feature = "gecko")] | ||
| { | ||
| if let Ok(_) = input.try(|i| i.expect_ident_matching("match-parent")) { |
This comment has been minimized.
This comment has been minimized.
emilio
Dec 15, 2017
Member
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 { |
This comment has been minimized.
This comment has been minimized.
emilio
Dec 15, 2017
Member
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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? |
|
Arrg, still unfortunate we need the macros just for |
| input.expect_ident_matching("match_parent")?; | ||
| return Ok(TextAlign::MatchParent); | ||
| } | ||
| return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); |
This comment has been minimized.
This comment has been minimized.
|
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 { |
This comment has been minimized.
This comment has been minimized.
emilio
Dec 17, 2017
Member
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. |
|
|
| } | ||
| #[cfg(feature = "gecko")] | ||
| { | ||
| input.expect_ident_matching("match_parent")?; |
This comment has been minimized.
This comment has been minimized.
|
@bors-servo r- |
|
(Feel free to land with that fixed and the rest of the patch sanity-checked, thanks!) |
|
Oops, thanks! |
|
|
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 -->
|
|
canova commentedDec 15, 2017
•
edited by SimonSapin
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