diff --git a/toolkit/content/tests/widgets/Makefile.in b/toolkit/content/tests/widgets/Makefile.in index 6d78e04d7037..4ab09c066127 100644 --- a/toolkit/content/tests/widgets/Makefile.in +++ b/toolkit/content/tests/widgets/Makefile.in @@ -112,6 +112,7 @@ _TEST_FILES = test_bug360220.xul \ test_videocontrols.html \ test_videocontrols_video_direction.html \ test_videocontrols_audio_direction.html \ + test_richlist_direction.xul \ videocontrols_direction-1-ref.html \ videocontrols_direction-1a.html \ videocontrols_direction-1b.html \ diff --git a/toolkit/content/tests/widgets/test_richlist_direction.xul b/toolkit/content/tests/widgets/test_richlist_direction.xul new file mode 100644 index 000000000000..e9bf9a58b942 --- /dev/null +++ b/toolkit/content/tests/widgets/test_richlist_direction.xul @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + diff --git a/toolkit/content/widgets/listbox.xml b/toolkit/content/widgets/listbox.xml index 63ef676f93ef..2ca1a12acb0a 100644 --- a/toolkit/content/widgets/listbox.xml +++ b/toolkit/content/widgets/listbox.xml @@ -547,8 +547,10 @@ @@ -575,6 +577,7 @@ false false + false null null null @@ -588,17 +591,37 @@ action="this._moveByOffsetFromUserEvent(1, event);" group="system"/> + group="system"> + + + group="system"> + + + group="system"> + + + group="system"> + + + flex="1" style="overflow: auto;" xbl:inherits="dir,pack"> @@ -116,6 +116,53 @@ + + + + + + + + + + + + + + + + @@ -303,9 +350,13 @@ @@ -355,10 +406,16 @@ if (this.selType != "multiple" && this.selectedCount == 0) this.selectedItem = currentItem; - if (this.scrollBoxObject.height) + if (this.scrollBoxObject.height) { this.ensureElementIsVisible(currentItem); - else // XXX hack around a bug in ensureElementIsVisible - this.ensureElementIsVisible(currentItem.previousSibling); + } + else { + // XXX hack around a bug in ensureElementIsVisible as it will + // scroll beyond the last element, bug 493645. + var previousElement = this.dir == "reverse" ? currentItem.nextSibling : + currentItem.previousSibling; + this.ensureElementIsVisible(previousElement); + } } this._suppressOnSelect = suppressSelect; // XXX actually it's just a refresh, but at least