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
Renamed the style structs #10324
Renamed the style structs #10324
Conversation
Heads up! This PR modifies the following files:
|
r? @bholley |
@@ -16,7 +16,7 @@ use std::mem; | |||
use std::sync::Arc; | |||
|
|||
use app_units::Au; | |||
use cssparser::{Parser, Color, RGBA, AtRuleParser, DeclarationParser, Delimiter, | |||
use cssparser::{Parser, RGBA, AtRuleParser, DeclarationParser, Delimiter, |
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 is just me trying to work around name clashes; it may be that removing this causes the generated code to be completely wrong (meaning, that references to cssparser::Color
might get incorrectly replaced by our local Color
struct...). So this may very well be one of the parts that should get reverted.
No rush on reviewing this one - I have a followup coming up, where I remove (postpone) the trait change. Leave this pending for a little while; will let you know when I've amended the previous commit (and then also, it hopefully builds on Travis). |
5f45265
to
5db316f
Compare
@bholley - I managed to sort this out to properly build (both with |
@@ -62,8 +62,7 @@ try: | |||
style_template.render() | |||
|
|||
geckolib_template = Template(filename=os.environ['GECKOLIB_TEMPLATE'], input_encoding='utf8') | |||
output = geckolib_template.render(STYLE_STRUCTS = style_template.module.STYLE_STRUCTS, | |||
LONGHANDS = style_template.module.LONGHANDS) |
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 looked around and couldn't find any actual usage of the LONGHANDS
constant, so I dropped it.
Reviewed 4 of 8 files at r2. components/gfx/font.rs, line 19 [r2] (raw file): components/layout/text.rs, line 27 [r2] (raw file): components/style/properties.mako.rs, line 19 [r1] (raw file): components/style/properties.mako.rs, line 99 [r1] (raw file): Do you have any ideas on how to improve this? Comments from Reviewable |
(Not finished with the review, but I need to go to bed, and thought I might as well post the feedback I have. I'll get back to this tomorrow or monday). |
(one solution to the naming weirdness could be servo_struct_name, gecko_struct_name, and gecko_ffi_name). Or something. |
I think that would be a reasonable workaround. That would make (I'll wait with implementing the changes until you've reviewed it all, and do all cleanups in one run.) Review status: 4 of 8 files reviewed at latest revision, 5 unresolved discussions. components/gfx/font.rs, line 19 [r2] (raw file): My gut feeling is that if we need to alias the types when we use them, the struct name isn't clear enough... But I guess we wouldn't want to call them all components/style/properties.mako.rs, line 19 [r1] (raw file): Comments from Reviewable |
☔ The latest upstream changes (presumably #10359) made this pull request unmergeable. Please resolve the merge conflicts. |
5db316f
to
0e758e0
Compare
@bholley - I rebased the PR now, and incorporated some of your suggestions (amended the previous commit). Feel free to re-check it if you like. |
Reviewed 2 of 8 files at r2, 4 of 4 files at r3. components/gfx/font.rs, line 19 [r2] (raw file): SpecifiedFontStyle is a fine name in this context, FWIW. Given that that's the only usage, maybe we should just make this: pub use style::properties::style_structs::ServoFont as SpecifiedFontStyle? Though actually, that also seems wrong because the style struct is computed style, not specified style. So we should probably call it ComputedFontStyle. @pcwalton, can you confirm that this makes sense? components/layout/text.rs, line 27 [r2] (raw file): components/style/properties.mako.rs, line 6124 [r3] (raw file): Comments from Reviewable |
I think I'll wait until finalization on the discussions around the naming before completing this on. Review status: all files reviewed at latest revision, 4 unresolved discussions. components/style/properties.mako.rs, line 6124 [r3] (raw file): Comments from Reviewable |
Ok. needinfo @pcwalton, @SimonSapin, or @mbrubeck about renaming SpecifiedFontStyle to ComputedFontStyle. |
Yes, every value that layout/gfx gets for CSS properties from the style crate is a "computed value". (In some cases they may go on to calculating "used values" themselves, e.g. percentage widths.) "Specified values" mostly don’t exist outside of the style crate or CSSOM. https://drafts.csswg.org/css-cascade/#value-stages So |
@perlun Does that give you what you need to push this over the line? |
☔ The latest upstream changes (presumably #10407) made this pull request unmergeable. Please resolve the merge conflicts. |
Yep, sounds good! Will look it into the next few days. I am not (yet! 😉) working for Mozilla full-time so that's why it's taking a bit more time. |
Of course - let me know if you need anything. This may need to be rebased over various changes that are landing simultaneously, but hopefully it shouldn't be too bad. :-) |
The idea is to rename all style structs from Foo to ServoFoo, as described out in servo#10185.
0e758e0
to
96835c6
Compare
@bholley - should be good to go now. Please re-check whenever you have some time. I'll fix the drop-the-T-prefix part once this is landed. |
Reviewed 5 of 6 files at r4. components/gfx/font.rs, line 19 [r2] (raw file): Comments from Reviewable |
Though honestly I think we should just get this landed - We'll deal with the rest in the followup. @bors-servo r+ |
📌 Commit 96835c6 has been approved by |
Renamed the style structs Renamed style structs. The idea is to rename all style structs from Foo to ServoFoo, as described out in #10185. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10324) <!-- Reviewable:end -->
Ah, you're right... @SimonSapin said either go with |
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt |
Thanks for the contribution! :-) |
Renamed style structs.
The idea is to rename all style structs from Foo to ServoFoo, as described out in #10185.
This change is