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
Prefer auto-generation for some keyword props #13902
Conversation
Heads up! This PR modifies the following files:
|
// And, firefox doesn't support 'pixelated' (https://bugzilla.mozilla.org/show_bug.cgi?id=856337) | ||
${helpers.single_keyword("image-rendering", | ||
"auto crispedges", | ||
extra_gecko_values="optimizequality optimizespeed", |
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 needs to be manual, since the serialization is custom, and there's some aliasing going on.
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.
Okay, yeah, the problem lies in crisp-edges
. I'll better add an option for that in python.
r? @emilio |
ce6890d
to
58f93c8
Compare
@emilio The parsing/serialization code for |
# This is a workaround for gecko constants with unexpected names i.e., a constant | ||
# corresponding to a keyword 'foo-bar' declared as FOOBAR instead of FOO_BAR | ||
if self.keyword is not None: | ||
self.keyword.ignore_hyphens = ignore_hyphens |
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 this feels a lot like a hack. If we want to both work-around it and auto-generate it, I think instead of this we should be passing a "keyword to constant" map instead, and then look it up in gecko_constant
or replace otherwise.
What do you 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.
IMO workarounds like ignore_hyphens
that get used just once probably shouldn't exist 😄 I'd prefer if we manually did image-rendering. Though I'm good with the map solution too.
58f93c8
to
31fb345
Compare
@emilio @Manishearth So, I've gone for predicting constants based on their edit distance (python has a built-in object for that). It works quite well for all the constants we generate now. You think this would be useful? If it is, then I'll go ahead and fix the tests. If it's not, then I'll revert the changes to image-rendering stuff and we'll land this. |
31fb345
to
1e7d854
Compare
dabef3f
to
74265fd
Compare
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.
r=me with those addressed, thanks for doing this! :)
@@ -312,6 +312,7 @@ | |||
keyword_kwargs = {a: kwargs.pop(a, None) for a in [ | |||
'gecko_constant_prefix', 'gecko_enum_prefix', | |||
'extra_gecko_values', 'extra_servo_values', | |||
'custom_consts', |
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's another instance of this same list below (line 359)
pub mod computed_value { | ||
use cssparser::ToCss; | ||
use std::fmt; | ||
<% consts_map = { "crisp-edges": "CRISPEDGES" } %> |
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.
rename to image_rendering_custom_consts
?
fb6a195
to
ff27e4f
Compare
@bors-servo r=emilio |
📌 Commit ff27e4f has been approved by |
Prefer auto-generation for some keyword props <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build-geckolib` does not report any errors <!-- Either: --> - [x] These changes do not require tests because it's a refactor <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> r? @Manishearth or @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/13902) <!-- Reviewable:end -->
💔 Test failed - linux-rel-wpt |
ff27e4f
to
e7cbd10
Compare
@bors-servo r=emilio Oops. Forgot to change the enum variants in other crates :) |
📌 Commit e7cbd10 has been approved by |
⌛ Testing commit e7cbd10 with merge 3c16dde... |
Prefer auto-generation for some keyword props <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build-geckolib` does not report any errors <!-- Either: --> - [x] These changes do not require tests because it's a refactor <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> r? @Manishearth or @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/13902) <!-- Reviewable:end -->
💔 Test failed - linux-rel-wpt |
@bors-servo retry #13776 |
⚡ Previous build results for mac-dev-unit, windows-dev are reusable. Rebuilding only arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2... |
☀️ Test successful - arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-dev |
./mach build-geckolib
does not report any errorsr? @Manishearth or @emilio
This change is