diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 57369a32492c..ce856f5a7e34 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -505,11 +505,11 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, PRUint32 aFlags) { if (aView) { - nsIViewManager *vm; - nsFrameState kidState; - nsSize frameSize; + nsCOMPtr vm; + nsFrameState kidState; + nsSize frameSize; - aView->GetViewManager(vm); + aView->GetViewManager(*getter_AddRefs(vm)); aFrame->GetFrameState(&kidState); aFrame->GetSize(frameSize); @@ -581,11 +581,10 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, } else if (NS_STYLE_VISIBILITY_HIDDEN == vis->mVisible) { // If it has a widget, hide the view because the widget can't deal with it - nsIWidget* widget = nsnull; - aView->GetWidget(widget); + nsCOMPtr widget; + aView->GetWidget(*getter_AddRefs(widget)); if (widget) { viewIsVisible = PR_FALSE; - NS_RELEASE(widget); } else { // If it's a scroll frame or a list control frame which is derived from the scrollframe, @@ -593,8 +592,8 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, // child elements can't override their parent's visibility, but // it's not practical to leave it visible in all cases because // the scrollbars will be showing - nsIAtom* frameType; - aFrame->GetFrameType(&frameType); + nsCOMPtr frameType; + aFrame->GetFrameType(getter_AddRefs(frameType)); if (frameType == nsLayoutAtoms::scrollFrame || frameType == nsLayoutAtoms::listControlFrame) { viewIsVisible = PR_FALSE; @@ -616,7 +615,6 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, viewIsVisible = PR_FALSE; } } - NS_IF_RELEASE(frameType); } } @@ -739,8 +737,6 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, if (viewIsVisible) { vm->SetViewContentTransparency(aView, viewHasTransparentContent); } - - NS_RELEASE(vm); } } diff --git a/layout/html/base/src/nsContainerFrame.cpp b/layout/html/base/src/nsContainerFrame.cpp index 57369a32492c..ce856f5a7e34 100644 --- a/layout/html/base/src/nsContainerFrame.cpp +++ b/layout/html/base/src/nsContainerFrame.cpp @@ -505,11 +505,11 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, PRUint32 aFlags) { if (aView) { - nsIViewManager *vm; - nsFrameState kidState; - nsSize frameSize; + nsCOMPtr vm; + nsFrameState kidState; + nsSize frameSize; - aView->GetViewManager(vm); + aView->GetViewManager(*getter_AddRefs(vm)); aFrame->GetFrameState(&kidState); aFrame->GetSize(frameSize); @@ -581,11 +581,10 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, } else if (NS_STYLE_VISIBILITY_HIDDEN == vis->mVisible) { // If it has a widget, hide the view because the widget can't deal with it - nsIWidget* widget = nsnull; - aView->GetWidget(widget); + nsCOMPtr widget; + aView->GetWidget(*getter_AddRefs(widget)); if (widget) { viewIsVisible = PR_FALSE; - NS_RELEASE(widget); } else { // If it's a scroll frame or a list control frame which is derived from the scrollframe, @@ -593,8 +592,8 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, // child elements can't override their parent's visibility, but // it's not practical to leave it visible in all cases because // the scrollbars will be showing - nsIAtom* frameType; - aFrame->GetFrameType(&frameType); + nsCOMPtr frameType; + aFrame->GetFrameType(getter_AddRefs(frameType)); if (frameType == nsLayoutAtoms::scrollFrame || frameType == nsLayoutAtoms::listControlFrame) { viewIsVisible = PR_FALSE; @@ -616,7 +615,6 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, viewIsVisible = PR_FALSE; } } - NS_IF_RELEASE(frameType); } } @@ -739,8 +737,6 @@ nsContainerFrame::SyncFrameViewAfterReflow(nsIPresContext* aPresContext, if (viewIsVisible) { vm->SetViewContentTransparency(aView, viewHasTransparentContent); } - - NS_RELEASE(vm); } } diff --git a/layout/xul/base/src/nsBox.cpp b/layout/xul/base/src/nsBox.cpp index 5cfd0b63fcfc..36a27800ad47 100644 --- a/layout/xul/base/src/nsBox.cpp +++ b/layout/xul/base/src/nsBox.cpp @@ -665,28 +665,30 @@ nsBox::GetBorder(nsMargin& aMargin) if (disp->mAppearance && gTheme) { // Go to the theme for the border. nsSize size; - nsCOMPtr doc; nsCOMPtr content; frame->GetContent(getter_AddRefs(content)); - content->GetDocument(*getter_AddRefs(doc)); - nsCOMPtr shell; - if (doc) { - doc->GetShellAt(0, getter_AddRefs(shell)); - nsCOMPtr context; - shell->GetPresContext(getter_AddRefs(context)); - if (gTheme->ThemeSupportsWidget(context, disp->mAppearance)) { - nsCOMPtr dc; - context->GetDeviceContext(getter_AddRefs(dc)); - nsMargin margin(0,0,0,0); - gTheme->GetWidgetBorder(dc, frame, - disp->mAppearance, &margin); - float p2t; - context->GetScaledPixelsToTwips(&p2t); - aMargin.top = NSIntPixelsToTwips(margin.top, p2t); - aMargin.right = NSIntPixelsToTwips(margin.right, p2t); - aMargin.bottom = NSIntPixelsToTwips(margin.bottom, p2t); - aMargin.left = NSIntPixelsToTwips(margin.left, p2t); - return NS_OK; + if (content) { + nsCOMPtr doc; + content->GetDocument(*getter_AddRefs(doc)); + if (doc) { + nsCOMPtr shell; + doc->GetShellAt(0, getter_AddRefs(shell)); + nsCOMPtr context; + shell->GetPresContext(getter_AddRefs(context)); + if (gTheme->ThemeSupportsWidget(context, disp->mAppearance)) { + nsCOMPtr dc; + context->GetDeviceContext(getter_AddRefs(dc)); + nsMargin margin(0,0,0,0); + gTheme->GetWidgetBorder(dc, frame, + disp->mAppearance, &margin); + float p2t; + context->GetScaledPixelsToTwips(&p2t); + aMargin.top = NSIntPixelsToTwips(margin.top, p2t); + aMargin.right = NSIntPixelsToTwips(margin.right, p2t); + aMargin.bottom = NSIntPixelsToTwips(margin.bottom, p2t); + aMargin.left = NSIntPixelsToTwips(margin.left, p2t); + return NS_OK; + } } } }