fixed numerous warnings. Reviewed by Hyatt.

This commit is contained in:
evaughan%netscape.com 1999-10-20 00:46:21 +00:00
parent aab1c75cc8
commit a2bcc96c08
13 changed files with 95 additions and 45 deletions

View File

@ -194,11 +194,7 @@ nsFieldSetFrame::Paint(nsIPresContext& aPresContext,
(const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
const nsStyleSpacing* spacing =
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
float p2t;
aPresContext.GetScaledPixelsToTwips(&p2t);
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
nsMargin border;
if (!spacing->GetBorder(border)) {
NS_NOTYETIMPLEMENTED("percentage border");

View File

@ -752,6 +752,10 @@ nsGfxScrollFrameInner::SetFrameSize( nsIFrame* aFrame,
nsresult rv = aFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&) spacing);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");
if (NS_FAILED(rv))
return rv;
nsMargin margin;
if (!spacing->GetMargin(margin))
margin.SizeTo(0,0,0,0);
@ -779,6 +783,10 @@ nsGfxScrollFrameInner::GetFrameSize( nsIFrame* aFrame,
nsresult rv = aFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&) spacing);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");
if (NS_FAILED(rv))
return rv;
nsMargin margin;
if (!spacing->GetMargin(margin))
margin.SizeTo(0,0,0,0);
@ -1140,7 +1148,10 @@ nsGfxScrollFrameInner::ReflowFrame( nsIPresContext& aPresContext,
nsresult rv = aFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&) spacing);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");
if (NS_FAILED(rv))
return rv;
// this basically sucks. Sometime it fails to get the border and padding
// because one or the other is not set. So we are forced to go out and get
// the border and padding separately and add them together.
@ -1213,6 +1224,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext& aPresContext
// get the current scrollarea size
nsSize oldScrollAreaSize;
GetFrameSize(mScrollAreaFrame, oldScrollAreaSize);
// get the width of the vertical scrollbar and the height of the horizontal scrollbar
@ -1221,7 +1233,6 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext& aPresContext
// Compute the scroll area size (area inside of the border edge and inside
// of any vertical and horizontal scrollbars)
nsSize scrollAreaSize;
nsHTMLReflowMetrics scrollAreaDesiredSize(aDesiredSize.maxElementSize);
CalculateScrollAreaSize(aPresContext, aReflowState, sbSize,
@ -1292,9 +1303,9 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext& aPresContext
// Go ahead and reflow the child a second time if we added or removed the scrollbar
if (mustReflow) {
nsSize scrollAreaReflowSize(scrollAreaSize.width, scrollAreaSize.height);
scrollAreaReflowSize.SizeTo(scrollAreaSize.width, scrollAreaSize.height);
PRBool resized = PR_FALSE;
resized = PR_FALSE;
ReflowFrame(aPresContext, scrollAreaDesiredSize, aReflowState, aStatus, mScrollAreaFrame,
scrollAreaReflowSize,
@ -1676,6 +1687,9 @@ nsGfxScrollFrame::Dirty(const nsHTMLReflowState& aReflowState, nsIFrame*& increm
nsIBox* ibox = nsnull;
nsresult rv = childFrame->QueryInterface(nsIBox::GetIID(), (void**)&ibox);
NS_ASSERTION(NS_SUCCEEDED(rv),"We have a child that is not a box!!!!");
if (NS_FAILED(rv))
return rv;
ibox->Dirty(aReflowState, incrementalChild);
break;
}

View File

@ -752,6 +752,10 @@ nsGfxScrollFrameInner::SetFrameSize( nsIFrame* aFrame,
nsresult rv = aFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&) spacing);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");
if (NS_FAILED(rv))
return rv;
nsMargin margin;
if (!spacing->GetMargin(margin))
margin.SizeTo(0,0,0,0);
@ -779,6 +783,10 @@ nsGfxScrollFrameInner::GetFrameSize( nsIFrame* aFrame,
nsresult rv = aFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&) spacing);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");
if (NS_FAILED(rv))
return rv;
nsMargin margin;
if (!spacing->GetMargin(margin))
margin.SizeTo(0,0,0,0);
@ -1140,7 +1148,10 @@ nsGfxScrollFrameInner::ReflowFrame( nsIPresContext& aPresContext,
nsresult rv = aFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&) spacing);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");
if (NS_FAILED(rv))
return rv;
// this basically sucks. Sometime it fails to get the border and padding
// because one or the other is not set. So we are forced to go out and get
// the border and padding separately and add them together.
@ -1213,6 +1224,7 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext& aPresContext
// get the current scrollarea size
nsSize oldScrollAreaSize;
GetFrameSize(mScrollAreaFrame, oldScrollAreaSize);
// get the width of the vertical scrollbar and the height of the horizontal scrollbar
@ -1221,7 +1233,6 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext& aPresContext
// Compute the scroll area size (area inside of the border edge and inside
// of any vertical and horizontal scrollbars)
nsSize scrollAreaSize;
nsHTMLReflowMetrics scrollAreaDesiredSize(aDesiredSize.maxElementSize);
CalculateScrollAreaSize(aPresContext, aReflowState, sbSize,
@ -1292,9 +1303,9 @@ nsGfxScrollFrameInner::ReflowScrollArea( nsIPresContext& aPresContext
// Go ahead and reflow the child a second time if we added or removed the scrollbar
if (mustReflow) {
nsSize scrollAreaReflowSize(scrollAreaSize.width, scrollAreaSize.height);
scrollAreaReflowSize.SizeTo(scrollAreaSize.width, scrollAreaSize.height);
PRBool resized = PR_FALSE;
resized = PR_FALSE;
ReflowFrame(aPresContext, scrollAreaDesiredSize, aReflowState, aStatus, mScrollAreaFrame,
scrollAreaReflowSize,
@ -1676,6 +1687,9 @@ nsGfxScrollFrame::Dirty(const nsHTMLReflowState& aReflowState, nsIFrame*& increm
nsIBox* ibox = nsnull;
nsresult rv = childFrame->QueryInterface(nsIBox::GetIID(), (void**)&ibox);
NS_ASSERTION(NS_SUCCEEDED(rv),"We have a child that is not a box!!!!");
if (NS_FAILED(rv))
return rv;
ibox->Dirty(aReflowState, incrementalChild);
break;
}

View File

@ -650,6 +650,10 @@ nsScrollPortFrame::GetChildBoxInfo(nsIPresContext& aPresContext, const nsHTMLRef
nsresult rv = aFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&) spacing);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");
if (NS_FAILED(rv))
return rv;
nsMargin border(0,0,0,0);;
spacing->GetBorderPadding(border);
@ -692,7 +696,6 @@ nsScrollPortFrame::Dirty(const nsHTMLReflowState& aReflowState, nsIFrame*& incre
nsIFrame* frame;
aReflowState.reflowCommand->GetNext(frame);
nscoord count = 0;
nsIFrame* childFrame = mFrames.FirstChild();
nsIBox* ibox;

View File

@ -194,11 +194,7 @@ nsFieldSetFrame::Paint(nsIPresContext& aPresContext,
(const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
const nsStyleSpacing* spacing =
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
float p2t;
aPresContext.GetScaledPixelsToTwips(&p2t);
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
nsMargin border;
if (!spacing->GetBorder(border)) {
NS_NOTYETIMPLEMENTED("percentage border");

View File

@ -91,7 +91,7 @@ public:
virtual nsresult DragMove(nsIDOMEvent* aMouseEvent) { return NS_OK; }
virtual nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
void DisplayDebugInfoFor(nsIPresContext& aPresContext,
nsresult DisplayDebugInfoFor(nsIPresContext& aPresContext,
nsPoint& aPoint,
PRInt32& aCursor);
@ -207,7 +207,7 @@ nsBoxFrame::GetInnerRect(nsRect& aInner)
{
const nsStyleSpacing* spacing;
nsresult rv = GetStyleData(eStyleStruct_Spacing,
GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&) spacing);
nsMargin border(0,0,0,0);
@ -232,7 +232,7 @@ nsBoxFrame::GetRedefinedMinPrefMax(nsIPresContext& aPresContext, nsIFrame* aFra
{
// add in the css min, max, pref
const nsStylePosition* position;
nsresult rv = aFrame->GetStyleData(eStyleStruct_Position,
aFrame->GetStyleData(eStyleStruct_Position,
(const nsStyleStruct*&) position);
// see if the width or height was specifically set
@ -765,9 +765,10 @@ nsBoxFrame::ChildResized(nsIFrame* aFrame, nsHTMLReflowMetrics& aDesiredSize, ns
// add in the css min, max, pref
const nsStylePosition* position;
nsresult rv = aFrame->GetStyleData(eStyleStruct_Position,
aFrame->GetStyleData(eStyleStruct_Position,
(const nsStyleStruct*&) position);
// same for min size. Unfortunately min size is always set to 0. So for now
// we will assume 0 means not set.
if (position->mMinWidth.GetUnit() == eStyleUnit_Coord) {
@ -803,7 +804,7 @@ nsBoxFrame::ChildResized(nsIFrame* aFrame, nsHTMLReflowMetrics& aDesiredSize, ns
// add in the css min, max, pref
const nsStylePosition* position;
nsresult rv = aFrame->GetStyleData(eStyleStruct_Position,
aFrame->GetStyleData(eStyleStruct_Position,
(const nsStyleStruct*&) position);
// same for min size. Unfortunately min size is always set to 0. So for now
@ -1695,7 +1696,7 @@ nsBoxDebugInner::PaintSprings(nsIPresContext& aPresContext, nsIRenderingContext&
// remove our border
const nsStyleSpacing* spacing;
nsresult rv = mOuter->GetStyleData(eStyleStruct_Spacing,
mOuter->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&) spacing);
nsMargin border(0,0,0,0);
@ -2019,7 +2020,7 @@ nsBoxDebugInner::RemoveListener()
reciever->RemoveEventListenerByIID(NS_STATIC_CAST(nsIDOMMouseMotionListener*,this),kIDOMMouseMotionListenerIID);
}
void
nsresult
nsBoxDebugInner::DisplayDebugInfoFor(nsIPresContext& aPresContext,
nsPoint& aPoint,
PRInt32& aCursor)
@ -2047,17 +2048,17 @@ nsBoxDebugInner::DisplayDebugInfoFor(nsIPresContext& aPresContext,
}
}
nsRect r;
parent->GetRect(r);
x -= r.x;
y -= r.y;
nsRect cr;
parent->GetRect(cr);
x -= cr.x;
y -= cr.y;
parent->GetParent(&parent);
}
nsRect r(0,0,mOuter->mRect.width, mOuter->mRect.height);
if (!r.Contains(nsPoint(x,y)))
return;
return NS_OK;
int count = 0;
nsIFrame* childFrame = mOuter->mFrames.FirstChild();
@ -2073,7 +2074,7 @@ nsBoxDebugInner::DisplayDebugInfoFor(nsIPresContext& aPresContext,
aCursor = NS_STYLE_CURSOR_POINTER;
// found it but we already showed it.
if (mDebugChild == childFrame)
return;
return NS_OK;
nsCOMPtr<nsIContent> content;
mOuter->mInner->GetContentOf(childFrame, getter_AddRefs(content));
@ -2119,6 +2120,10 @@ nsBoxDebugInner::DisplayDebugInfoFor(nsIPresContext& aPresContext,
nsresult rv = childFrame->GetStyleData(eStyleStruct_Position,
(const nsStyleStruct*&) position);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get position");
if (NS_FAILED(rv))
return rv;
// see if the width or height was specifically set
if (position->mWidth.GetUnit() == eStyleUnit_Coord) {
aSize.prefSize.width = position->mWidth.GetCoordValue();
@ -2208,8 +2213,12 @@ nsBoxDebugInner::DisplayDebugInfoFor(nsIPresContext& aPresContext,
}
nsresult rv = childFrame->GetNextSibling(&childFrame);
NS_ASSERTION(rv == NS_OK,"failed to get next child");
if (NS_FAILED(rv))
return rv;
count++;
}
return NS_OK;
}
NS_IMETHODIMP

View File

@ -142,8 +142,6 @@ nsDeckFrame::Paint(nsIPresContext& aPresContext,
return NS_OK;
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
const nsStyleDisplay* disp = (const nsStyleDisplay*)
mStyleContext->GetStyleData(eStyleStruct_Display);
if (disp->mVisible && mRect.width && mRect.height) {
// Paint our background and border
PRIntn skipSides = GetSkipSides();

View File

@ -78,7 +78,7 @@ void nsRepeatService::Notify(nsITimer *timer)
// if the repeat delay is the initial one reset it.
if (mRepeatTimer) {
mRepeatTimer->Cancel();
nsresult rv = NS_NewTimer(getter_AddRefs(mRepeatTimer));
NS_NewTimer(getter_AddRefs(mRepeatTimer));
mRepeatTimer->Init(this, REPEAT_DELAY);
}

View File

@ -192,7 +192,10 @@ nsSliderFrame::AttributeChanged(nsIPresContext* aPresContext,
aNameSpaceID, aAttribute, aHint);
// if the current position changes
if (aAttribute == nsXULAtoms::curpos) {
CurrentPositionChanged(aPresContext);
rv = CurrentPositionChanged(aPresContext);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to change position");
if (NS_FAILED(rv))
return rv;
} else if (aAttribute == nsXULAtoms::maxpos) {
// bounds check it.
@ -267,7 +270,7 @@ nsSliderFrame::Paint(nsIPresContext& aPresContext,
return nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
}
void
nsresult
nsSliderFrame::ReflowThumb(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
@ -288,6 +291,11 @@ nsSliderFrame::ReflowThumb(nsIPresContext& aPresContext,
nsresult rv = thumbFrame->GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&) spacing);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");
if (NS_FAILED(rv))
return rv;
nsMargin margin(0,0,0,0);
spacing->GetMargin(margin);
nsMargin border(0,0,0,0);
@ -305,6 +313,8 @@ nsSliderFrame::ReflowThumb(nsIPresContext& aPresContext,
// add the margin back in
aDesiredSize.width += margin.left + margin.right;
aDesiredSize.height += margin.top + margin.bottom;
return NS_OK;
}
PRBool
@ -516,7 +526,6 @@ nsSliderFrame::HandleEvent(nsIPresContext& aPresContext,
// set it
SetCurrentPosition(scrollbar, thumbFrame, pospx);
//CurrentPositionChanged(&aPresContext);
}
break;
@ -525,7 +534,6 @@ nsSliderFrame::HandleEvent(nsIPresContext& aPresContext,
case NS_MOUSE_LEFT_BUTTON_UP:
// stop capturing
//printf("stop capturing\n");
nsIFrame* thumbFrame = mFrames.FirstChild();
AddListener();
DragThumb(PR_FALSE);
}
@ -576,7 +584,7 @@ nsSliderFrame::PageUpDown(nsIFrame* aThumbFrame, nscoord change)
}
// called when the current position changed and we need to update the thumb's location
void
nsresult
nsSliderFrame::CurrentPositionChanged(nsIPresContext* aPresContext)
{
nsIContent* scrollbar = GetScrollBar();
@ -588,7 +596,7 @@ nsSliderFrame::CurrentPositionChanged(nsIPresContext* aPresContext)
// do nothing if the position did not change
if (mCurPos == curpos)
return;
return NS_OK;
// get our current position and max position from our content node
PRInt32 maxpos = GetMaxPosition(scrollbar);
@ -615,6 +623,10 @@ nsSliderFrame::CurrentPositionChanged(nsIPresContext* aPresContext)
nsresult rv = GetStyleData(eStyleStruct_Spacing,
(const nsStyleStruct*&) spacing);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get spacing");
if (NS_FAILED(rv))
return rv;
nsMargin borderPadding(0,0,0,0);
spacing->GetBorderPadding(borderPadding);
@ -641,6 +653,7 @@ nsSliderFrame::CurrentPositionChanged(nsIPresContext* aPresContext)
mCurPos = curpos;
return NS_OK;
}
void

View File

@ -70,7 +70,7 @@ public:
nsIAtom* aAttribute,
PRInt32 aHint);
virtual void CurrentPositionChanged(nsIPresContext* aPresContext);
virtual nsresult CurrentPositionChanged(nsIPresContext* aPresContext);
NS_IMETHOD Init(nsIPresContext& aPresContext,
nsIContent* aContent,
@ -192,7 +192,7 @@ public:
protected:
virtual void ReflowThumb(nsIPresContext& aPresContext,
virtual nsresult ReflowThumb(nsIPresContext& aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus,

View File

@ -519,7 +519,7 @@ nsSplitterFrameImpl::MouseDrag(nsIPresContext& aPresContext, nsGUIEvent* aEvent)
for (i=0; i < mChildInfosAfterCount; i++)
mChildInfosAfter[i].changed = mChildInfosAfter[i].current;
nscoord oldPos = pos;
// nscoord oldPos = pos;
ResizeChildTo(pos, mChildInfosBefore, mChildInfosAfter, mChildInfosBeforeCount, mChildInfosAfterCount, bounded);

View File

@ -1246,6 +1246,11 @@ nsTitledButtonFrame::MouseClicked (nsIPresContext & aPresContext)
case eOff:
newState = mHasOnceBeenInMixedState ? eMixed: eOn;
break;
case eUnset:
newState = eOn;
break;
}
SetCurrentCheckState(newState);
}
@ -1288,6 +1293,9 @@ nsTitledButtonFrame :: CheckStateToString ( CheckState inState, nsString& outSta
case eMixed:
outStateAsString = "2";
break;
case eUnset:
outStateAsString = "";
}
} // CheckStateToString

View File

@ -361,7 +361,6 @@ nsToolboxFrame::ReflowGrippies(nsIPresContext& aPresContext,
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
nscoord grippyWidth = kGrippyWidthInPixels * onePixel; // remember to leave room for the grippy on the right
nscoord collapsedGrippyHeight = kCollapsedGrippyHeightInPixels * onePixel;
nscoord collapsedGrippyWidth = kCollapsedGrippyWidthInPixels * onePixel;
nsresult errCode = NS_OK;
const PRBool isHorz = IsHorizontal();