Closed Bug 1434945 Opened 2 years ago Closed 2 years ago

browser.xul should look correct if it's painted after domcontentloaded


(Firefox :: General, defect, P1)




Firefox 60
Tracking Status
firefox60 --- fixed


(Reporter: florian, Assigned: florian)



(Whiteboard: [fxperf])


(4 files, 3 obsolete files)

When creating a new xul window containing browser.xul, the window becomes visible at the end of the 'load' event, at which point we already have all SVG icons loaded.

When instead of creating a new window to load browser.xul, we change the location of an about:blank window to browser.xul (what I'm planning to do in bug 1336227), things are messed up in the first-paint layout, causing very noticeable flicker.

After investigating, there are actually only 3 things that need fixing:
- the tab bar needs to become visible in a 'domcontentloaded' rather than a 'load' event listener.
- the UI density needs to be set in a 'domcontentloaded' listener rather than a 'load' listener.
- some SVG icons have their width set with CSS but not their height (or the height but not their width).
Attached patch part 1 - tabbar visibility (obsolete) — Splinter Review
Attachment #8947503 - Flags: review?(jhofmann)
Attached patch part 2 - UI density (obsolete) — Splinter Review
Attachment #8947504 - Flags: review?(jhofmann)
Attachment #8947505 - Flags: review?(jhofmann)
Priority: -- → P1
Whiteboard: [fxperf]
Attachment #8947503 - Flags: review?(jhofmann) → review+
Attachment #8947505 - Flags: review?(jhofmann) → review+
Comment on attachment 8947504 [details] [diff] [review]
part 2 - UI density

Review of attachment 8947504 [details] [diff] [review]:

Attachment #8947504 - Flags: review?(jhofmann) → review+
Attached patch part 1 - tabbar visibility v2 (obsolete) — Splinter Review
Turns out this removes some sync reflows when opening windows! \o/
Attachment #8947503 - Attachment is obsolete: true
Turns out this was leaking on the toolkit/components/startup/tests/browser/browser_bug537449.js test that closes a browser window after domcontentloaded but before onload. Fixed by moving the ui density uninitialization before the this._loadHandled check in onUnload.
Attachment #8947504 - Attachment is obsolete: true
Same problem and fix.
Attachment #8948351 - Attachment is obsolete: true
My patch here setting the tabbar visibility in domcontentloaded causes lots of browser/components/customizableui test failures in small windows that don't get the overflow (">>") icon in the navigation toolbar when they should.

I managed to reproduce locally on my Linux machine and I observed that the overflowedDuringConstruction field gets cleared by an underflow event from the identity-box. On builds without my other patch, this underflow event also exists, but arrives after runs. So it seems to just be a timing issue.

Given that onOverflow already filters the unrelated events at I think it's fine to also filter underflow events in the same way.

I'm still waiting for new try results at
Attachment #8949369 - Flags: review?(gijskruitbosch+bugs)
Comment on attachment 8949369 [details] [diff] [review]
part 4 toolbar.xml should ignore unrelated underflow events

Review of attachment 8949369 [details] [diff] [review]:

r=me, can you file a follow-up bug to move all this logic into CUI or some other JSM, out of the binding? For one it's XBL (which we're trying to remove) for another it's duplicated so it's hard to maintain this way (as evidenced by this patch duplicating logic we have elsewhere).

::: browser/components/customizableui/content/toolbar.xml
@@ +49,5 @@
>        <method name="handleEvent">
>          <parameter name="aEvent"/>
>          <body><![CDATA[
> +          // Ignore overflow/underflow events from the identity-box.

I would just say "from nodes inside the toolbar"
Attachment #8949369 - Flags: review?(gijskruitbosch+bugs) → review+
Pushed by
the UI density should be set from a DOMContentLoaded listener, r=johannh.
the tabbar visibility should be set during a DOMContentLoaded listener, r=johannh.
toolbar.xml should ignore overflow/underflow events that don't come from its customization target, r=Gijs.
icons of the main browser UI should have both their height and width set in CSS to avoid flickering when the SVG icons load, r=johannh.
Depends on: 1438490
You need to log in before you can comment on or make changes to this bug.