[Bug 799407] Fix build warnings in layout r=roc

This commit is contained in:
David Zbarsky
2012-10-10 01:00:05 -04:00
parent 3904369181
commit b22e7c6a8e
26 changed files with 68 additions and 74 deletions

View File

@@ -52,7 +52,7 @@
using namespace mozilla;
// Constants
const int32_t kMaxDropDownRows = 20; // This matches the setting for 4.x browsers
const uint32_t kMaxDropDownRows = 20; // This matches the setting for 4.x browsers
const int32_t kNothingSelected = -1;
// Static members
@@ -577,11 +577,11 @@ nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
nscoord bp = aReflowState.mComputedBorderPadding.TopBottom();
nscoord availableHeight = NS_MAX(above, below) - bp;
nscoord newHeight;
int32_t rows;
uint32_t rows;
if (visibleHeight <= availableHeight) {
// The dropdown fits in the available height.
rows = GetNumberOfOptions();
mNumDisplayRows = clamped(rows, 1, kMaxDropDownRows);
mNumDisplayRows = clamped<uint32_t>(rows, 1, kMaxDropDownRows);
if (mNumDisplayRows == rows) {
newHeight = visibleHeight; // use the exact height
} else {
@@ -589,7 +589,7 @@ nsListControlFrame::ReflowAsDropdown(nsPresContext* aPresContext,
}
} else {
rows = availableHeight / heightOfARow;
mNumDisplayRows = clamped(rows, 1, kMaxDropDownRows);
mNumDisplayRows = clamped<uint32_t>(rows, 1, kMaxDropDownRows);
newHeight = mNumDisplayRows * heightOfARow; // approximate
}
state.SetComputedHeight(newHeight);
@@ -1265,21 +1265,21 @@ nsListControlFrame::IsInDropDownMode() const
return (mComboboxFrame != nullptr);
}
int32_t
uint32_t
nsListControlFrame::GetNumberOfOptions()
{
if (mContent != nullptr) {
nsCOMPtr<nsIDOMHTMLOptionsCollection> options = GetOptions(mContent);
if (!options) {
return 0;
} else {
uint32_t length = 0;
options->GetLength(&length);
return (int32_t)length;
}
if (!mContent) {
return 0;
}
return 0;
nsCOMPtr<nsIDOMHTMLOptionsCollection> options = GetOptions(mContent);
if (!options) {
return 0;
}
uint32_t length = 0;
options->GetLength(&length);
return length;
}
//----------------------------------------------------------------------
@@ -1332,10 +1332,10 @@ nsListControlFrame::AddOption(int32_t aIndex)
mIsAllFramesHere = false;
mHasBeenInitialized = false;
} else {
mIsAllFramesHere = (aIndex == GetNumberOfOptions()-1);
mIsAllFramesHere = (aIndex == static_cast<int32_t>(GetNumberOfOptions()-1));
}
}
// Make sure we scroll to the selected option as needed
mNeedToReset = true;