Repository navigation
style: Add infrastructure to support lazy pseudo-elements - #10934
Conversation
|
Heads up! This PR modifies the following files:
|
| PseudoElementCascadeType::Lazy => { | ||
| panic!("Lazy pseudo-elements can't be used in Servo \ | ||
| since accessing the DOM tree during layout \ | ||
| could be unsafe.") |
There was a problem hiding this comment.
Not totally sure about this, @mbrubeck, do you know if it'd be safe for ServoThreadSafeLayoutElement to implement selectors::Element? (that is, getting parent, siblings...)
There was a problem hiding this comment.
I'm pretty sure it would not be, but I'll let @mbrubeck confirm. Might need to think a bit on how this fits into the Servo model.
There was a problem hiding this comment.
Right, it is unsafe for a ThreadSafeLayoutNode to access its parents or siblings.
There was a problem hiding this comment.
We could still use a subset of selector-matching though (attributes + tag name at least), enough for avoiding doing the whole cascade for some private pseudos, like ::-servo-details-summary, which only needs access to the details tag and the open attribute.
Would this be desirable (with appropriate docs of course), or is it just a lot of overhead? I think it can be worth it but I'd like to know your opinion.
There was a problem hiding this comment.
That seems reasonable to me; I guess all it would require is an impl of Element that just returns None for things like parent_element.
There was a problem hiding this comment.
Yup, just did that and cleaned it up a bit, feel free to re-review the changes :)
|
geckolib changes look good modulo that one change. |
| /// A wrapper around elements that ensures layout can only ever access safe properties and cannot | ||
| /// race on elements. | ||
| /// A wrapper around elements that ensures layout can only | ||
| /// ever access safe properties and cannot race on elements. |
There was a problem hiding this comment.
Nit: Rust style is to wrap at 99 columns. I don't care too deeply about exactly where comments wrap, but if you can configure your editor not to re-format things to 80 columns, it would make reviews a little easier.
|
The Servo changes are good; r=mbrubeck with the commented-out code removed. Note: I left a couple of other review comments but then deleted them because they were incorrect. (This is what I get for using GitHub comments instead of Reviewable.) Please disregard any comments that no longer appear in the GitHub UI. |
|
Now that #10815 is merged, should this commit be rebased on top of it (so that GitHub only lists one commit for this PR)? |
|
Yes. I'm guessing @emilio will do that sometime when he's awake. :-) |
3c3e9ef to
b1002cb
Compare
b1002cb to
1446e24
Compare
|
New code was committed to pull request. |
These can't be supported in Servo as of right now, because I'm not totally sure the accesses that should be done in layout would be thread-safe. It can be revisited later though.
cb98bac to
845b2d9
Compare
|
New code was committed to pull request. |
845b2d9 to
1138b89
Compare
|
New code was committed to pull request. |
|
-S-awaiting-review +S-needs-code-changes Reviewed 6 of 6 files at r1, 2 of 11 files at r2, 3 of 7 files at r19, 3 of 6 files at r23, 3 of 3 files at r24. components/layout/wrapper.rs, line 1360 [r24] (raw file): components/style/selector_impl.rs, line 117 [r24] (raw file): Comments from Reviewable |
1138b89 to
1800c23
Compare
…youtElement methods
Thanks to Simon for the feedback :)
c961f77 to
0f7b70c
Compare
|
New code was committed to pull request. |
|
Ok, rebased, typo fixed, and implemented r? @bholley (for the stylo changes, the rest is reviewed) Review status: 9 of 13 files reviewed at latest revision, 3 unresolved discussions. docs/components/style.md, line 126 [r26] (raw file): Comments from Reviewable |
| } | ||
| }; | ||
|
|
||
| let pseudo = match pseudo_element_from_atom(pseudo_tag, /* ua_stylesheet = */ true) { |
There was a problem hiding this comment.
We'll want to pass the appropriate value here from the caller right? I'll add a TODO.
|
Looks great! @bors-servo r=bholley,mbrubeck |
|
📌 Commit 0f7b70c has been approved by |
|
⌛ Testing commit 0f7b70c with merge 04012c1... |
style: Add infrastructure to support lazy pseudo-elements This builds on top of #10815, so it's really just the last commit the one that should be reviewed. I tried to apply the new infrastructure to servo, but failed (for now?). The problem with it is that it'd require `ThreadSafeLayoutElement` to implement `selectors::Element`, which is a lot of work and might be racy (not totally sure about it though). Thus, I prefered to keep selectors eager until knowing that it's safe to do it. r? @mbrubeck for style changes, @bholley for the geckolib changes (minimal for now, glue + a list of lazy PEs must be added) <!-- 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/10934) <!-- Reviewable:end -->
|
💔 Test failed - linux-rel |
|
|
@bors-servo: retry |
|
⌛ Testing commit 0f7b70c with merge 29823cb... |
style: Add infrastructure to support lazy pseudo-elements This builds on top of #10815, so it's really just the last commit the one that should be reviewed. I tried to apply the new infrastructure to servo, but failed (for now?). The problem with it is that it'd require `ThreadSafeLayoutElement` to implement `selectors::Element`, which is a lot of work and might be racy (not totally sure about it though). Thus, I prefered to keep selectors eager until knowing that it's safe to do it. r? @mbrubeck for style changes, @bholley for the geckolib changes (minimal for now, glue + a list of lazy PEs must be added) <!-- 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/10934) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows |
This builds on top of #10815, so it's really just the last commit the one that should be reviewed.
I tried to apply the new infrastructure to servo, but failed (for now?).
The problem with it is that it'd require
ThreadSafeLayoutElementto implementselectors::Element, which is a lot of work and might be racy (not totally sure about it though). Thus, I prefered to keep selectors eager until knowing that it's safe to do it.r? @mbrubeck for style changes, @bholley for the geckolib changes (minimal for now, glue + a list of lazy PEs must be added)
This change is