Closed
Bug 1401317
Opened 7 years ago
Closed 7 years ago
stylo: Broken rendering of -moz-selection text when stylo is enabled
Categories
(Core :: CSS Parsing and Computation, defect, P2)
Tracking
()
RESOLVED
FIXED
mozilla57
Tracking | Status | |
---|---|---|
firefox-esr52 | --- | unaffected |
firefox55 | --- | unaffected |
firefox56 | --- | unaffected |
firefox57 | --- | fixed |
People
(Reporter: jfkthame, Assigned: bholley)
References
Details
(Keywords: regression)
Attachments
(7 files)
81.27 KB,
image/png
|
Details | |
62.27 KB,
image/png
|
Details | |
55.07 KB,
image/png
|
Details | |
1.52 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
59 bytes,
text/x-review-board-request
|
Details | |
6.64 KB,
patch
|
emilio
:
review+
|
Details | Diff | Splinter Review |
2.40 KB,
patch
|
emilio
:
review+
|
Details | Diff | Splinter Review |
The rendering of selected text when -moz-selection is used seems to be significantly broken when stylo is enabled.
Using attachment 610677 [details] (testcase from bug 721750), load the example and then press Cmd-A to Select All (on macOS).
Two issues:
First, the highlighting when stylo is enabled is very different from the non-stylo version (compare screenshots 1 and 2).
Second, pressing Cmd-A a second time (or any number of additional times) changes the stylo highlighting again (compare screenshots 2 and 3). Indeed, the result varies depending exactly how the content is selected. (So selecting individual words or lines may give different results from selecting the whole text.) This inconsistent behavior is clearly unexpected.
Reporter | ||
Comment 1•7 years ago
|
||
Reporter | ||
Comment 2•7 years ago
|
||
Reporter | ||
Comment 3•7 years ago
|
||
This does seem to be a Mac-specific issue; I'm not seeing similar behavior on Windows.
OS: Unspecified → Mac OS X
Reporter | ||
Comment 4•7 years ago
|
||
Not Mac-only after all, I'm seeing similar behavior on Linux. Maybe it's a recent regression and my Windows build is too old to show it...?
Reporter | ||
Comment 5•7 years ago
|
||
Yup. Broken in latest Windows nightly, too.
Keywords: regression
OS: Mac OS X → All
Updated•7 years ago
|
Summary: [stylo] Broken rendering of -moz-selection text when stylo is enabled → stylo: Broken rendering of -moz-selection text when stylo is enabled
Reporter | ||
Comment 6•7 years ago
|
||
mozregression says this started with:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=5e5eab26b9dec16c05f70c351d78863f8cb23900&tochange=ff89cb83be0a2a1ba74099c839d4f796981dda67
which points at https://github.com/servo/servo/pull/18496.
Reporter | ||
Updated•7 years ago
|
Flags: needinfo?(bobbyholley)
Assignee | ||
Updated•7 years ago
|
Priority: -- → P2
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → bobbyholley
Assignee | ||
Comment 7•7 years ago
|
||
So the basic problem here is that the simplification in bug 1368291 comment 9 doesn't hold anymore.
I'll attach a reftest.
Assignee | ||
Comment 8•7 years ago
|
||
MozReview-Commit-ID: KnGCuU0rcgi
Attachment #8910027 -
Flags: review+
Assignee | ||
Comment 9•7 years ago
|
||
There are various ways to solve this. Emilio, any preference on which way?
Flags: needinfo?(emilio)
Comment 10•7 years ago
|
||
(In reply to Bobby Holley (:bholley) (busy with Stylo) from comment #7)
> So the basic problem here is that the simplification in bug 1368291 comment
> 9 doesn't hold anymore.
This doesn't have nothing to do with that simplification, but with the general lazy pseudo style cache mechanism.
(In reply to Bobby Holley (:bholley) (busy with Stylo) from comment #9)
> There are various ways to solve this. Emilio, any preference on which way?
I'm not totally sure about what kind of ways are you thinking about.
The lazy pseudo-style cache didn't help memory that much when we land it, so easiest thing is just remove it, and get back that word in the style contexts.
However, if we really really want to keep it, I guess we'd need to resolve the style and just compare the rule node pointers to cache them.
Looking at the list of pseudo-elements, the only ones worth sharing are :-moz-list-bullet and :-moz-list-number... And per bz's comment right above it, maybe we should just convert them to inheriting anonymous boxes (post-57, ofc).
It's not clear the lazy pseudo cache is a great memory win, so I'd propose just getting rid of it.
Flags: needinfo?(emilio)
Comment 11•7 years ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #10)
> Looking at the list of pseudo-elements, the only ones worth sharing are
> :-moz-list-bullet and :-moz-list-number... And per bz's comment right above
> it, maybe we should just convert them to inheriting anonymous boxes
> (post-57, ofc).
it == the pseudo-element definition, in particular:
// XXXbz should we really allow random content to style these? Maybe
// use our flags to prevent that?
CSS_PSEUDO_ELEMENT(mozListBullet, ":-moz-list-bullet", 0)
CSS_PSEUDO_ELEMENT(mozListNumber, ":-moz-list-number", 0)
Comment hidden (mozreview-request) |
Assignee | ||
Comment 13•7 years ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #10)
> (In reply to Bobby Holley (:bholley) (busy with Stylo) from comment #7)
> > So the basic problem here is that the simplification in bug 1368291 comment
> > 9 doesn't hold anymore.
>
> This doesn't have nothing to do with that simplification, but with the
> general lazy pseudo style cache mechanism.
Per IRC discussion, my original comment holds.
> (In reply to Bobby Holley (:bholley) (busy with Stylo) from comment #9)
> > There are various ways to solve this. Emilio, any preference on which way?
>
> I'm not totally sure about what kind of ways are you thinking about.
The two that I had in mind where (1) matching before sharing, and (2) disabling caching when the primary style was reused via the second pass.
>
> The lazy pseudo-style cache didn't help memory that much when we land it
Per bug 1367862 comment 22, the impact isn't negligible. I'd imagine it varies a lot by page, but it basically boils down to an extra CV per <li> element, and it's not such a stretch to think that there are pages out there with a lot of <li> elements.
> , so
> easiest thing is just remove it, and get back that word in the style
> contexts.
>
> However, if we really really want to keep it, I guess we'd need to resolve
> the style and just compare the rule node pointers to cache them.
I think option (2) above is pretty simple and low-risk. I'll attach a patch for that.
>
> Looking at the list of pseudo-elements, the only ones worth sharing are
> :-moz-list-bullet and :-moz-list-number... And per bz's comment right above
> it, maybe we should just convert them to inheriting anonymous boxes
> (post-57, ofc).
That sounds like a good plan, filed bug 1401449 for it.
Assignee | ||
Comment 14•7 years ago
|
||
MozReview-Commit-ID: IkBa39E1bR1
Attachment #8910121 -
Flags: review?(emilio)
Assignee | ||
Comment 15•7 years ago
|
||
This makes it easier to detect sharing-related weirdness in the future.
MozReview-Commit-ID: 8U0xekMHGg8
Attachment #8910122 -
Flags: review?(emilio)
Assignee | ||
Comment 16•7 years ago
|
||
Comment 17•7 years ago
|
||
Do you really think it's worth to share style across <li> element at the expense of an extra word for every single style context? It doesn't sound like an obvious win at all to me. And honestly the less code that interacts with the ElementData flags the best over all, I think.
Flags: needinfo?(bobbyholley)
Updated•7 years ago
|
Attachment #8910122 -
Flags: review?(emilio) → review+
Comment 18•7 years ago
|
||
I'd rather take a few numbers here now that we have proper memory reporting, and remove the code if that optimization doesn't look worth it.
Comment 19•7 years ago
|
||
Comment on attachment 8910121 [details] [diff] [review]
Disable lazy pseudo caching when the originating element's primary style was reused via the rule node. v1
Review of attachment 8910121 [details] [diff] [review]:
-----------------------------------------------------------------
Per IRC discussion, let's do this, I guess we can always get rid of this later...
::: servo/ports/geckolib/glue.rs
@@ +844,5 @@
> }
>
> #[no_mangle]
> +pub extern "C" fn Servo_Element_IsPrimaryStyleReusedViaRuleNode(element: RawGeckoElementBorrowed) -> bool
> +{
nit: Either brace to the previous line, or alignment of the argument as a block, your call. While you're here you can also fixup the previous function.
Attachment #8910121 -
Flags: review?(emilio) → review+
Comment 20•7 years ago
|
||
07:43 <emilio> bholley: do you really think it's worth it to sacrifice a word in every single style context to share styles on <li> elements? It doesn't seem obvious to me that it's a win
07:52 <bholley> emilio: hard to say about the average, but the worst-case behavior is better. In any case, it seems weird to use this bug to revive that whole tradeoff analysis two days before the merge. I'd be sympathetic if it were our only easy option, but we have another one
07:52 <bholley> emilio: so I'm more inclined to land the minimal change for now, and then try to ship the anon box thing in 58
Flags: needinfo?(bobbyholley)
Assignee | ||
Comment 21•7 years ago
|
||
Thanks!
https://github.com/servo/servo/pull/18571
(The servo changes are not interdependent with the gecko ones, so I'll let that land overnight and then push the gecko bits in the morning)
Assignee | ||
Comment 22•7 years ago
|
||
(In reply to Bobby Holley (:bholley) (busy with Stylo) from comment #21)
> Thanks!
>
> https://github.com/servo/servo/pull/18571
Servo-side changes landed as https://hg.mozilla.org/integration/autoland/rev/4d6c6ad56429
Comment 23•7 years ago
|
||
Pushed by bholley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ef5d46900a24
Disable lazy pseudo caching when the originating element's primary style was reused via the rule node. r=emilio
https://hg.mozilla.org/integration/autoland/rev/cd809c5e79a5
Reftest. r=me
Comment 24•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ef5d46900a24
https://hg.mozilla.org/mozilla-central/rev/cd809c5e79a5
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Updated•7 years ago
|
status-firefox55:
--- → unaffected
status-firefox56:
--- → unaffected
status-firefox-esr52:
--- → unaffected
Assignee | ||
Updated•7 years ago
|
Attachment #8910070 -
Flags: review?(bobbyholley)
You need to log in
before you can comment on or make changes to this bug.
Description
•