[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 56205a5d2d
commit 307c734c43
26 changed files with 68 additions and 74 deletions

View File

@ -1479,6 +1479,7 @@ ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aActiveScrolledRoot,
return layer.forget();
}
#ifdef DEBUG
/**
* Returns the appunits per dev pixel for the item's frame. The item must
* have a frame because only nsDisplayClip items don't have a frame,
@ -1496,6 +1497,7 @@ AppUnitsPerDevPixel(nsDisplayItem* aItem)
}
return aItem->GetUnderlyingFrame()->PresContext()->AppUnitsPerDevPixel();
}
#endif
/**
* Restrict the visible region of aLayer to the region that is actually visible.
@ -2216,10 +2218,10 @@ ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem,
const FrameLayerBuilder::Clip& aClip,
const nsPoint& aTopLeft)
{
nsIFrame* f = aItem->GetUnderlyingFrame();
NS_ASSERTION(f, "Display items that render using Thebes must have a frame");
uint32_t key = aItem->GetPerFrameKey();
NS_ASSERTION(key, "Display items that render using Thebes must have a key");
NS_ASSERTION(aItem->GetUnderlyingFrame(),
"Display items that render using Thebes must have a frame");
NS_ASSERTION(aItem->GetPerFrameKey(),
"Display items that render using Thebes must have a key");
nsDisplayItemGeometry *oldGeometry = NULL;
FrameLayerBuilder::Clip* oldClip = NULL;
nsAutoPtr<nsDisplayItemGeometry> geometry(aItem->AllocateGeometry(mBuilder));
@ -2908,8 +2910,8 @@ Layer*
FrameLayerBuilder::GetLeafLayerFor(nsDisplayListBuilder* aBuilder,
nsDisplayItem* aItem)
{
nsIFrame* f = aItem->GetUnderlyingFrame();
NS_ASSERTION(f, "Can only call GetLeafLayerFor on items that have a frame");
NS_ASSERTION(aItem->GetUnderlyingFrame(),
"Can only call GetLeafLayerFor on items that have a frame");
Layer* layer = GetOldLayerFor(aItem);
if (!layer)
return nullptr;

View File

@ -2010,7 +2010,6 @@ private:
nsPoint mPt;
const PRUnichar* mText;
int32_t mLength;
nsBidiDirection mDirection;
};
nsresult nsBidiPresUtils::ProcessTextForRenderingContext(const PRUnichar* aText,

View File

@ -1955,6 +1955,7 @@ ComputeRadialGradientLine(nsPresContext* aPresContext,
break;
}
default:
radiusX = radiusY = 0;
NS_ABORT_IF_FALSE(false, "unknown radial gradient sizing method");
}
*aRadiusX = radiusX;
@ -2403,7 +2404,8 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
// If we're not drawing the back-most layer, we don't want to draw the
// background color.
const nsStyleBackground *bg = aBackgroundSC->GetStyleBackground();
if (drawBackgroundColor && aLayer >= 0 && aLayer != bg->mImageCount - 1) {
if (drawBackgroundColor && aLayer >= 0 &&
static_cast<uint32_t>(aLayer) != bg->mImageCount - 1) {
drawBackgroundColor = false;
}

View File

@ -452,8 +452,8 @@ nsFrameManager::InsertFrames(nsIFrame* aParentFrame,
nsFrameList& aFrameList)
{
NS_PRECONDITION(!aPrevFrame || (!aPrevFrame->GetNextContinuation()
|| (aPrevFrame->GetNextContinuation()->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER))
&& !(aPrevFrame->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER),
|| ((aPrevFrame->GetNextContinuation()->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER))
&& !(aPrevFrame->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER)),
"aPrevFrame must be the last continuation in its chain!");
if (aParentFrame->IsAbsoluteContainer() &&

View File

@ -22,6 +22,7 @@ IS_COMPONENT = 1
MODULE_NAME = nsLayoutModule
GRE_MODULE = 1
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1
CPPSRCS = \

View File

@ -18,6 +18,7 @@ MODULE = layout
XPIDL_MODULE = layout_forms
LIBRARY_NAME = gkforms_s
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1
XPIDLSRCS = nsICapturePicker.idl

View File

@ -59,7 +59,7 @@ public:
* Returns the number of options in the listbox
*/
virtual int32_t GetNumberOfOptions() = 0;
virtual uint32_t GetNumberOfOptions() = 0;
/**
* Called by combobox when it's about to drop down

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;

View File

@ -126,7 +126,7 @@ public:
virtual void CaptureMouseEvents(bool aGrabMouseEvents) MOZ_OVERRIDE;
virtual nscoord GetHeightOfARow() MOZ_OVERRIDE;
virtual int32_t GetNumberOfOptions() MOZ_OVERRIDE;
virtual uint32_t GetNumberOfOptions() MOZ_OVERRIDE;
virtual void AboutToDropDown() MOZ_OVERRIDE;
/**

View File

@ -444,7 +444,7 @@ nsTextControlFrame::AppendAnonymousContentTo(nsBaseContentList& aElements,
nscoord
nsTextControlFrame::GetPrefWidth(nsRenderingContext* aRenderingContext)
{
nscoord result = 0;
DebugOnly<nscoord> result = 0;
DISPLAY_PREF_WIDTH(this, result);
float inflation = nsLayoutUtils::FontSizeInflationFor(this);

View File

@ -16,7 +16,6 @@ LIBRARY_NAME = gkgeneric_s
LIBXUL_LIBRARY = 1
EXPORTS = \
nsQueryFrame.h \
nsFrameIdList.h \

View File

@ -364,12 +364,6 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
AutoNoisyIndenter indent(nsBlockFrame::gNoisy);
#endif // DEBUG
// Store position and overflow rect so taht we can invalidate the correct
// area if the position changes
nsRect oldOverflowRect(aKidFrame->GetVisualOverflowRect() +
aKidFrame->GetPosition());
nsRect oldRect = aKidFrame->GetRect();
nsresult rv;
// Get the border values
const nsMargin& border = aReflowState.mStyleBorder->GetComputedBorder();
@ -381,7 +375,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
availWidth =
aReflowState.ComputedWidth() + aReflowState.mComputedPadding.LeftRight();
}
nsHTMLReflowMetrics kidDesiredSize;
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, aKidFrame,
nsSize(availWidth, NS_UNCONSTRAINEDSIZE),

View File

@ -1553,13 +1553,13 @@ IsAlignedLeft(uint8_t aAlignment,
uint8_t aUnicodeBidi,
nsIFrame* aFrame)
{
return (aFrame->IsSVGText() ||
NS_STYLE_TEXT_ALIGN_LEFT == aAlignment ||
((NS_STYLE_TEXT_ALIGN_DEFAULT == aAlignment &&
NS_STYLE_DIRECTION_LTR == aDirection) ||
(NS_STYLE_TEXT_ALIGN_END == aAlignment &&
NS_STYLE_DIRECTION_RTL == aDirection)) &&
!(NS_STYLE_UNICODE_BIDI_PLAINTEXT & aUnicodeBidi));
return aFrame->IsSVGText() ||
NS_STYLE_TEXT_ALIGN_LEFT == aAlignment ||
(((NS_STYLE_TEXT_ALIGN_DEFAULT == aAlignment &&
NS_STYLE_DIRECTION_LTR == aDirection) ||
(NS_STYLE_TEXT_ALIGN_END == aAlignment &&
NS_STYLE_DIRECTION_RTL == aDirection)) &&
!(NS_STYLE_UNICODE_BIDI_PLAINTEXT & aUnicodeBidi));
}
nsresult
@ -5408,8 +5408,8 @@ nsBlockFrame::DoRemoveFrame(nsIFrame* aDeletedFrame, uint32_t aFlags)
// XXX We need to do this if we're removing a frame as a result of
// a call to RemoveFrame(), but we may not need to do this in all
// cases...
nsRect visOverflow(cur->GetVisualOverflowArea());
#ifdef NOISY_BLOCK_INVALIDATE
nsRect visOverflow(cur->GetVisualOverflowArea());
printf("%p invalidate 10 (%d, %d, %d, %d)\n",
this, visOverflow.x, visOverflow.y,
visOverflow.width, visOverflow.height);

View File

@ -804,8 +804,8 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
(NS_UNCONSTRAINEDSIZE != mContentArea.height)) {
region.height = NS_MAX(region.height, mContentArea.height - floatY);
}
nsresult rv =
mFloatManager->AddFloat(aFloat, region);
DebugOnly<nsresult> rv =
mFloatManager->AddFloat(aFloat, region);
NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "bad float placement");
// store region
nsFloatManager::StoreRegionFor(aFloat, region);

View File

@ -439,7 +439,6 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.width = aDesiredSize.height = 0;
} else {
nsIFrame* kidFrame = mFrames.FirstChild();
nsRect oldKidRect = kidFrame->GetRect();
bool kidDirty = (kidFrame->GetStateBits() & NS_FRAME_IS_DIRTY) != 0;
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,

View File

@ -3054,14 +3054,11 @@ nsXULScrollFrame::LayoutScrollArea(nsBoxLayoutState& aState,
mInner.mScrollPort.Size());
int32_t flags = NS_FRAME_NO_MOVE_VIEW;
nsRect originalRect = mInner.mScrolledFrame->GetRect();
nsRect originalVisOverflow = mInner.mScrolledFrame->GetVisualOverflowRect();
nsSize minSize = mInner.mScrolledFrame->GetMinSize(aState);
if (minSize.height > childRect.height)
childRect.height = minSize.height;
if (minSize.width > childRect.width)
childRect.width = minSize.width;

View File

@ -1261,8 +1261,8 @@ nsObjectFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
nsRefPtr<ImageContainer> container = GetImageContainer();
if (container && container->HasCurrentImage() || !isVisible ||
container->GetCurrentSize() != gfxIntSize(window->width, window->height)) {
if (container && (container->HasCurrentImage() || !isVisible ||
container->GetCurrentSize() != gfxIntSize(window->width, window->height))) {
mInstanceOwner->NotifyPaintWaiter(aBuilder);
}
}

View File

@ -86,10 +86,10 @@ NS_IMPL_FRAMEARENA_HELPERS(nsSimplePageSequenceFrame)
nsSimplePageSequenceFrame::nsSimplePageSequenceFrame(nsStyleContext* aContext) :
nsContainerFrame(aContext),
mTotalPages(-1),
mCurrentCanvasListSetup(false),
mSelectionHeight(-1),
mYSelOffset(0),
mCalledBeginPage(false)
mCalledBeginPage(false),
mCurrentCanvasListSetup(false)
{
nscoord halfInch = PresContext()->CSSTwipsToAppUnits(NS_INCHES_TO_TWIPS(0.5));
mMargin.SizeTo(halfInch, halfInch, halfInch, halfInch);

View File

@ -165,8 +165,8 @@ nsTextFrameUtils::TransformText(const uint8_t* aText, uint32_t aLength,
uint32_t i;
for (i = 0; i < aLength; ++i) {
uint8_t ch = *aText++;
if (IsDiscardable(ch, &flags) ||
ch == '\n' && aCompression == DISCARD_NEWLINE) {
if (IsDiscardable(ch, &flags) ||
(ch == '\n' && aCompression == DISCARD_NEWLINE)) {
aSkipChars->SkipChar();
} else {
aSkipChars->KeepChar();

View File

@ -235,7 +235,10 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
// Make a copy of the reflow state and change the computed width and height
// to reflect the available space for the fixed items
nsHTMLReflowState reflowState(aReflowState);
nsPoint offset = AdjustReflowStateForScrollbars(&reflowState);
#ifdef DEBUG
nsPoint offset =
#endif
AdjustReflowStateForScrollbars(&reflowState);
if (IsAbsoluteContainer()) {
NS_ASSERTION(GetAbsoluteContainingBlock()->GetChildList().IsEmpty() ||

View File

@ -13,6 +13,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = inspector
LIBRARY_NAME = inspector_s
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1
EXPORTS = \
nsFontFace.h \

View File

@ -14,6 +14,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = layout
LIBRARY_NAME = gkmathml_s
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1
LOCAL_INCLUDES = \

View File

@ -109,8 +109,7 @@ LoadProperties(const nsString& aName,
class nsGlyphTable {
public:
explicit nsGlyphTable(const nsString& aPrimaryFontName)
: mType(NS_TABLE_TYPE_UNICODE),
mFontName(1), // ensure space for primary font name.
: mFontName(1), // ensure space for primary font name.
mState(NS_TABLE_STATE_EMPTY),
mCharCache(0)
{
@ -172,14 +171,11 @@ private:
nsGlyphCode ElementAt(nsPresContext* aPresContext, nsMathMLChar* aChar,
uint32_t aPosition);
// The type is either NS_TABLE_TYPE_UNICODE or NS_TABLE_TYPE_GLYPH_INDEX
int32_t mType;
// mFontName[0] is the primary font associated to this table. The others
// are possible "external" fonts for glyphs not in the primary font
// but which are needed to stretch certain characters in the table
nsTArray<nsString> mFontName;
nsTArray<nsString> mFontName;
// Tri-state variable for error/empty/ready
int32_t mState;
@ -199,8 +195,7 @@ private:
// mGlyphCache excludes the '@' symbol and explicitly inserts all optional '0'
// that indicates the primary font identifier. Specifically therefore, the
// k-th glyph is characterized by :
// 1) mGlyphCache[3*k],mGlyphCache[3*k+1] : its Unicode point (or glyph index
// -- depending on mType),
// 1) mGlyphCache[3*k],mGlyphCache[3*k+1] : its Unicode point
// 2) mGlyphCache[3*k+2] : the numeric identifier of the font where it comes
// from.
// A font identifier of '0' means the default primary font associated to this

View File

@ -14,7 +14,7 @@ XPIDL_MODULE = layout_printing
GRE_MODULE = 1
LIBRARY_NAME = gkprinting_s
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1
XPIDLSRCS = \
nsIPrintProgress.idl \

View File

@ -1245,7 +1245,7 @@ nsComputedDOMStyle::DoGetFontWeight()
uint16_t weight = font->mFont.weight;
NS_ASSERTION(weight % 100 == 0, "unexpected value of font-weight");
val->SetNumber(font->mFont.weight);
val->SetNumber(weight);
return val;
}

View File

@ -13,7 +13,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = layout
LIBRARY_NAME = gkxulbase_s
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS = 1
ifdef MOZ_XUL