mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 04:45:45 +00:00
Bug 760848 - Make select.size reflection follow the specifications. r=smaug
This commit is contained in:
parent
76cccb6d8f
commit
d384c795f3
@ -1226,7 +1226,7 @@ NS_IMPL_BOOL_ATTR(nsHTMLSelectElement, Disabled, disabled)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLSelectElement, Multiple, multiple)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSelectElement, Name, name)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLSelectElement, Required, required)
|
||||
NS_IMPL_NON_NEGATIVE_INT_ATTR_DEFAULT_VALUE(nsHTMLSelectElement, Size, size, 0)
|
||||
NS_IMPL_UINT_ATTR(nsHTMLSelectElement, Size, size)
|
||||
NS_IMPL_INT_ATTR(nsHTMLSelectElement, TabIndex, tabindex)
|
||||
|
||||
bool
|
||||
|
@ -549,7 +549,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
PRInt32 size = 1;
|
||||
PRUint32 size = 1;
|
||||
GetSize(&size);
|
||||
return size <= 1;
|
||||
}
|
||||
|
@ -103,13 +103,17 @@ function checkSetSizeException(element)
|
||||
}
|
||||
ok(!caught, "Setting a size to 0 from the IDL shouldn't throw an exception");
|
||||
|
||||
element.size = 1;
|
||||
|
||||
caught = false;
|
||||
try {
|
||||
element.size = -1;
|
||||
} catch(e) {
|
||||
caught = true;
|
||||
}
|
||||
ok(caught, "Setting an invalid size from the IDL should throw an exception");
|
||||
ok(!caught, "Setting a negative size from the IDL shouldn't throw an exception");
|
||||
|
||||
is(element.size, 0, "The size should now be equal to the minimum non-negative value");
|
||||
|
||||
caught = false;
|
||||
try {
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
interface nsIDOMValidityState;
|
||||
|
||||
[scriptable, uuid(2A50D295-8DB8-4223-AE0D-070C6EB6C76E)]
|
||||
[scriptable, uuid(e85194cf-56e6-44a6-92d9-0096c9d2536e)]
|
||||
interface nsIDOMHTMLSelectElement : nsIDOMHTMLElement
|
||||
{
|
||||
attribute boolean autofocus;
|
||||
@ -27,7 +27,7 @@ interface nsIDOMHTMLSelectElement : nsIDOMHTMLElement
|
||||
readonly attribute nsIDOMHTMLFormElement form;
|
||||
attribute boolean multiple;
|
||||
attribute DOMString name;
|
||||
attribute long size;
|
||||
attribute unsigned long size;
|
||||
|
||||
readonly attribute DOMString type;
|
||||
|
||||
|
@ -2906,7 +2906,7 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
|
||||
|
||||
// Construct a frame-based listbox or combobox
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> sel(do_QueryInterface(content));
|
||||
PRInt32 size = 1;
|
||||
PRUint32 size = 1;
|
||||
if (sel) {
|
||||
sel->GetSize(&size);
|
||||
bool multipleSelect = false;
|
||||
|
@ -569,7 +569,7 @@ nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
|
||||
|
||||
// Now compute the height we want to have
|
||||
mNumDisplayRows = kMaxDropDownRows;
|
||||
if (visibleHeight > mNumDisplayRows * heightOfARow) {
|
||||
if (visibleHeight > nscoord(mNumDisplayRows * heightOfARow)) {
|
||||
visibleHeight = mNumDisplayRows * heightOfARow;
|
||||
// This is an adaptive algorithm for figuring out how many rows
|
||||
// should be displayed in the drop down. The standard size is 20 rows,
|
||||
@ -963,7 +963,7 @@ nsListControlFrame::SetInitialChildList(ChildListID aListID,
|
||||
|
||||
//---------------------------------------------------------
|
||||
nsresult
|
||||
nsListControlFrame::GetSizeAttribute(PRInt32 *aSize) {
|
||||
nsListControlFrame::GetSizeAttribute(PRUint32 *aSize) {
|
||||
nsresult rv = NS_OK;
|
||||
nsIDOMHTMLSelectElement* selectElement;
|
||||
rv = mContent->QueryInterface(NS_GET_IID(nsIDOMHTMLSelectElement),(void**) &selectElement);
|
||||
@ -2403,13 +2403,13 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
case nsIDOMKeyEvent::DOM_VK_PAGE_UP: {
|
||||
AdjustIndexForDisabledOpt(mEndSelectionIndex, newIndex,
|
||||
(PRInt32)numOptions,
|
||||
-NS_MAX(1, mNumDisplayRows-1), -1);
|
||||
-NS_MAX(1, PRInt32(mNumDisplayRows-1)), -1);
|
||||
} break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_PAGE_DOWN: {
|
||||
AdjustIndexForDisabledOpt(mEndSelectionIndex, newIndex,
|
||||
(PRInt32)numOptions,
|
||||
NS_MAX(1, mNumDisplayRows-1), 1);
|
||||
NS_MAX(1, PRInt32(mNumDisplayRows-1)), 1);
|
||||
} break;
|
||||
|
||||
case nsIDOMKeyEvent::DOM_VK_HOME: {
|
||||
|
@ -306,7 +306,7 @@ protected:
|
||||
virtual ~nsListControlFrame();
|
||||
|
||||
// Utility methods
|
||||
nsresult GetSizeAttribute(PRInt32 *aSize);
|
||||
nsresult GetSizeAttribute(PRUint32 *aSize);
|
||||
nsIContent* GetOptionFromContent(nsIContent *aContent);
|
||||
|
||||
/**
|
||||
@ -388,7 +388,7 @@ protected:
|
||||
PRInt32 mEndSelectionIndex;
|
||||
|
||||
nsIComboboxControlFrame *mComboboxFrame;
|
||||
PRInt32 mNumDisplayRows;
|
||||
PRUint32 mNumDisplayRows;
|
||||
bool mChangesSinceDragStart:1;
|
||||
bool mButtonDown:1;
|
||||
// Has the user selected a visible item since we showed the
|
||||
|
Loading…
Reference in New Issue
Block a user