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 text-align outside of the mako file. #19576

Merged
merged 2 commits into from Dec 18, 2017
Merged

Conversation

@canova
Copy link
Member

canova commented Dec 15, 2017

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 -d does not report any errors
  • ./mach test-tidy does not report any errors

This change is Reviewable

@highfive
Copy link

highfive commented Dec 15, 2017

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/longhand/inherited_text.mako.rs, components/style/values/computed/text.rs, components/style/values/specified/mod.rs, components/style/values/computed/mod.rs, components/style/values/specified/text.rs and 1 more
  • @emilio: components/style/properties/longhand/inherited_text.mako.rs, components/style/values/computed/text.rs, components/style/values/specified/mod.rs, components/style/values/computed/mod.rs, components/style/values/specified/text.rs and 1 more
@highfive
Copy link

highfive commented Dec 15, 2017

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!
@canova
Copy link
Member Author

canova commented Dec 15, 2017

@highfive highfive assigned emilio and unassigned jdm Dec 15, 2017
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum TextAlign {
/// Keyword value of text-align property.
Keyword(ComputedTextAlign),

This comment has been minimized.

@Manishearth

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

@emilio
emilio approved these changes Dec 15, 2017
Copy link
Member

emilio left a 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")) {

This comment has been minimized.

@emilio

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.

@emilio

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.

@emilio

emilio Dec 15, 2017

Member

I'll actually land it, gimme a sec :)

This comment has been minimized.

bors-servo added a commit that referenced this pull request Dec 15, 2017
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 -->
@canova canova force-pushed the canova:text-align branch from 5644054 to e0e798a Dec 16, 2017
@canova
Copy link
Member Author

canova commented Dec 16, 2017

@emilio Added a small commit to do that Parse derive. Could you look at it?

@emilio
emilio approved these changes Dec 16, 2017
Copy link
Member

emilio left a 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));

This comment has been minimized.

@emilio

emilio Dec 16, 2017

Member

Travis has failed because this is unreachable on Gecko.

@canova
Copy link
Member Author

canova commented Dec 17, 2017

Actually let me create a ToKeywordEnum proc macro to implement from_u32. So we can get rid of that macro.

@canova canova force-pushed the canova:text-align branch from e0e798a to a2c24b0 Dec 17, 2017
@canova
Copy link
Member Author

canova commented Dec 17, 2017

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.

@emilio

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.

@canova canova force-pushed the canova:text-align branch from a2c24b0 to 8c2c478 Dec 18, 2017
@canova
Copy link
Member Author

canova commented Dec 18, 2017

Nvm, it doesn't worth the effort. Changed back to macro.
@bors-servo r=Manishearth,emilio

@bors-servo
Copy link
Contributor

bors-servo commented Dec 18, 2017

📌 Commit 8c2c478 has been approved by Manishearth,emilio

}
#[cfg(feature = "gecko")]
{
input.expect_ident_matching("match_parent")?;

This comment has been minimized.

@emilio

emilio Dec 18, 2017

Member

match-parent (s/_/-/)

@emilio
Copy link
Member

emilio commented Dec 18, 2017

@emilio
Copy link
Member

emilio commented Dec 18, 2017

(Feel free to land with that fixed and the rest of the patch sanity-checked, thanks!)

@canova canova force-pushed the canova:text-align branch from 8c2c478 to 9882d0b Dec 18, 2017
@canova
Copy link
Member Author

canova commented Dec 18, 2017

Oops, thanks!
@bors-servo r=Manishearth,emilio

@bors-servo
Copy link
Contributor

bors-servo commented Dec 18, 2017

📌 Commit 9882d0b has been approved by Manishearth,emilio

@bors-servo
Copy link
Contributor

bors-servo commented Dec 18, 2017

Testing commit 9882d0b with merge a9c1797...

bors-servo added a commit that referenced this pull request Dec 18, 2017
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 18, 2017

☀️ 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: Manishearth,emilio
Pushing a9c1797 to master...

@bors-servo bors-servo merged commit 9882d0b into servo:master Dec 18, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@canova canova deleted the canova:text-align branch Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.