Revert dynamic line clamping in favor of performant static line clamping
Categories
(Firefox :: New Tab Page, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr60 | --- | unaffected |
firefox67 | --- | unaffected |
firefox68 | + | verified |
firefox69 | --- | verified |
People
(Reporter: Mardak, Assigned: Mardak)
References
(Regression)
Details
(Keywords: github-merged, regression)
Attachments
(6 files)
The line clamping code from bug 1551359 checks scrollHeight to determine how many lines the normal text would want, but some reason with separatePrivilegedContentProcess=true
(default on Nightly), sometimes scrollHeight returns just 1-line of height.
E.g., adding this ref to the header.title for DSCard_DSCard in the bundle.js:
diff --git a/browser/components/newtab/data/content/activity-stream.bundle.js b/browser/components/newtab/data/content/activity-stream.bundle.js
--- a/browser/components/newtab/data/content/activity-stream.bundle.js
+++ b/browser/components/newtab/data/content/activity-stream.bundle.js
@@ -8029,2 +8029,3 @@ class DSCard_DSCard extends external_React_default.a.PureComponent {
}, this.props.source), external_React_default.a.createElement("header", {
+ ref: h => (h && (h.s = h.scrollHeight) && setTimeout(() => console.log(h.s, h.scrollHeight))),
className: "title clamp",
sometimes prints 19 48
It looks like the 19 is the unstyled height which then makes some sense in that I see the same 19 if I remove the stylesheet from prerendered/locales/en-US/activity-stream-noscripts.html
:
<link rel="stylesheet" href="resource://activity-stream/css/activity-stream.css" />
So… ? First guess is somehow the scripts get loaded too soon (??)
Assignee | ||
Comment 1•5 years ago
|
||
To be clear, I don't see this with separatePrivilegedContentProcess=false
which results in https://searchfox.org/mozilla-central/source/browser/components/newtab/prerendered/locales/en-US/activity-stream.html getting loaded. That file has
<link stylesheet>
…
<script bundle.js>
So I guess that ensures the scripts are loaded after styles ?
Comment 2•5 years ago
|
||
Assignee | ||
Comment 3•5 years ago
|
||
In the PR, I added a couple nested requestAnimationFrame
s to avoid forcing many synchronous reflows triggered when each card gets mounted then checking sizing with scrollHeight
to then immediately invalidate by setting a line clamp -- repeat reflow for every single child.
The PR reduces on my development machine clamping time from 55.3ms/load to 4.7ms/load. But it does introduce some jank because the clamping is applied on a later frame but that actually happens to avoid the separatePrivilegedContentProcess=true
issue of scripts running before styles. Most users won't see the jank anyway as new tabs are preloaded and probably aren't reloading the page.
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 4•5 years ago
|
||
andreio, did performance regress significantly with the last nightly 68 export containing bug 1551359? I definitely see profiler CPU time differences, but if reference machine is more disk bottlenecked than CPU, maybe it wouldn't be as critical to get this fix into 68 beta?
Comment 5•5 years ago
|
||
Visually the experience is not affected: on the reference hardware all sections are painted at the same time, there is no gradual loading so the user does not observe any jank. The running time of the function is significant though.
Comment 6•5 years ago
|
||
Ed to put screen recordings here for Tawanda to review and decide if it's important to uplift into 68.
Question about: is this only impacting not-cached (first load)?
Assignee | ||
Comment 7•5 years ago
|
||
kanhema, here's an example of the potential performance fix that uses 10x less CPU (less than 1% regression vs 10% regression) but allows the page to briefly show longer text than desired. For most users, this would only happen on opening a new window which would show about:home as it renders whereas in most cases, a regular new tab will be preloaded and there will be no changing of card size.
Is this an acceptable tradeoff to avoid the performance regression?
Comment 8•5 years ago
|
||
Ed, I think this is an acceptable trade-off considering the gains on performance. The longer text only shows for a split second.
Assignee | ||
Comment 9•5 years ago
|
||
[Tracking Requested - why for this release]: There was a ~10% performance regression from bug 1551359 at the end of 68 nightly
Updated•5 years ago
|
Comment 10•5 years ago
|
||
Hey Mardak,
Here's where the privileged content process differs from normal content processes:
jlim's project from last summer made it so that we pull those scripts from the ScriptPreloader in the event that we're using the privileged content process. It waits until DOMContentLoaded before doing this - and I guess that means that's before the CSS resources have finished loading.
Assignee | ||
Comment 11•5 years ago
|
||
Looks like bug 1551359 dynamic line clamping uncovered some other bugs in addition to the performance issues, so we'll just revert it and get back to static line clamping for 69 and 68.
Assignee | ||
Comment 12•5 years ago
|
||
Updated•5 years ago
|
Comment 13•5 years ago
|
||
I have verified that this issue is no longer reproducible with the latest Firefox Nightly (69.0a1 Build ID - 20190530214830) installed, on Windows 10 x64, Arch Linux and Mac 10.14.5. Now, the lines clamps are displayed after three rows.
Assignee | ||
Comment 14•5 years ago
|
||
Comment 15•5 years ago
|
||
Hi Ed, please request uplift for Beta68 if you think it's worth shipping this fix in 68.
Assignee | ||
Comment 17•5 years ago
|
||
Comment on attachment 9070330 [details]
Bug 1552596 - Revert dynamic line clamping in favor of performant static line clamping
Beta/Release Uplift Approval Request
- User impact if declined: Slower loading of Firefox Home content
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: Yes
- If yes, steps to reproduce: Open new tab with discovery stream content and make sure card title and description have at most 3 lines each instead of dynamically filling up 6 lines total
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Reverting a change that landed late in 68 nightly to a previously verified state
- String changes made/needed: none
Assignee | ||
Updated•5 years ago
|
Comment 18•5 years ago
|
||
Comment on attachment 9070330 [details]
Bug 1552596 - Revert dynamic line clamping in favor of performant static line clamping
regression fix, verified in nightly, approved for 68.0b10
Updated•5 years ago
|
Comment 19•5 years ago
|
||
Comment on attachment 9070330 [details]
Bug 1552596 - Revert dynamic line clamping in favor of performant static line clamping
Actually looks like the cherry-pick is waiting on review?
Assignee | ||
Updated•5 years ago
|
Comment 20•5 years ago
|
||
Comment on attachment 9070330 [details]
Bug 1552596 - Revert dynamic line clamping in favor of performant static line clamping
approved for 68.0b11
Comment 21•5 years ago
|
||
bugherder uplift |
Comment 22•5 years ago
•
|
||
I have verified this issue with the latest Firefox Beta (68.0b11 Build ID - 20190617172838) installed, on Windows 10 x64, Arch Linux and Mac 10.14.5. Now, the card title and description have at most 3 lines each.
Updated•5 years ago
|
Updated•2 years ago
|
Description
•