Back out patch for bug 332640 to fix regression bug 333051. r+sr-bzbarsky

This commit is contained in:
bryner%brianryner.com 2006-04-08 01:46:06 +00:00
Родитель f44b17e6c0
Коммит 45f17dde36
1 изменённых файлов: 13 добавлений и 15 удалений

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

@ -42,10 +42,10 @@
#include "nsIScriptGlobalObject.h"
#include "nsIDocShell.h"
#include "nsIDeviceContext.h"
#include "nsPresContext.h"
#include "nsCOMPtr.h"
#include "nsIDocumentViewer.h"
#include "nsDOMClassInfo.h"
#include "nsIBaseWindow.h"
#include "nsIWidget.h"
//
@ -201,23 +201,21 @@ nsScreen::GetDeviceContext()
if(!mDocShell)
return nsnull;
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mDocShell);
if (!baseWindow)
nsCOMPtr<nsIContentViewer> contentViewer;
mDocShell->GetContentViewer(getter_AddRefs(contentViewer));
nsCOMPtr<nsIDocumentViewer> docViewer(do_QueryInterface(contentViewer));
if(!docViewer)
return nsnull;
nsCOMPtr<nsIWidget> widget;
baseWindow->GetMainWidget(getter_AddRefs(widget));
if (!widget)
return nsnull;
nsCOMPtr<nsPresContext> presContext;
docViewer->GetPresContext(getter_AddRefs(presContext));
// nsIWidget::GetDeviceContext addrefs, this method doesn't.
// Release before returning the pointer.
nsIDeviceContext *dc = widget->GetDeviceContext();
if (!dc)
return nsnull;
nsIDeviceContext* context = nsnull;
if(presContext)
context = presContext->DeviceContext();
dc->Release();
return dc;
return context;
}
nsresult