Closed Bug 252158 Opened 16 years ago Closed 7 years ago

Large select lists not always scrolling the selected item into view

Categories

(Core :: Layout: Form Controls, defect)

x86
Linux
defect
Not set

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: cstrom, Assigned: mats)

References

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040701 Firefox/0.9.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040701 Firefox/0.9.1

On pages with multiple select lists of significant length, the `selected' item
is not always shown in the select list's viewport (not the browser viewport, the
viewport of the select list).  The select list stays as if no item was marked
selected - only the top of the list is displayed.  However, if you scroll down
to find the item that is supposed to be selected, it *is* selected - firefox
just has not scrolled the list to bring it into view.

I have reproduced this problem on windows and on linux with Firefox 0.9.  I have
also reproduced it with Mozilla 1.7 on linux.  I have access to Netscape 7.1 on
windows which does not exhibit this behavior, but do not have access to any
older mozilla builds to attempt to reproduce.

Reproducible: Sometimes
Steps to Reproduce:
1.Load a page with multiple large select lists (I'll attach a perl script to
generate one).
2.Shift+Reload several times.
Actual Results:  
Sometime the correct items will be selected and displayed.  Other times, one or
more select lists will not show the selected item.

Expected Results:  
Firefox should always show the selected item.
Is this a problem with a current trunk build?  The layout engine in the branch
builds is pretty old...
Apologies for putting this under the trunk when I had not tested it there...

However, it *is* still a problem in both nightlies:
http://ftp.mozilla.org/pub/mozilla.org/mozilla/nightly/latest-trunk/mozilla-i686-pc-linux-gnu.tar.gz
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/firefox-i686-linux-gtk2+xft.tar.gz

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a3) Gecko/20040719
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a3) Gecko/20040719 Firefox/0.9.1+

Both nightlies continue to exhibit the same behavior.  Repeated Shift+reloads
change the display of the select lists.  Sometimes one or more of the lists does
not show the `selected' items.  Sometimes all of the lists correctly show the
`selected' items.
Confirming bug, 2005-01-28-05 trunk Linux.
The selected item in each list is selected but the middle list does not scroll
it into view for some reason.
Status: UNCONFIRMED → NEW
Ever confirmed: true
My last comment is when I loaded the testcase from disc.
Loading it from Bugzilla (attachment 172783 [details]) gives different results - none of
the selected items are scrolled into view.
When I scroll manually I can see the selected item highlighted so the problem
seems to be the scrolling part only.
Keywords: testcase
Summary: Multiple large select lists not always showing the selected item → Large select lists not always scrolling the selected item into view
The problem is that we couldn't get the option's primary frame, at line 2757:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/layout/forms/nsListControlFrame.cpp&rev=1.352&root=/cvsroot&mark=2752,2757#2735

If I stick a 'FlushPendingNotifications(Flush_Frames);' in there it fixes the
problem but is seems a bit riscy perhaps, since 'nsListControlFrame::Reflow'
calls 'ScrollToIndex()' here:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/layout/forms/nsListControlFrame.cpp&rev=1.352&root=/cvsroot&mark=740-754#738

Boris, thoughts?
Assignee: nobody → mats.palmgren
Flushing frames in the middle of reflow is no good.

Maybe we're calling ScrollToFrame too early?  Or not calling it after the kids
have been constructed?  What's the callstack for the ScrollToFrame call during
which the kids are around but not yet in the frame tree?  Perhaps flushing
frames somewhere further up the stack would be right.
*** Bug 286199 has been marked as a duplicate of this bug. ***
I am seeing this issue on Firefox 2.0.0.1 on Linux (Fedora Core 6) and Windows XP Professional.  This seems to be a dependent on the timing of data received from the web server.  I am using JSP to generate one page with a very large select box (>500 items) with a single selected item.  At first, I was seeing this issue about 9 out of 10 times I loaded the page.  I changed my JSP code to work faster (but generate exactly the same HTML), and now the  select box scrolls to the selected item almost every time (fails about 1 in 25 tries).

See Bug 224023 for a Javascript function to scroll the select box once the page is finished loading.
Depends on: 506481
Works for me in a recent Nightly (Fx21) on Linux, OSX and Win7.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.