0.13ms uninterruptible reflow at _removeURLFormat@resource:///modules/UrlbarValueFormatter.jsm:181:5
Categories
(Firefox :: Address Bar, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr68 | --- | unaffected |
firefox70 | --- | unaffected |
firefox71 | --- | wontfix |
firefox72 | --- | fixed |
People
(Reporter: mconley, Assigned: m_kato)
References
(Regression)
Details
(Keywords: regression, Whiteboard: [ohnoreflow][fxperf:p3] )
Attachments
(1 file)
Here's the stack:
_removeURLFormat@resource:///modules/UrlbarValueFormatter.jsm:181:5
update@resource:///modules/UrlbarValueFormatter.jsm:55:10
formatValue@resource:///modules/UrlbarInput.jsm:257:27
onSecurityChange@chrome://browser/content/browser.js:5660:13
callListeners@chrome://browser/content/tabbrowser.js:823:31
_callProgressListeners@chrome://browser/content/tabbrowser.js:837:22
updateCurrentBrowser@chrome://browser/content/tabbrowser.js:1093:14
_setupEventListeners/<@chrome://browser/content/tabbrowser.js:5104:16
set selectedIndex@chrome://global/content/elements/tabbox.js:208:14
set selectedPanel@chrome://global/content/elements/tabbox.js:227:7
set selectedIndex@chrome://global/content/elements/tabbox.js:559:11
set selectedItem@chrome://global/content/elements/tabbox.js:579:35
_selectNewTab@chrome://global/content/elements/tabbox.js:749:7
on_mousedown@chrome://global/content/elements/tabbox.js:345:28
on_mousedown@chrome://browser/content/tabbrowser-tab.js:361:15
handleEvent@chrome://global/content/customElements.js:468:27
Version: 72.0a1
Build: 20191108095936
Comment 1•5 years ago
|
||
Mike, do you have a guess at what in this code https://searchfox.org/mozilla-central/rev/6566d92dd46417a2f57e75c515135ebe84c9cef5/browser/components/urlbar/UrlbarValueFormatter.jsm#181-192 could trigger a layout flush? It's not obvious to me. Steps to reproduce, or even better a profile would be very useful here.
Reporter | ||
Comment 2•5 years ago
|
||
Yes, I have STR.
- Install OhNoReflow in Firefox Nightly: https://mikeconley.github.io/ohnoreflow/
- Ensure the add-on is installed, enabled and recording
- Have multiple tabs open to various web pages
- Select the URL bar in one such tab
- Switch to a different tab via mouse
ER:
Ideally, no reflows being recorded.
AR:
A number of reflows recorded, including the one in comment 0.
Reporter | ||
Comment 3•5 years ago
|
||
The line in question is:
I'm not sure why getting at the value
of an HTMLInputElement would flush. Maybe emilio would know?
Comment 4•5 years ago
|
||
That's a setter, right? Off-hand I don't know, but I could take a look.
Comment 5•5 years ago
|
||
maybe it's related to the fact we use the :valid pseudo-class to check if the element contains a value, we make the element visible only if it has a value.
https://searchfox.org/mozilla-central/rev/e7c61f4a68b974d5fecd216dc7407b631a24eb8f/browser/base/content/browser.css#651
Comment 6•5 years ago
|
||
Here is a profile of it: https://perfht.ml/379V3g3
The flush is at https://searchfox.org/mozilla-central/rev/e7c61f4a68b974d5fecd216dc7407b631a24eb8f/editor/libeditor/TextEditor.cpp#533
emilio, does this help?
Comment 7•5 years ago
|
||
Ah, yes, it does help a bunch!
I see... So this should only happen when there's text selected, or the input is focused, right?
This seems to have been introduced in bug 1568996, and it seems expected as far as I can tell... But I don't know if we could avoid it in some cases? It does seem unfortunate than setting the value to the empty string has to flush layout, as the selection should be completely removed.
Probably Makoto or Masayuki, which are way more familiar with this code, could help more than me :)
Comment 8•5 years ago
|
||
Alternatively you could avoid style changes before clearing the value, but that seems it may be hard, I dunno.
Updated•5 years ago
|
Assignee | ||
Comment 9•5 years ago
•
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #7)
Ah, yes, it does help a bunch!
I see... So this should only happen when there's text selected, or the input is focused, right?
This seems to have been introduced in bug 1568996, and it seems expected as far as I can tell... But I don't know if we could avoid it in some cases? It does seem unfortunate than setting the value to the empty string has to flush layout, as the selection should be completely removed.
Probably Makoto or Masayuki, which are way more familiar with this code, could help more than me :)
FrameSelection::MoveCaret doesn't work when frame is dirty since editor holds script blocker when callign FrameSeleciton::MoveCaret. (Before landing bug 1568996, although MoveCaret calls pending flush, layout won't flushed due to holding script block.)
Also, If this script is from content, this doesn't occur. Because we don't use DeleteSelectionAsAction
and doesn't add transaction history. If from XUL, since we have to add transaction, we use DeleteSelectionAsAction
now. But this case may have to add new method to clear value, not using mozilla::TextEditor::DeleteSelectionAsAction
in mozilla::TextControlState::SetValueWithTextEditor
(or add something hold to block flush layout.)
Assignee | ||
Comment 10•5 years ago
|
||
Bug 1358025 is this case's text transaction, but this is removed since we don't create an traction to set value.
Comment 11•5 years ago
|
||
Well, TextEditor::ExtendSelectionForDelete()
does nothing if selection is collapsed. Perhaps, we could avoid the flush with making it wraps with a method and use it in DeleteSelectionAsAction()
.
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 12•5 years ago
|
||
Updated•5 years ago
|
Assignee | ||
Comment 13•5 years ago
|
||
This is a regression by bug 1568996. Although editor uses nsFrameSelection to
move caret, if frame is dirty, nsFrameSelection returns error.
So by bug 1568996, we flush layout before calling nsFrameSelection. But we
should stop flushing layout when we don't use nsFrameSelection.
Comment 14•5 years ago
|
||
Pushed by m_kato@ga2.so-net.ne.jp: https://hg.mozilla.org/integration/autoland/rev/bee6ebf7e96b Don't flush layout when setting empty string on Chrome. r=masayuki
Comment 15•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Comment 16•5 years ago
•
|
||
== Change summary for alert #24120 (as of Mon, 25 Nov 2019 04:55:21 GMT) ==
Improvements:
14% raptor-tp6-twitch-firefox-cold fcp windows10-64-shippable opt 87.83 -> 75.42
10% raptor-tp6-twitch-firefox-cold windows10-64-shippable opt 274.17 -> 247.64
9% raptor-tp6-twitch-firefox-cold windows10-64-shippable opt 273.32 -> 248.34
For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=24120
Updated•2 years ago
|
Description
•