Closed
Bug 280584
Opened 20 years ago
Closed 19 years ago
Maybe this part of the autoscroll code could be optimized (mousemove event handler)?
Categories
(Firefox :: General, defect)
Tracking
()
VERIFIED
FIXED
Firefox1.5
People
(Reporter: martijn.martijn, Assigned: martijn.martijn)
Details
(Keywords: testcase)
Attachments
(1 file, 3 obsolete files)
(deleted),
text/html
|
Details |
See:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/toolkit/content/widgets/browser.xml&rev=1.50&root=/cvsroot#855
Every time when the mouse is moved in Firefox, this code is executed.
I don't think that is really necessary, as this event handler is only necessary
when the autoscroll is enabled and active.
So I think it would probably be better if a mousemove eventhandler would be
attached when the middle mouse button is pressed inside the content area (and
detached when autoscroll is not active anymore).
I'll attach a exaggerated testcase that shows that this indeed is slowing down
Firefox a bit.
Assignee | ||
Comment 1•20 years ago
|
||
This takes appr. 4497ms in current trunk Firefox build.
But it takes appr. 2453ms in current trunk Mozilla build.
When I remove the <handler event="mousemove"> in browser.xml of Firefox,
Firefox becomes just as fast as Mozilla.
Assignee | ||
Comment 2•20 years ago
|
||
Like this?
This makes Firefox behave just as fast witht the testcase as Mozilla (and the
autoscroll coe still functions the way as it should be).
Comment 3•20 years ago
|
||
Good idea. Why don't you ask for review?
Assignee | ||
Comment 4•20 years ago
|
||
Comment on attachment 173121 [details] [diff] [review]
patch
Well, I sort of forgot about it.
Anyway, it is not a very important bug.
Attachment #173121 -
Flags: review?(mconnor)
Comment 5•20 years ago
|
||
Comment on attachment 173121 [details] [diff] [review]
patch
r=me, please strip the bogus whitespace
>@@ -728,16 +729,34 @@
here (should be none this line)
>+
>+ <method name="handlemousemove">
>+ <parameter name="evt"/>
and here
>-
>+
>+ this.addEventListener('mousemove', this.handlemousemove, false);
Attachment #173121 -
Flags: review?(mconnor) → review+
Assignee | ||
Comment 6•20 years ago
|
||
Wow, that's fast. Thanks, Mike!
I've done what you asked. But also, I've changed the indenting at the last code
in the mousemove handler, which I'm now beginning to believe was wrong.
Attachment #173121 -
Attachment is obsolete: true
Comment 7•20 years ago
|
||
Mike is not on the cc list Martijn, so you may either need to cc him or ask
review again (or bug him on IRC)
Assignee | ||
Comment 8•20 years ago
|
||
Comment on attachment 178487 [details] [diff] [review]
patch
Yes, I know Peter. I just wanted to recheck the patch, that it worked correctly
(which it still seems to do).
Mike, this patch looks quite different than the first one, but it is
essentially the same.
All it does is removing the two lines you asked for and it removes some
white-space, which is the code you see at the end of this patch.
Attachment #178487 -
Flags: review?(mconnor)
Assignee | ||
Updated•19 years ago
|
Assignee: firefox → martijn.martijn
Comment 9•19 years ago
|
||
Comment on attachment 178487 [details] [diff] [review]
patch
>+ <method name="handlemousemove">
interCaps please (handleMouseMove), sorry I missed this
>+ <parameter name="evt"/>
convention is to use aEvent for method/function args, makes a lot of code
clearer
>+ if ((x > this._AUTOSCROLL_SNAP || x < -this._AUTOSCROLL_SNAP) || (y > this._AUTOSCROLL_SNAP || y < -this._AUTOSCROLL_SNAP))
if ((x > this._AUTOSCROLL_SNAP || x < -this._AUTOSCROLL_SNAP) ||
(y > this._AUTOSCROLL_SNAP || y < -this._AUTOSCROLL_SNAP))
some crazy people use 80 col editors, huge lines are bad
>+ this._snapOn = false;
trailing whitespace again! :)
almost there! :)
Attachment #178487 -
Flags: review?(mconnor) → review-
Assignee | ||
Comment 10•19 years ago
|
||
Ok, I fixed those things you told me.
> convention is to use aEvent for method/function args, makes a lot of code
> clearer
Well, there are quite some more method/functions in browser.xml that seem to
make use of evt.
Attachment #178487 -
Attachment is obsolete: true
Attachment #186118 -
Flags: review?(mconnor)
Updated•19 years ago
|
Attachment #186118 -
Flags: review?(mconnor) → review+
Assignee | ||
Updated•19 years ago
|
Attachment #186118 -
Flags: approval-aviary1.1a2?
Updated•19 years ago
|
Attachment #186118 -
Flags: approval-aviary1.1a2? → approval-aviary1.1a2+
Updated•19 years ago
|
Whiteboard: [checkin needed]
Comment 11•19 years ago
|
||
fix checked in
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment 12•19 years ago
|
||
+ this.removeEventListener('mousemove', this.handleMouseMove, false);
Still some whitespace here, I don't know how anal you want to be about that. :)
Assignee | ||
Comment 13•19 years ago
|
||
My editor sucks.
I'll remove that whitespace when I need to update a pending patch.
Updated•19 years ago
|
Attachment #186118 -
Attachment description: patchv2 → patchv2
[Checked in: Comment 11]
Attachment #186118 -
Attachment is obsolete: true
Updated•19 years ago
|
Whiteboard: [checkin needed]
Target Milestone: --- → Firefox1.1
Comment 14•19 years ago
|
||
Verifiying fixed using Win FF 1.5. Result: 2016ms.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•