[FIX]Focusing Firefox will scroll the page to the currently focused element

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
10 years ago
2 months ago

People

(Reporter: mossop, Assigned: bzbarsky)

Tracking

({regression})

Trunk
x86
macOS
Points:
---
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

10 years ago
1. Visit a page in bugzilla that is long enough to scroll.
2. Click in the search box at the very top of the page so it is focused.
3. Use the mouse wheel to scroll down the page so the search box is no longer visible, but it is still focused.
4. Focus any another application by clicking on it or with the task switcher.
5. Focus Firefox by clicking in a blank area of the page or with the task switcher.

Now the page will jump back up to the top so the search box is visible again. This doesn't happen on the 1.9.1 branch.

This seems to happen on any webpage and for any focusable element.
Flags: blocking1.9.2?
Regression range would be very useful.

Comment 3

10 years ago
Same issue
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090507 Minefield/3.6a1pre ID:20090507043638

Updated

10 years ago
OS: Mac OS X → All
Looks like we're failing to null out mContentToScrollTo somewhere.  Looking into it.
OS: All → Mac OS X
Er, or not.  Something else weird is happening.  mContentToScrollTo is in fact null, we suppress the focus scroll... but something ends up scrolling our view or something.
Oh, the change bug 67752 made to PresShell::ScrollContentIntoView is just buggy.  Here's the stack to where the scroll happens:

#0  nsScrollPortView::ScrollToImpl (this=0x1c0aa530, aX=0, aY=4029) at /Users/bzbarsky/mozilla/reflow/mozilla/view/src/nsScrollPortView.cpp:598
#1  0x11db72be in nsScrollPortView::ScrollTo (this=0x1c0aa530, aDestinationX=0, aDestinationY=4029, aUpdateFlags=0) at /Users/bzbarsky/mozilla/reflow/mozilla/view/src/nsScrollPortView.cpp:255
#2  0x118811ba in ScrollViewToShowRect (aScrollingView=0x1c0aa584, aRect=@0xbfffcac8, aVPercent=-2, aHPercent=-2) at /Users/bzbarsky/mozilla/reflow/mozilla/layout/base/nsPresShell.cpp:4130
#3  0x11886004 in PresShell::DoScrollContentIntoView (this=0x1f8b0600, aContent=0x18516f70, aVPercent=-2, aHPercent=-2) at /Users/bzbarsky/mozilla/reflow/mozilla/layout/base/nsPresShell.cpp:4211
#4  0x11895432 in PresShell::FlushPendingNotifications (this=0x1f8b0600, aType=Flush_InterruptibleLayout) at /Users/bzbarsky/mozilla/reflow/mozilla/layout/base/nsPresShell.cpp:4774
#5  0x11b3023e in nsDocument::FlushPendingNotifications (this=0x1f3bd400, aType=Flush_InterruptibleLayout) at /Users/bzbarsky/mozilla/reflow/mozilla/content/base/src/nsDocument.cpp:6268
#6  0x11886196 in PresShell::ScrollContentIntoView (this=0x1f8b0600, aContent=0x18516f70, aVPercent=-2, aHPercent=-2) at /Users/bzbarsky/mozilla/reflow/mozilla/layout/base/nsPresShell.cpp:4146

We shouldn't be scrolling here because we want to suppress this scroll, but we end up doing it inside the flush.  The right thing is probably to check for the focus suppression before doing the flush.
Posted patch FixSplinter Review
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #376472 - Flags: superreview?(dbaron)
Attachment #376472 - Flags: review?(dbaron)
(Assignee)

Updated

10 years ago
Summary: Focusing Firefox will scroll the page to the currently focused element → [FIX]Focusing Firefox will scroll the page to the currently focused element
Attachment #376472 - Flags: superreview?(dbaron)
Attachment #376472 - Flags: superreview+
Attachment #376472 - Flags: review?(dbaron)
Attachment #376472 - Flags: review+
(Assignee)

Updated

10 years ago
Duplicate of this bug: 492133
(Assignee)

Updated

10 years ago
Duplicate of this bug: 492133
Pushed http://hg.mozilla.org/mozilla-central/rev/84bc1ebd060d
Status: ASSIGNED → RESOLVED
Last Resolved: 10 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
(Reporter)

Updated

10 years ago
Flags: blocking1.9.2?
Component: Event Handling → User events and focus handling
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.