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 upRemove usage of 'keyword_list' #13917
Conversation
highfive
commented
Oct 25, 2016
highfive
commented
Oct 25, 2016
| @@ -75,6 +75,10 @@ | |||
| } | |||
| pub mod computed_value { | |||
| pub use super::single_value::computed_value as single_value; | |||
| % if requires_single: | |||
| pub use super::single_value::computed_value::T as SingleComputedValue; | |||
This comment has been minimized.
This comment has been minimized.
Manishearth
Oct 25, 2016
Member
I don't think we need requires_single. Refactor the code that needs SingleFoo to use single_value::computed_value::Foo. Alternatively, unconditionally add the reexport.
| @@ -145,6 +151,19 @@ | |||
| }).map(SpecifiedValue) | |||
| % endif | |||
| } | |||
|
|
|||
| % if requires_single: | |||
This comment has been minimized.
This comment has been minimized.
Manishearth
Oct 25, 2016
Member
We should get rid of this and refactor code using these functions to use the single_value functions instead
|
I really thought I could escape from refactoring a lot of code |
|
|
|
r? @emilio or @Manishearth |
|
Just one question, that I think @SimonSapin should be able to answer. So the idea of not having If that's the case, that change probably should be reverted. Otherwise the simplification looks pretty neat :) |
| @@ -75,6 +74,7 @@ | |||
| } | |||
| pub mod computed_value { | |||
| pub use super::single_value::computed_value as single_value; | |||
| pub use super::single_value::computed_value::T as SingleComputedValue; | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| <%call expr="longhand(name, **kwargs)"> | ||
| % if product == "gecko" or not gecko_only: |
This comment has been minimized.
This comment has been minimized.
Yeah, that could be the case. In that case I guess you can just wrap in a struct. |
I have no idea what is the context or motivation for this PR. (By the way, it would be nicer to include that in the PR message.) But yes, in CSS specs initial values are define per individual property, even if some properties may share some syntax / grammar. |
We have both I guess we shouldn't move get_initial to a method, then. |
No, it was because initially, I was unable to have the |
I still don't get why this is necessary. The |
|
Updated the PR message :) |
|
You should rewrite callers to use |
|
Or, |
| use style_traits::ToCss; | ||
|
|
||
| pub use Atom as SingleComputedValue; | ||
|
|
||
| impl Parse for Atom { |
This comment has been minimized.
This comment has been minimized.
Manishearth
Nov 16, 2016
Member
I don't think this should be there. Atom is too generic to be tied to the parsing details for a single property.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Nov 17, 2016
•
Author
Member
Okay, I've gone for a new type AnimationName(pub Atom) and impl'd the necessary traits.
| impl Parse for AnimationIterationCount { | ||
| fn parse(input: &mut ::cssparser::Parser) -> Result<Self, ()> { | ||
| if input.try(|input| input.expect_ident_matching("infinite")).is_ok() { | ||
| Ok(AnimationIterationCount::Infinite) |
This comment has been minimized.
This comment has been minimized.
| use style_traits::ToCss; | ||
|
|
||
| pub use Atom as SingleComputedValue; | ||
|
|
||
| impl Parse for Atom { |
This comment has been minimized.
This comment has been minimized.
3c7122d
to
df8d9da
|
Updated the PR. |
| } | ||
| } | ||
|
|
||
| impl Deref for AnimationName { |
This comment has been minimized.
This comment has been minimized.
Manishearth
Nov 17, 2016
Member
In general try to use deref for things that involve actual dereferencing. Just refactor everything else to use .0 here
This comment has been minimized.
This comment has been minimized.
|
@bors-servo r+ |
|
|
Remove usage of 'keyword_list' <!-- Please describe your changes on the following line: --> We're using `keyword_list` to generate code for some of the animation properties. This could be achieved with `single_keyword` (passing `vector=True`). --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach build-geckolib` does not report any errors <!-- Either: --> - [x] These changes do not require tests because it's a cleanup <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> r? @emilio <!-- 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/13917) <!-- Reviewable:end -->
|
|
wafflespeanut commentedOct 25, 2016
•
edited
We're using
keyword_listto generate code for some of the animation properties. This could be achieved withsingle_keyword(passingvector=True)../mach build -ddoes not report any errors./mach build-geckolibdoes not report any errorsr? @emilio
This change is