From bb029fd81fc0211eb40a7d4ab297dc2e28ceed88 Mon Sep 17 00:00:00 2001 From: "dtownsend%oxymoronical.com" Date: Mon, 20 Aug 2007 13:58:26 +0000 Subject: [PATCH] Backing out Bug 317422 due to test failures. git-svn-id: svn://10.0.0.236/trunk@232385 18797224-902f-48f8-a5cc-f745e15eee43 --- .../toolkit/content/tests/widgets/Makefile.in | 2 - .../tests/widgets/test_hiddenitems.xul | 89 --------------- .../tests/widgets/test_hiddenpaging.xul | 104 ------------------ mozilla/toolkit/content/widgets/listbox.xml | 78 +++---------- .../toolkit/content/widgets/richlistbox.xml | 19 ++-- 5 files changed, 24 insertions(+), 268 deletions(-) delete mode 100644 mozilla/toolkit/content/tests/widgets/test_hiddenitems.xul delete mode 100644 mozilla/toolkit/content/tests/widgets/test_hiddenpaging.xul diff --git a/mozilla/toolkit/content/tests/widgets/Makefile.in b/mozilla/toolkit/content/tests/widgets/Makefile.in index e4833270881..c9ef667e254 100644 --- a/mozilla/toolkit/content/tests/widgets/Makefile.in +++ b/mozilla/toolkit/content/tests/widgets/Makefile.in @@ -68,8 +68,6 @@ _TEST_FILES = test_bug360220.xul \ test_datepicker.xul \ test_timepicker.xul \ xul_selectcontrol.js \ - test_hiddenitems.xul \ - test_hiddenpaging.xul \ $(NULL) ifeq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) diff --git a/mozilla/toolkit/content/tests/widgets/test_hiddenitems.xul b/mozilla/toolkit/content/tests/widgets/test_hiddenitems.xul deleted file mode 100644 index 126b1b2ecb9..00000000000 --- a/mozilla/toolkit/content/tests/widgets/test_hiddenitems.xul +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - diff --git a/mozilla/toolkit/content/tests/widgets/test_hiddenpaging.xul b/mozilla/toolkit/content/tests/widgets/test_hiddenpaging.xul deleted file mode 100644 index 1994d7e3121..00000000000 --- a/mozilla/toolkit/content/tests/widgets/test_hiddenpaging.xul +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - diff --git a/mozilla/toolkit/content/widgets/listbox.xml b/mozilla/toolkit/content/widgets/listbox.xml index 36b26aaf400..199252f2635 100644 --- a/mozilla/toolkit/content/widgets/listbox.xml +++ b/mozilla/toolkit/content/widgets/listbox.xml @@ -99,9 +99,8 @@ insertItemAt(aIndex, aLabel, aValue) /** Scroll up/down one page - * @param aDirection - specifies scrolling direction, should be either -1 or 1 - * @return the number of elements the selection scrolled - */ + * @param aDirection - specifies scrolling direction, should be either -1 + or 1 */ scrollOnePage(aDirection) /** Fire "select" event */ @@ -335,15 +334,12 @@ // Don't use clearSelection() because it causes a lot of noise // with respect to selection removed notifications used by the // accessibility API support. - var userSelecting = this._userSelecting; - this._userSelecting = false; // that's US automatically unselecting for (; currentItem; currentItem = this.getNextItem(currentItem, 1)) this.removeItemFromSelection(currentItem); for (currentItem = this.getItemAtIndex(0); currentItem != aStartItem; currentItem = this.getNextItem(currentItem, 1)) this.removeItemFromSelection(currentItem); - this._userSelecting = userSelecting; this._suppressOnSelect = suppressSelect; @@ -482,13 +478,8 @@ newIndex = numItems - 1; var newItem = this.getItemAtIndex(newIndex); - // make sure that the item is actually visible/selectable - if (this._userSelecting && newItem && !this._canUserSelect(newItem)) - newItem = - aOffset > 0 ? this.getNextItem(newItem, 1) || this.getPreviousItem(newItem, 1) : - this.getPreviousItem(newItem, 1) || this.getNextItem(newItem, 1); if (newItem) { - this.ensureIndexIsVisible(this.getIndexOfItem(newItem)); + this.ensureIndexIsVisible(newIndex); if (aIsSelectingRange) this.selectItemRange(null, newItem); else if (aIsSelecting) @@ -509,8 +500,7 @@ while (aStartItem) { aStartItem = aStartItem.nextSibling; if (aStartItem && aStartItem instanceof - Components.interfaces.nsIDOMXULSelectControlItemElement && - (!this._userSelecting || this._canUserSelect(aStartItem))) { + Components.interfaces.nsIDOMXULSelectControlItemElement) { --aDelta; if (aDelta == 0) return aStartItem; @@ -528,8 +518,7 @@ while (aStartItem) { aStartItem = aStartItem.previousSibling; if (aStartItem && aStartItem instanceof - Components.interfaces.nsIDOMXULSelectControlItemElement && - (!this._userSelecting || this._canUserSelect(aStartItem))) { + Components.interfaces.nsIDOMXULSelectControlItemElement) { --aDelta; if (aDelta == 0) return aStartItem; @@ -540,28 +529,6 @@ - - - - - - - - - - - - - - - @@ -571,7 +538,6 @@ false - false null null null @@ -579,22 +545,22 @@ = 0 && i > maxTop; i--) { - item = this.getItemAtIndex(i); - if (item && !this._canUserSelect(item)) - maxTop--; - } - if (newTop >= maxTop) + var maxTop = this.getRowCount() - pageOffset; + if (newTop >= maxTop && maxTop > this.currentIndex) { newTop = maxTop; + } } - if (newTop < 0) + else if (newTop < 0) newTop = 0; this.scrollToIndex(newTop); return pageOffset; @@ -970,7 +924,6 @@ var control = this.control; if (!control || control.disabled) return; - control._userSelecting = true; if (control.selType != "multiple") { control.selectItem(this); } @@ -992,7 +945,6 @@ // doesn't de- and reselect this item if it is selected control.selectItemRange(this, this); } - control._userSelecting = false; ]]> diff --git a/mozilla/toolkit/content/widgets/richlistbox.xml b/mozilla/toolkit/content/widgets/richlistbox.xml index 976905528f7..47b8be5f316 100644 --- a/mozilla/toolkit/content/widgets/richlistbox.xml +++ b/mozilla/toolkit/content/widgets/richlistbox.xml @@ -265,18 +265,17 @@ // (including the currently selected one), and determine // the index of the first one lying (partially) outside var height = this.scrollBoxObject.height; - var startBorder = this.currentItem.boxObject.y; + var border = this.currentItem.boxObject.y; if (aDirection == -1) - startBorder += this.currentItem.boxObject.height; - + border += this.currentItem.boxObject.height; var index = this.currentIndex; - for (; 0 <= index && index < children.length; index += aDirection) { - var boxObject = children[index].boxObject; - if (boxObject.height == 0) - continue; // hidden children have a y of 0 - var endBorder = boxObject.y + (aDirection == -1 ? boxObject.height : 0); - if ((endBorder - startBorder) * aDirection > height) - break; // we've reached the desired distance + while (0 <= index && index < children.length) { + var border2 = children[index].boxObject.y; + if (aDirection == -1) + border2 += children[index].boxObject.height; + if ((border2 - border) * aDirection > height) + break; + index += aDirection; } index -= aDirection;