Open Bug 493645 Opened 16 years ago Updated 3 years ago

ensureElementIsVisible does nothing when called from a xul ctor

Categories

(Core :: XUL, defect)

x86
Windows Vista
defect

Tracking

()

People

(Reporter: Natch, Unassigned)

Details

Attachments

(1 file)

Flags: wanted1.9.2?
A testcase or steps to reproduce might be useful.
Unfortunately I can't come up with anything aside for a modified version of richlistbox.xml... :(
Flags: wanted1.9.2?
Flags: wanted1.9.2-
Flags: blocking1.9.2-
STR would be, replace http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/richlistbox.xml?mark=358-361#335 with just: |this.ensureElementIsVisible(currentItem);| Then open an app with a richlistbox that has equal-length richlistitems that's filled so that there are scroll bars, select an item, then restart the app. The richlist should scroll beyond the last item. This happens when ensureElementIsVisible is called from the xul ctor, at a time when (I guess) layout is still incomplete. I'll retest a modified richlistbox and post the results (it may have been fixed by now).
Actually, this is doing nothing for me, with or without that modification the testcase attached doesn't scroll to the correct (previously selected) item. It does select it though. I haven't tested this in 3.0, maybe this never worked?
Attachment #392418 - Attachment description: testcase - doesn't work → testcase - doesn't work (needs to be loaded from chrome://)
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 Doesn't work in 3.5.1 either. I'm pretty sure the ensureElementIsVisible stuff there isn't doing anything. Is there a layout requirement for ensureElementIsVisible to work (i.e. it has to be past a certain stage or something)?
Summary: ensureElementIsVisible scrolls past the end of the listBoxObject → ensureElementIsVisible does nothing when called from a xul ctor
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.12pre) Gecko/2009070105 GranParadiso/3.0.12pre Doesn't work in 3.0 either, WONTFIX?
What are the steps to reproduce this issue? The lines of code you mention in comment 3 certainly seem buggy (at leas working around some buggy behavior, it seems to me).
(In reply to comment #7) Martijn: This bug was originally filed for that piece of code, since when it was originally checked in it was a workaround for a bug in ensureElementIsVisible. Problem is, it never cited any bug, which is why I filed this one. See bug 490178 comment 16. The problem is that after investigating this bug I found that the whole ensureElementIsVisible bit in richlistbox.xml doesn't work at all. This is what happens, in short, in that code: When a richlistbox is inserted into a document the xbl ctor (<constructor>) is called, in it there's a call to the method "_refreshSelection" which captures (if available) the ids of the items that were selected last time the window was open. It then re-selects them (this part works) and then scrolls to the current item (which is the first id it encounters, aiui), and this doesn't work. The ids are saved on an attribute of the richlistbox, "last-selected", and must be persisted in order to hit this behavior. The testcase in this bug won't show you this unless you load it from chrome:// since persisting is only allowed from privileged content.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: