Closed Bug 1355805 Opened 7 years ago Closed 7 years ago

MousePosTracker flushes layout on mouse move

Categories

(Firefox :: General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1307134

People

(Reporter: florian, Unassigned)

Details

See this profile: https://perfht.ml/2ptk7YJ
(This is on a low powered old netbook)

Several things could be improved here:

- This code is what causes the layout flushes, could we get the same result using something that doesn't flush?
http://searchfox.org/mozilla-central/rev/624d25b2980cf5f83452b040e6d664460f9b7ec5/browser/base/content/browser.js#8226
    this._x = event.screenX / fullZoom - window.mozInnerScreenX;
    this._y = event.screenY / fullZoom - window.mozInnerScreenY;

- We add the mousemove and dragover event listeners unconditionally in _delayedStartup at http://searchfox.org/mozilla-central/rev/624d25b2980cf5f83452b040e6d664460f9b7ec5/browser/base/content/browser.js#1531 but this code won't actually be of any use unless MousePosTracker.addListener has been called at least once.
We have only 2 places in our code that add these listeners: it's only when we are in full screen mode, or when the statusbar panel is displayed (ie. when hovering a link).
We should instead add the mousemove and dragover event listeners in MousePosTracker.addListener, and remove them in MousePosTracker.removeListener if the Set of listeners becomes empty.

- We should replace "this._listeners.forEach(function(listener) {" with "for let listener of this._listeners {" to reduce overhead.
duplicate of bug 1307134?
(In reply to Dão Gottwald [::dao] from comment #1)
> duplicate of bug 1307134?

Yes, although that bug is more confusing... but the last 3 comments there are useful so I'll dupe. Thanks!
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Whiteboard: [photon][qf]
You need to log in before you can comment on or make changes to this bug.