Repository navigation
Implement ::selection pseudo-element - #10252
Conversation
|
Heads up! This PR modifies the following files:
|
|
Reviewed 2 of 9 files at r1, 1 of 1 files at r3. components/layout/construct.rs, line 590 [r3] (raw file): components/layout/construct.rs, line 1870 [r3] (raw file): Comments from the review on Reviewable.io |
|
Review status: 2 of 10 files reviewed at latest revision, 2 unresolved discussions. components/layout/construct.rs, line 590 [r3] (raw file): Done components/layout/construct.rs, line 1870 [r3] (raw file): Comments from the review on Reviewable.io |
|
Reviewed 6 of 9 files at r1, 2 of 2 files at r4. components/layout/fragment.rs, line 89 [r4] (raw file): Adding a field to components/layout/generated_content.rs, line 441 [r3] (raw file): components/layout/inline.rs, line 1854 [r4] (raw file): Comments from the review on Reviewable.io |
|
Review status: all files reviewed at latest revision, 3 unresolved discussions. components/layout/fragment.rs, line 89 [r4] (raw file): The first option I thought was making Also, if we did that that way, we'd still need both the I haven't done enough layout to see if I'm right or not though, so if you know a way this could work, I'm happy to experiment with it. Adding the selected styles in the current components/layout/generated_content.rs, line 441 [r3] (raw file): components/layout/inline.rs, line 1854 [r4] (raw file): Anyway, I don't think that makes Comments from the review on Reviewable.io |
|
Review status: 8 of 9 files reviewed at latest revision, 3 unresolved discussions. components/layout/inline.rs, line 1854 [r4] (raw file): Comments from the review on Reviewable.io |
|
Reviewed 2 of 2 files at r5. components/layout/fragment.rs, line 89 [r4] (raw file):
Yes, I envisioned adding a new style struct for selection properties, with only the handful of supported properties.
@SimonSapin, any thoughts on this? components/layout/generated_content.rs, line 441 [r3] (raw file): components/layout/inline.rs, line 1854 [r4] (raw file): Comments from the review on Reviewable.io |
|
Review status: 2 of 10 files reviewed at latest revision, 2 unresolved discussions. components/layout/fragment.rs, line 89 [r4] (raw file):
I’m mildly opposed to this as it mixes up unrelated concepts. Comments from the review on Reviewable.io |
|
Review status: 2 of 10 files reviewed at latest revision, 2 unresolved discussions. components/layout/fragment.rs, line 89 [r4] (raw file): It appears it computes it on demand, the text frame has access to the presentation context, and also to the element it belongs to, and gathers the styles from there. It'd be equivalent for us to have access to the node and to its style data from the text fragment, which is what I had in mind initially, but doesn't seem easy/safe to convert the opaque node into the Comments from the review on Reviewable.io |
|
After #10255 lands this will require an update to |
|
This code all looks great to me; my only remaining concern is whether the performance impact is reasonable. Here are my thoughts:
@pcwalton, any opinion on landing this as-is versus fixing the above issues first (especially number 2)? -S-awaiting-review +S-needs-decision +S-needs-rebase Reviewed 8 of 8 files at r6. Comments from the review on Reviewable.io |
Oh wait, once again this is not as bad as I thought. I forgot that ServoComputedValues only holds Arcs to the actual style structs, rather than storing them inline. And it will clone these Arcs rather than copying the structs, almost all of the time. That's still a number of new allocations and Arc::clone calls, but it's not nearly as much memory as I feared. |
This will likely be the case, won’t it? To set the default colors in the user-agent stylesheet. |
Since selection only works in textareas and inputs, for now we can reduce the impact using |
|
Rebased and updated the test expectations |
|
@bors-servo r+ Let's do this! -S-needs-decision Reviewed 12 of 12 files at r7. Comments from the review on Reviewable.io |
|
📌 Commit 46829bd has been approved by |
Implement ::selection pseudo-element It only supports `color` and `background`, for now, but it shouldn't be hard to add more properties (like text-shadow). r? @mbrubeck <!-- 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/10252) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, status-appveyor |
Did that ever happen? |
|
It looks like the UA stylesheets don’t have any |
|
On Thu, Mar 31, 2016 at 6:05 AM, Simon Sapin [email protected]
Submitted yesterday, but still waiting in the homu queue: |
Set a default ::selection style Since we no longer have a hard-coded default after #10252. <!-- 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/10299) <!-- Reviewable:end -->
It only supports
colorandbackground, for now, but it shouldn't be hard to add more properties (like text-shadow).r? @mbrubeck
This change is