Fixed some errors related to switch to using nsCOMPtr

This commit is contained in:
troy%netscape.com 1999-02-12 18:41:26 +00:00
Родитель 1441f309b6
Коммит 0debd6f0d1
49 изменённых файлов: 107 добавлений и 107 удалений

Просмотреть файл

@ -428,7 +428,7 @@ nsEventStateManager::ShiftFocus()
if (nsnull == mDocument) {
nsCOMPtr<nsIPresShell> presShell;
mPresContext->GetShell(getter_AddRefs(presShell));
if (nsnull != presShell) {
if (presShell) {
presShell->GetDocument(&mDocument);
if (nsnull == mDocument) {
return;

Просмотреть файл

@ -653,10 +653,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
if (nsnull != presShell) {
if (presShell) {
nsCOMPtr<nsIDocument> doc;
presShell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
nsIHTMLContentContainer* htmlContainer;
if (NS_OK == doc->QueryInterface(kIHTMLContentContainerIID,
(void**)&htmlContainer)) {

Просмотреть файл

@ -211,7 +211,7 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
nsCOMPtr<nsIDeviceContext> dc;
aPresContext->GetDeviceContext(getter_AddRefs(dc));
if (nsnull != dc) {
if (dc) {
nsAutoString familyList;
value.GetStringValue(familyList);

Просмотреть файл

@ -284,7 +284,7 @@ nsHTMLFormElement::Submit()
if ((NS_OK == result) && formMan) {
nsCOMPtr<nsIPresContext> context;
shell->GetPresContext(getter_AddRefs(context));
if (nsnull != context) {
if (context) {
// XXX We're currently passing in null for the frame.
// It works for now, but might not always
// be correct. In the future, we might not need the

Просмотреть файл

@ -1460,10 +1460,10 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
PRInt32 i, ns = mDocument->GetNumberOfShells();
for (i = 0; i < ns; i++) {
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
if (nsnull != shell) {
if (shell) {
nsCOMPtr<nsIViewManager> vm;
nsresult rv = shell->GetViewManager(getter_AddRefs(vm));
if(NS_SUCCEEDED(rv) && (nsnull != vm)) {
if(NS_SUCCEEDED(rv) && vm) {
vm->SetQuality(nsContentQuality(aQualityLevel));
}
}
@ -1972,7 +1972,7 @@ HTMLContentSink::StartLayout()
PRInt32 i, ns = mDocument->GetNumberOfShells();
for (i = 0; i < ns; i++) {
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
if (nsnull != shell) {
if (shell) {
// Make shell an observer for next time
shell->BeginObservingDocument();
@ -1986,7 +1986,7 @@ HTMLContentSink::StartLayout()
// Now trigger a refresh
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
vm->EnableRefresh();
}
}
@ -2008,10 +2008,10 @@ HTMLContentSink::StartLayout()
PRInt32 i, ns = mDocument->GetNumberOfShells();
for (i = 0; i < ns; i++) {
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
if (nsnull != shell) {
if (shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
nsIView* rootView = nsnull;
vm->GetRootView(rootView);
if (nsnull != rootView) {
@ -2039,13 +2039,13 @@ HTMLContentSink::ScrollToRef()
PRInt32 i, ns = mDocument->GetNumberOfShells();
for (i = 0; i < ns; i++) {
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
if (nsnull != shell) {
if (shell) {
nsIFrame* frame;
shell->GetPrimaryFrameFor(mRefContent, &frame);
if (nsnull != frame) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
nsIView* viewportView = nsnull;
vm->GetRootView(viewportView);
if (nsnull != viewportView) {

Просмотреть файл

@ -525,7 +525,7 @@ nsHTMLDocument::InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex, PRBool
nsIPresShell* shell = (nsIPresShell*)mPresShells.ElementAt(index);
nsCOMPtr<nsIStyleSet> set;
shell->GetStyleSet(getter_AddRefs(set));
if (nsnull != set) {
if (set) {
set->AddDocStyleSheet(aSheet, this);
}
}

Просмотреть файл

@ -221,7 +221,7 @@ nsImageDocument::StartImageLoad(nsIURL* aURL, nsIStreamListener*& aListener)
if (nsnull != shell) {
nsCOMPtr<nsIPresContext> cx;
shell->GetPresContext(getter_AddRefs(cx));
if (nsnull != cx) {
if (cx) {
nsIImageGroup* group = nsnull;
cx->GetImageGroup(&group);
if (nsnull != group) {
@ -327,7 +327,7 @@ nsImageDocument::StartLayout()
// XXX It's unfortunate that this has to be here
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
vm->EnableRefresh();
}

Просмотреть файл

@ -1169,7 +1169,7 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
if (eCSSUnit_String == ourFont->mFamily.GetUnit()) {
nsCOMPtr<nsIDeviceContext> dc;
aPresContext->GetDeviceContext(getter_AddRefs(dc));
if (nsnull != dc) {
if (dc) {
nsAutoString familyList;
ourFont->mFamily.GetStringValue(familyList);

Просмотреть файл

@ -230,7 +230,7 @@ nsXMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
PRInt32 i, ns = mDocument->GetNumberOfShells();
for (i = 0; i < ns; i++) {
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
if (nsnull != shell) {
if (shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if(vm) {
@ -1323,7 +1323,7 @@ nsXMLContentSink::StartLayout()
// Now trigger a refresh
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
vm->EnableRefresh();
}
@ -1356,7 +1356,7 @@ nsXMLContentSink::StartLayout()
if (nsnull != shell) {
nsCOMPtr<nsIViewManager>vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
nsIView* rootView = nsnull;
vm->GetRootView(rootView);
if (nsnull != rootView) {

Просмотреть файл

@ -1145,7 +1145,7 @@ XULDocumentImpl::AddStyleSheet(nsIStyleSheet* aSheet)
nsIPresShell* shell = NS_STATIC_CAST(nsIPresShell*, mPresShells[index]);
nsCOMPtr<nsIStyleSet> set;
shell->GetStyleSet(getter_AddRefs(set));
if (nsnull != set) {
if (set) {
set->AddDocStyleSheet(aSheet, this);
}
}
@ -1174,7 +1174,7 @@ XULDocumentImpl::SetStyleSheetDisabledState(nsIStyleSheet* aSheet,
nsIPresShell* shell = (nsIPresShell*)mPresShells.ElementAt(index);
nsCOMPtr<nsIStyleSet> set;
shell->GetStyleSet(getter_AddRefs(set));
if (nsnull != set) {
if (set) {
if (aDisabled) {
set->RemoveDocStyleSheet(aSheet);
}
@ -2150,7 +2150,7 @@ XULDocumentImpl::StartLayout(void)
// Now trigger a refresh
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
vm->EnableRefresh();
}

Просмотреть файл

@ -242,8 +242,8 @@ nsPresContext::SetShell(nsIPresShell* aShell)
if (nsnull != mShell) {
nsCOMPtr<nsIDocument> doc;
if (NS_SUCCEEDED(mShell->GetDocument(getter_AddRefs(doc)))) {
NS_ASSERTION(nsnull != doc, "expect document here");
if (nsnull != doc) {
NS_ASSERTION(doc, "expect document here");
if (doc) {
doc->GetBaseURL(mBaseURL);
}
}
@ -320,7 +320,7 @@ nsPresContext::ResolveStyleContextFor(nsIContent* aContent,
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv)) {
if (nsnull != set) {
if (set) {
result = set->ResolveStyleFor(this, aContent, aParentContext,
aForceUnique);
if (nsnull == result) {
@ -348,7 +348,7 @@ nsPresContext::ResolvePseudoStyleContextFor(nsIContent* aParentContent,
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv)) {
if (nsnull != set) {
if (set) {
result = set->ResolvePseudoStyleFor(this, aParentContent, aPseudoTag,
aParentContext, aForceUnique);
if (nsnull == result) {
@ -376,7 +376,7 @@ nsPresContext::ProbePseudoStyleContextFor(nsIContent* aParentContent,
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv)) {
if (nsnull != set) {
if (set) {
result = set->ProbePseudoStyleFor(this, aParentContent, aPseudoTag,
aParentContext, aForceUnique);
}

Просмотреть файл

@ -1160,7 +1160,7 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame,
nsIRenderingContext* result = nsnull;
rv = mPresContext->GetDeviceContext(getter_AddRefs(dx));
if (NS_SUCCEEDED(rv) && (nsnull != dx)) {
if (NS_SUCCEEDED(rv) && dx) {
if (nsnull != view) {
rv = dx->CreateRenderingContext(view, result);
}

Просмотреть файл

@ -242,8 +242,8 @@ nsPresContext::SetShell(nsIPresShell* aShell)
if (nsnull != mShell) {
nsCOMPtr<nsIDocument> doc;
if (NS_SUCCEEDED(mShell->GetDocument(getter_AddRefs(doc)))) {
NS_ASSERTION(nsnull != doc, "expect document here");
if (nsnull != doc) {
NS_ASSERTION(doc, "expect document here");
if (doc) {
doc->GetBaseURL(mBaseURL);
}
}
@ -320,7 +320,7 @@ nsPresContext::ResolveStyleContextFor(nsIContent* aContent,
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv)) {
if (nsnull != set) {
if (set) {
result = set->ResolveStyleFor(this, aContent, aParentContext,
aForceUnique);
if (nsnull == result) {
@ -348,7 +348,7 @@ nsPresContext::ResolvePseudoStyleContextFor(nsIContent* aParentContent,
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv)) {
if (nsnull != set) {
if (set) {
result = set->ResolvePseudoStyleFor(this, aParentContent, aPseudoTag,
aParentContext, aForceUnique);
if (nsnull == result) {
@ -376,7 +376,7 @@ nsPresContext::ProbePseudoStyleContextFor(nsIContent* aParentContent,
nsCOMPtr<nsIStyleSet> set;
nsresult rv = mShell->GetStyleSet(getter_AddRefs(set));
if (NS_SUCCEEDED(rv)) {
if (nsnull != set) {
if (set) {
result = set->ProbePseudoStyleFor(this, aParentContent, aPseudoTag,
aParentContext, aForceUnique);
}

Просмотреть файл

@ -753,7 +753,7 @@ nsRangeList::TakeFocus(nsIFocusTracker *aTracker, nsIFrame *aFrame, PRInt32 aOff
nsCOMPtr<nsIContent>oldContent;
if (NS_SUCCEEDED(frame->GetContent(getter_AddRefs(oldContent))) && oldContent){
nsCOMPtr<nsIDOMNode> oldDomNode(oldContent);
if ((nsnull != oldDomNode) && (oldDomNode == GetFocusNode())) {
if (oldDomNode && (oldDomNode == GetFocusNode())) {
nsCOMPtr<nsIContent> anchorContent;
if (NS_SUCCEEDED(anchor->GetContent(getter_AddRefs(anchorContent))) && anchorContent){
nsCOMPtr<nsIDOMNode>anchorDomNode(anchorContent);

Просмотреть файл

@ -428,7 +428,7 @@ nsEventStateManager::ShiftFocus()
if (nsnull == mDocument) {
nsCOMPtr<nsIPresShell> presShell;
mPresContext->GetShell(getter_AddRefs(presShell));
if (nsnull != presShell) {
if (presShell) {
presShell->GetDocument(&mDocument);
if (nsnull == mDocument) {
return;

Просмотреть файл

@ -226,7 +226,7 @@ nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
PRBool requiresWidget = PR_TRUE;
// Checkto see if the device context supports widgets at all
if (nsnull != dx) {
if (dx) {
dx->SupportsNativeWidgets(requiresWidget);
}

Просмотреть файл

@ -841,7 +841,7 @@ nsListControlFrame::GetScrollBarDimensions(nsIPresContext& aPresContext,
float scale;
nsCOMPtr<nsIDeviceContext> dx;
aPresContext.GetDeviceContext(getter_AddRefs(dx));
if (nsnull != dx) {
if (dx) {
float sbWidth;
float sbHeight;
dx->GetCanonicalPixelScale(scale);

Просмотреть файл

@ -273,7 +273,7 @@ nsTextControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
aPresContext->GetPixelsToTwips(&p2t);
nsCOMPtr<nsIDeviceContext> dx;
aPresContext->GetDeviceContext(getter_AddRefs(dx));
if (nsnull != dx) {
if (dx) {
float sbWidth;
float sbHeight;
dx->GetCanonicalPixelScale(scale);

Просмотреть файл

@ -315,7 +315,7 @@ UpdateBulletCB(nsIPresContext& aPresContext, nsIFrame* aFrame, PRIntn aStatus)
// frame.
nsCOMPtr<nsIPresShell> shell;
rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
nsIReflowCommand* cmd;
rv = NS_NewHTMLReflowCommand(&cmd, aFrame,
nsIReflowCommand::ContentChanged);

Просмотреть файл

@ -363,7 +363,7 @@ nsFrame::DeleteFrame(nsIPresContext& aPresContext)
if (mState & NS_FRAME_EXTERNAL_REFERENCE) {
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
shell->ClearFrameRefs(this);
}
}
@ -594,10 +594,10 @@ nsFrame::DisplaySelection(nsIPresContext& aPresContext, PRBool isOkToTurnOn)
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
nsCOMPtr<nsIDocument> doc;
rv = shell->GetDocument(getter_AddRefs(doc));
if (NS_SUCCEEDED(rv) && (nsnull != doc)) {
if (NS_SUCCEEDED(rv) && doc) {
result = doc->GetDisplaySelection();
if (isOkToTurnOn && !result) {
doc->SetDisplaySelection(PR_TRUE);
@ -705,7 +705,7 @@ nsFrame::HandlePress(nsIPresContext& aPresContext,
mDidDrag = PR_FALSE;
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
nsCOMPtr<nsIRenderingContext> acx;
rv = shell->CreateRenderingContext(this, getter_AddRefs(acx));
if (NS_SUCCEEDED(rv)){
@ -923,7 +923,7 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext& aPresContext,
mDidDrag = PR_FALSE;
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
nsCOMPtr<nsIRenderingContext> acx;
rv = shell->CreateRenderingContext(this, getter_AddRefs(acx));
if (NS_SUCCEEDED(rv)) {
@ -1348,7 +1348,7 @@ nsFrame::ContentChanged(nsIPresContext* aPresContext,
{
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
nsIReflowCommand::ContentChanged);

Просмотреть файл

@ -145,7 +145,7 @@ NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext& aPresContext,
#ifdef NS_DEBUG
nsCOMPtr<nsIPresShell> shell;
aPresContext.GetShell(getter_AddRefs(shell));
if (nsnull != shell) {
if (shell) {
nsIFrame* rootFrame;
shell->GetRootFrame(&rootFrame);
NS_ASSERTION(rootFrame == root, "bad root frame");

Просмотреть файл

@ -451,7 +451,7 @@ nsInlineFrame::SetInitialChildList(nsIPresContext& aPresContext,
}
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
rv = AppendFrames(aPresContext, *shell, aFrameList, PR_FALSE);
}
return rv;

Просмотреть файл

@ -115,7 +115,7 @@ nsLeafFrame::ContentChanged(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPresShell> shell;
rv = aPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
shell->AppendReflowCommand(cmd);
}
NS_RELEASE(cmd);

Просмотреть файл

@ -512,7 +512,7 @@ TextFrame::ContentChanged(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPresShell> shell;
rv = aPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
shell->AppendReflowCommand(cmd);
NS_RELEASE(cmd);
}

Просмотреть файл

@ -315,7 +315,7 @@ UpdateBulletCB(nsIPresContext& aPresContext, nsIFrame* aFrame, PRIntn aStatus)
// frame.
nsCOMPtr<nsIPresShell> shell;
rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
nsIReflowCommand* cmd;
rv = NS_NewHTMLReflowCommand(&cmd, aFrame,
nsIReflowCommand::ContentChanged);

Просмотреть файл

@ -363,7 +363,7 @@ nsFrame::DeleteFrame(nsIPresContext& aPresContext)
if (mState & NS_FRAME_EXTERNAL_REFERENCE) {
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
shell->ClearFrameRefs(this);
}
}
@ -594,10 +594,10 @@ nsFrame::DisplaySelection(nsIPresContext& aPresContext, PRBool isOkToTurnOn)
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
nsCOMPtr<nsIDocument> doc;
rv = shell->GetDocument(getter_AddRefs(doc));
if (NS_SUCCEEDED(rv) && (nsnull != doc)) {
if (NS_SUCCEEDED(rv) && doc) {
result = doc->GetDisplaySelection();
if (isOkToTurnOn && !result) {
doc->SetDisplaySelection(PR_TRUE);
@ -705,7 +705,7 @@ nsFrame::HandlePress(nsIPresContext& aPresContext,
mDidDrag = PR_FALSE;
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
nsCOMPtr<nsIRenderingContext> acx;
rv = shell->CreateRenderingContext(this, getter_AddRefs(acx));
if (NS_SUCCEEDED(rv)){
@ -923,7 +923,7 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext& aPresContext,
mDidDrag = PR_FALSE;
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
nsCOMPtr<nsIRenderingContext> acx;
rv = shell->CreateRenderingContext(this, getter_AddRefs(acx));
if (NS_SUCCEEDED(rv)) {
@ -1348,7 +1348,7 @@ nsFrame::ContentChanged(nsIPresContext* aPresContext,
{
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
nsIReflowCommand* reflowCmd;
rv = NS_NewHTMLReflowCommand(&reflowCmd, this,
nsIReflowCommand::ContentChanged);

Просмотреть файл

@ -145,7 +145,7 @@ NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext& aPresContext,
#ifdef NS_DEBUG
nsCOMPtr<nsIPresShell> shell;
aPresContext.GetShell(getter_AddRefs(shell));
if (nsnull != shell) {
if (shell) {
nsIFrame* rootFrame;
shell->GetRootFrame(&rootFrame);
NS_ASSERTION(rootFrame == root, "bad root frame");

Просмотреть файл

@ -451,7 +451,7 @@ nsInlineFrame::SetInitialChildList(nsIPresContext& aPresContext,
}
nsCOMPtr<nsIPresShell> shell;
nsresult rv = aPresContext.GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
rv = AppendFrames(aPresContext, *shell, aFrameList, PR_FALSE);
}
return rv;

Просмотреть файл

@ -115,7 +115,7 @@ nsLeafFrame::ContentChanged(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPresShell> shell;
rv = aPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
shell->AppendReflowCommand(cmd);
}
NS_RELEASE(cmd);

Просмотреть файл

@ -1160,7 +1160,7 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame,
nsIRenderingContext* result = nsnull;
rv = mPresContext->GetDeviceContext(getter_AddRefs(dx));
if (NS_SUCCEEDED(rv) && (nsnull != dx)) {
if (NS_SUCCEEDED(rv) && dx) {
if (nsnull != view) {
rv = dx->CreateRenderingContext(view, result);
}

Просмотреть файл

@ -512,7 +512,7 @@ TextFrame::ContentChanged(nsIPresContext* aPresContext,
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPresShell> shell;
rv = aPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && (nsnull != shell)) {
if (NS_SUCCEEDED(rv) && shell) {
shell->AppendReflowCommand(cmd);
NS_RELEASE(cmd);
}

Просмотреть файл

@ -653,10 +653,10 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
if (nsnull != presShell) {
if (presShell) {
nsCOMPtr<nsIDocument> doc;
presShell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
nsIHTMLContentContainer* htmlContainer;
if (NS_OK == doc->QueryInterface(kIHTMLContentContainerIID,
(void**)&htmlContainer)) {

Просмотреть файл

@ -211,7 +211,7 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
nsCOMPtr<nsIDeviceContext> dc;
aPresContext->GetDeviceContext(getter_AddRefs(dc));
if (nsnull != dc) {
if (dc) {
nsAutoString familyList;
value.GetStringValue(familyList);

Просмотреть файл

@ -284,7 +284,7 @@ nsHTMLFormElement::Submit()
if ((NS_OK == result) && formMan) {
nsCOMPtr<nsIPresContext> context;
shell->GetPresContext(getter_AddRefs(context));
if (nsnull != context) {
if (context) {
// XXX We're currently passing in null for the frame.
// It works for now, but might not always
// be correct. In the future, we might not need the

Просмотреть файл

@ -1460,10 +1460,10 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
PRInt32 i, ns = mDocument->GetNumberOfShells();
for (i = 0; i < ns; i++) {
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
if (nsnull != shell) {
if (shell) {
nsCOMPtr<nsIViewManager> vm;
nsresult rv = shell->GetViewManager(getter_AddRefs(vm));
if(NS_SUCCEEDED(rv) && (nsnull != vm)) {
if(NS_SUCCEEDED(rv) && vm) {
vm->SetQuality(nsContentQuality(aQualityLevel));
}
}
@ -1972,7 +1972,7 @@ HTMLContentSink::StartLayout()
PRInt32 i, ns = mDocument->GetNumberOfShells();
for (i = 0; i < ns; i++) {
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
if (nsnull != shell) {
if (shell) {
// Make shell an observer for next time
shell->BeginObservingDocument();
@ -1986,7 +1986,7 @@ HTMLContentSink::StartLayout()
// Now trigger a refresh
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
vm->EnableRefresh();
}
}
@ -2008,10 +2008,10 @@ HTMLContentSink::StartLayout()
PRInt32 i, ns = mDocument->GetNumberOfShells();
for (i = 0; i < ns; i++) {
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
if (nsnull != shell) {
if (shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
nsIView* rootView = nsnull;
vm->GetRootView(rootView);
if (nsnull != rootView) {
@ -2039,13 +2039,13 @@ HTMLContentSink::ScrollToRef()
PRInt32 i, ns = mDocument->GetNumberOfShells();
for (i = 0; i < ns; i++) {
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
if (nsnull != shell) {
if (shell) {
nsIFrame* frame;
shell->GetPrimaryFrameFor(mRefContent, &frame);
if (nsnull != frame) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
nsIView* viewportView = nsnull;
vm->GetRootView(viewportView);
if (nsnull != viewportView) {

Просмотреть файл

@ -525,7 +525,7 @@ nsHTMLDocument::InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex, PRBool
nsIPresShell* shell = (nsIPresShell*)mPresShells.ElementAt(index);
nsCOMPtr<nsIStyleSet> set;
shell->GetStyleSet(getter_AddRefs(set));
if (nsnull != set) {
if (set) {
set->AddDocStyleSheet(aSheet, this);
}
}

Просмотреть файл

@ -221,7 +221,7 @@ nsImageDocument::StartImageLoad(nsIURL* aURL, nsIStreamListener*& aListener)
if (nsnull != shell) {
nsCOMPtr<nsIPresContext> cx;
shell->GetPresContext(getter_AddRefs(cx));
if (nsnull != cx) {
if (cx) {
nsIImageGroup* group = nsnull;
cx->GetImageGroup(&group);
if (nsnull != group) {
@ -327,7 +327,7 @@ nsImageDocument::StartLayout()
// XXX It's unfortunate that this has to be here
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
vm->EnableRefresh();
}

Просмотреть файл

@ -226,7 +226,7 @@ nsFormControlFrame::Reflow(nsIPresContext& aPresContext,
PRBool requiresWidget = PR_TRUE;
// Checkto see if the device context supports widgets at all
if (nsnull != dx) {
if (dx) {
dx->SupportsNativeWidgets(requiresWidget);
}

Просмотреть файл

@ -841,7 +841,7 @@ nsListControlFrame::GetScrollBarDimensions(nsIPresContext& aPresContext,
float scale;
nsCOMPtr<nsIDeviceContext> dx;
aPresContext.GetDeviceContext(getter_AddRefs(dx));
if (nsnull != dx) {
if (dx) {
float sbWidth;
float sbHeight;
dx->GetCanonicalPixelScale(scale);

Просмотреть файл

@ -356,7 +356,7 @@ nsSelectControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
float scale;
nsCOMPtr<nsIDeviceContext> dx;
aPresContext->GetDeviceContext(getter_AddRefs(dx));
if (nsnull != dx) {
if (dx) {
float sbWidth;
float sbHeight;
dx->GetCanonicalPixelScale(scale);

Просмотреть файл

@ -273,7 +273,7 @@ nsTextControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
aPresContext->GetPixelsToTwips(&p2t);
nsCOMPtr<nsIDeviceContext> dx;
aPresContext->GetDeviceContext(getter_AddRefs(dx));
if (nsnull != dx) {
if (dx) {
float sbWidth;
float sbHeight;
dx->GetCanonicalPixelScale(scale);

Просмотреть файл

@ -1169,7 +1169,7 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
if (eCSSUnit_String == ourFont->mFamily.GetUnit()) {
nsCOMPtr<nsIDeviceContext> dc;
aPresContext->GetDeviceContext(getter_AddRefs(dc));
if (nsnull != dc) {
if (dc) {
nsAutoString familyList;
ourFont->mFamily.GetStringValue(familyList);

Просмотреть файл

@ -1169,7 +1169,7 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
if (eCSSUnit_String == ourFont->mFamily.GetUnit()) {
nsCOMPtr<nsIDeviceContext> dc;
aPresContext->GetDeviceContext(getter_AddRefs(dc));
if (nsnull != dc) {
if (dc) {
nsAutoString familyList;
ourFont->mFamily.GetStringValue(familyList);

Просмотреть файл

@ -230,7 +230,7 @@ nsXMLContentSink::DidBuildModel(PRInt32 aQualityLevel)
PRInt32 i, ns = mDocument->GetNumberOfShells();
for (i = 0; i < ns; i++) {
nsCOMPtr<nsIPresShell> shell(mDocument->GetShellAt(i));
if (nsnull != shell) {
if (shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if(vm) {
@ -1323,7 +1323,7 @@ nsXMLContentSink::StartLayout()
// Now trigger a refresh
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
vm->EnableRefresh();
}
@ -1356,7 +1356,7 @@ nsXMLContentSink::StartLayout()
if (nsnull != shell) {
nsCOMPtr<nsIViewManager>vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
nsIView* rootView = nsnull;
vm->GetRootView(rootView);
if (nsnull != rootView) {

Просмотреть файл

@ -1145,7 +1145,7 @@ XULDocumentImpl::AddStyleSheet(nsIStyleSheet* aSheet)
nsIPresShell* shell = NS_STATIC_CAST(nsIPresShell*, mPresShells[index]);
nsCOMPtr<nsIStyleSet> set;
shell->GetStyleSet(getter_AddRefs(set));
if (nsnull != set) {
if (set) {
set->AddDocStyleSheet(aSheet, this);
}
}
@ -1174,7 +1174,7 @@ XULDocumentImpl::SetStyleSheetDisabledState(nsIStyleSheet* aSheet,
nsIPresShell* shell = (nsIPresShell*)mPresShells.ElementAt(index);
nsCOMPtr<nsIStyleSet> set;
shell->GetStyleSet(getter_AddRefs(set));
if (nsnull != set) {
if (set) {
if (aDisabled) {
set->RemoveDocStyleSheet(aSheet);
}
@ -2150,7 +2150,7 @@ XULDocumentImpl::StartLayout(void)
// Now trigger a refresh
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
vm->EnableRefresh();
}

Просмотреть файл

@ -655,7 +655,7 @@ NS_IMETHODIMP nsBrowserWindow::FindNext(const nsString &aSearchStr, PRBool aMatc
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
//PRBool foundIt = PR_FALSE;
doc->FindNext(aSearchStr, aMatchCase, aSearchDown, aIsFound);
if (!aIsFound) {
@ -675,7 +675,7 @@ NS_IMETHODIMP nsBrowserWindow::ForceRefresh()
if (nsnull != shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
nsIView* root;
vm->GetRootView(root);
if (nsnull != root) {
@ -738,7 +738,7 @@ nsEventStatus nsBrowserWindow::ProcessDialogEvent(nsGUIEvent *aEvent)
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
PRBool foundIt = PR_FALSE;
doc->FindNext(searchStr, matchCase, findDwn, foundIt);
if (!foundIt) {
@ -1103,7 +1103,7 @@ nsBrowserWindow::DoSelectAll()
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
doc->SelectAll();
ForceRefresh();
}
@ -2154,7 +2154,7 @@ nsBrowserWindow::DoCopy()
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
nsString buffer;
nsIDOMSelection* sel = nsnull;
@ -2594,7 +2594,7 @@ DumpContentRecurse(nsIWebShell* aWebShell, FILE* out)
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
nsIContent* root = doc->GetRootContent();
if (nsnull != root) {
root->List(out);
@ -2672,7 +2672,7 @@ DumpViewsRecurse(nsIWebShell* aWebShell, FILE* out)
if (nsnull != shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
nsIView* root;
vm->GetRootView(root);
if (nsnull != root) {
@ -2711,7 +2711,7 @@ nsBrowserWindow::DumpStyleSheets(FILE* out)
if (nsnull != shell) {
nsCOMPtr<nsIStyleSet> styleSet;
shell->GetStyleSet(getter_AddRefs(styleSet));
if (nsnull == styleSet) {
if (!styleSet) {
fputs("null style set\n", out);
} else {
styleSet->List(out);
@ -2730,7 +2730,7 @@ nsBrowserWindow::DumpStyleContexts(FILE* out)
if (nsnull != shell) {
nsCOMPtr<nsIStyleSet> styleSet;
shell->GetStyleSet(getter_AddRefs(styleSet));
if (nsnull == styleSet) {
if (!styleSet) {
fputs("null style set\n", out);
} else {
nsIFrame* root;
@ -2850,7 +2850,7 @@ nsBrowserWindow::DoDebugSave()
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
nsString buffer;
doc->CreateXIF(buffer);
@ -2911,7 +2911,7 @@ nsBrowserWindow::DoToggleSelection()
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
PRBool current = doc->GetDisplaySelection();
doc->SetDisplaySelection(!current);
ForceRefresh();
@ -3046,7 +3046,7 @@ nsBrowserWindow::DispatchStyleMenu(PRInt32 aID)
nsAutoString defaultStyle;
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
nsIAtom* defStyleAtom = NS_NewAtom("default-style");
doc->GetHeaderData(defStyleAtom, defaultStyle);
NS_RELEASE(defStyleAtom);
@ -3084,7 +3084,7 @@ nsBrowserWindow::DispatchStyleMenu(PRInt32 aID)
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
nsAutoString defaultStyle;
nsIAtom* defStyleAtom = NS_NewAtom("default-style");
doc->GetHeaderData(defStyleAtom, defaultStyle);

Просмотреть файл

@ -967,7 +967,7 @@ nsViewerApp::CreateRobot(nsBrowserWindow* aWindow)
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull!=doc) {
if (doc) {
const char * str;
nsresult rv = doc->GetDocumentURL()->GetSpec(&str);
if (NS_FAILED(rv)) {

Просмотреть файл

@ -263,7 +263,7 @@ nsWebCrawler:: EndLoadURL(nsIWebShell* aShell,
if (nsnull != shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
nsIView* rootView;
vm->GetRootView(rootView);
vm->UpdateView(rootView, nsnull, NS_VMREFRESH_IMMEDIATE);

Просмотреть файл

@ -271,7 +271,7 @@ void nsXPBaseWindow::ForceRefresh()
if (nsnull != shell) {
nsCOMPtr<nsIViewManager> vm;
shell->GetViewManager(getter_AddRefs(vm));
if (nsnull != vm) {
if (vm) {
nsIView* root;
vm->GetRootView(root);
if (nsnull != root) {
@ -415,7 +415,7 @@ NS_IMETHODIMP nsXPBaseWindow::EndLoadURL(nsIWebShell* aShell, const PRUnichar* a
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
mContentRoot = doc->GetRootContent();
mDocIsLoaded = PR_TRUE;
if (nsnull != mWindowListener) {
@ -515,7 +515,7 @@ NS_IMETHODIMP nsXPBaseWindow::GetDocument(nsIDOMHTMLDocument *& aDocument)
if (nsnull != shell) {
nsCOMPtr<nsIDocument> doc;
shell->GetDocument(getter_AddRefs(doc));
if (nsnull != doc) {
if (doc) {
doc->QueryInterface(kIDOMHTMLDocumentIID,(void **)&htmlDoc);
}
NS_RELEASE(shell);