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 upstyle: Add infrastructure to support lazy pseudo-elements #10934
Conversation
highfive
commented
Apr 29, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Apr 29, 2016
| PseudoElementCascadeType::Lazy => { | ||
| panic!("Lazy pseudo-elements can't be used in Servo \ | ||
| since accessing the DOM tree during layout \ | ||
| could be unsafe.") |
This comment has been minimized.
This comment has been minimized.
emilio
Apr 29, 2016
Author
Member
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...)
This comment has been minimized.
This comment has been minimized.
bholley
Apr 29, 2016
Contributor
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.
This comment has been minimized.
This comment has been minimized.
mbrubeck
Apr 29, 2016
Contributor
Right, it is unsafe for a ThreadSafeLayoutNode to access its parents or siblings.
This comment has been minimized.
This comment has been minimized.
emilio
Apr 30, 2016
Author
Member
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.
This comment has been minimized.
This comment has been minimized.
mbrubeck
May 2, 2016
Contributor
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.
This comment has been minimized.
This comment has been minimized.
emilio
May 3, 2016
Author
Member
Yup, just did that and cleaned it up a bit, feel free to re-review the changes :)
| MozTreeDropFeedback | MozSVGMarkerAnonChild | | ||
| MozSVGOuterSVGAnonChild | MozSVGForeignContent | | ||
| MozSVGText => true, | ||
| _ => false, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
mbrubeck
Apr 29, 2016
Contributor
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.
| // data.style_data.per_pseudo | ||
| // .insert(style_pseudo.clone(), new_style.unwrap()) | ||
| // } | ||
| } |
This comment has been minimized.
This comment has been minimized.
|
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. :-) |
highfive
commented
May 3, 2016
|
New code was committed to pull request. |
highfive
commented
May 3, 2016
|
New code was committed to pull request. |
highfive
commented
May 3, 2016
|
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 |
highfive
commented
May 3, 2016
|
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) { |
This comment has been minimized.
This comment has been minimized.
bholley
May 4, 2016
Contributor
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 |
|
|
|
|
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 -->
|
|
highfive
commented
May 4, 2016
|
|
@bors-servo: retry |
|
|
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 -->
|
|
emilio commentedApr 29, 2016
•
edited by larsbergstrom
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