-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Implement parsing/serialization and glue for will-change property #15813
Conversation
Heads up! This PR modifies the following files:
|
Parsing/serialization of the will-change property is completed but the current glue is crashing in a stylo build. I'm doing something wrong when assigning values to mWillChange( |
2d94066
to
f84a825
Compare
r? @upsuper ? I'm not quite familiar with the will-change stuff. @canaltinova there are methods on nsTarray defined in gecko_bindings/sugar/ns_t_array.rs. You can use those to set its length, and then mutate elements. Be careful, the Rust code doesn't know how to run C++ side constructors, so setting the length will give you an array full of garbage data, into which you have to move the strings. |
Reviewed 3 of 3 files at r1, 6 of 6 files at r2. components/style/properties/properties.mako.rs, line 455 at r2 (raw file):
Having three individual functions for things which are mostly used together seems to be bad both for code size and for performance. Could you merge these functions together and make it a bitflag? I guess this can become a general mechanism for having flags on properties. components/style/properties/longhand/box.mako.rs, line 1972 at r1 (raw file):
You can use the components/style/properties/longhand/box.mako.rs, line 1988 at r1 (raw file):
Actually I'm not sure whether it's worth distinguishing these two values from other identifiers. Effectively they are just another two identifiers. Doing so makes the code look more similiar to what the spec describes, but it takes a bit runtime cost. I guess I can live either way, though. components/style/properties/longhand/box.mako.rs, line 1989 at r1 (raw file):
Probably better using components/style/properties/longhand/box.mako.rs, line 1994 at r1 (raw file):
I don't think you need to add separate components/style/properties/longhand/box.mako.rs, line 2002 at r1 (raw file):
This may need to exclude CSS-wide keywords as well... or probably Comments from Reviewable |
Review status: 0 of 9 files reviewed at latest revision, 6 unresolved discussions. components/style/properties/longhand/box.mako.rs, line 1972 at r1 (raw file): Previously, upsuper (Xidorn Quan) wrote…
Done. components/style/properties/longhand/box.mako.rs, line 1988 at r1 (raw file): Previously, upsuper (Xidorn Quan) wrote…
Yes, you're right. I thought the same while I was implementing this and decided to make that way. But it seems like performance is a bigger factor. Also simplifies the code. Changed it. components/style/properties/longhand/box.mako.rs, line 1989 at r1 (raw file): Previously, upsuper (Xidorn Quan) wrote…
Used components/style/properties/longhand/box.mako.rs, line 1994 at r1 (raw file): Previously, upsuper (Xidorn Quan) wrote…
Done. components/style/properties/longhand/box.mako.rs, line 2002 at r1 (raw file): Previously, upsuper (Xidorn Quan) wrote…
Yes, tested it and CSS-wide keywords were passing. Excluded them. Thanks. Comments from Reviewable |
@upsuper The flags are being held in mako right now. We need to check in some function and transfer it to rust. Are you suggesting to hold them somewhere else and check them with bitflags? If you are not, probably mako will increase the complexity of the function with bitflags. Could you elaborate? |
@upsuper Oh, it looks like stylo atoms are in this auto generated file: |
Add "contents" and "scroll-position" keywords to local names They are needed for servo/servo#15813 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/html5ever/256) <!-- Reviewable:end -->
Reviewed 1 of 2 files at r3. components/style/properties/longhand/box.mako.rs, line 2002 at r1 (raw file): Previously, canaltinova (Nazım Can Altınova) wrote…
Hmmm, I really think this should be done in cssparser rather than each separate property, so probably there is nothing you should change here. Comments from Reviewable |
My idea is that we can do something like bitflags! {
pub flags PropertyFlags: u8 {
const CREATES_STACKING_CONTEXT = 0x01,
const FIXPOS_CB = 0x02,
const ABSPOS_CB = 0x04,
}
}
pub fn flags(&self) -> PropertyFlags {
match *self {
% for property in data.longhands:
LonghandId::${property.camel_case} =>
%if property.creates_stacking_context:
CREATES_STACKING_CONTEXT |
%endif
%if property.fixpos_cb:
FIXPOS_CB |
%endif
%if property.abspos_cb:
ABSPOS_CB |
%endif
PropertyFlags::empty(),
% endfor
}
} |
I can do that. |
Reviewed 9 of 9 files at r4, 6 of 6 files at r5, 2 of 2 files at r6. Comments from Reviewable |
Review status: all files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. components/style/properties/longhand/box.mako.rs, line 1989 at r1 (raw file): Previously, canaltinova (Nazım Can Altınova) wrote…
It doesn't seem to me we need Comments from Reviewable |
#15846 for updating the atom list from gecko. |
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev |
The flags are creates_stacking_context, fixpos_cb and abspos_cb. These will be needed in will-change glue.
Thanks for the reviews! |
📌 Commit ea1e405 has been approved by |
Implement parsing/serialization and glue for will-change property Implement parsing/serialization and glue for will-change property --- <!-- 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 test-tidy` does not report any errors - [X] These changes fix #15706 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/15813) <!-- Reviewable:end -->
💔 Test failed - mac-rel-wpt1 |
@bors-servo retry |
⚡ Previous build results for android, arm32, arm64, linux-dev, linux-rel-wpt, mac-dev-unit, windows-msvc-dev are reusable. Rebuilding only linux-rel-css, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2... |
1 similar comment
⚡ Previous build results for android, arm32, arm64, linux-dev, linux-rel-wpt, mac-dev-unit, windows-msvc-dev are reusable. Rebuilding only linux-rel-css, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2... |
@bors-servo clean retry r- r=upsuper,emilio |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit ea1e405 has been approved by |
Implement parsing/serialization and glue for will-change property Implement parsing/serialization and glue for will-change property --- <!-- 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 test-tidy` does not report any errors - [X] These changes fix #15706 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/15813) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev |
Implement parsing/serialization and glue for will-change property
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is