зеркало из https://github.com/mozilla/pjs.git
Fix bug #72230. Make sure to redraw the background of the window before any document is loaded in embedding. r=valeski,sr=waterson
This commit is contained in:
Родитель
e8b9e9c8a3
Коммит
b00b9e7d43
|
@ -58,6 +58,7 @@ static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID);
|
|||
static NS_DEFINE_CID(kWebShellCID, NS_WEB_SHELL_CID);
|
||||
static NS_DEFINE_IID(kChildCID, NS_CHILD_CID);
|
||||
static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
|
||||
static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID);
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsWebBrowser: Object Management
|
||||
|
@ -66,7 +67,8 @@ static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
|
|||
nsWebBrowser::nsWebBrowser() : mDocShellTreeOwner(nsnull),
|
||||
mInitInfo(nsnull), mContentType(typeContentWrapper),
|
||||
mParentNativeWindow(nsnull), mParentWidget(nsnull), mParent(nsnull),
|
||||
mProgressListener(nsnull), mListenerArray(nsnull), mFindImpl(nsnull)
|
||||
mProgressListener(nsnull), mListenerArray(nsnull), mFindImpl(nsnull),
|
||||
mBackgroundColor(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mInitInfo = new nsWebBrowserInitInfo();
|
||||
|
@ -891,6 +893,22 @@ NS_IMETHODIMP nsWebBrowser::Create()
|
|||
deviceContext, nsnull, nsnull, &widgetInit);
|
||||
}
|
||||
|
||||
// create a rendering context and device context for this widget
|
||||
mDC = do_CreateInstance(kDeviceContextCID);
|
||||
mDC->Init(mInternalWidget->GetNativeData(NS_NATIVE_WINDOW));
|
||||
|
||||
mRC = do_CreateInstance(kRenderingContextCID);
|
||||
mRC->Init(mDC, mInternalWidget);
|
||||
|
||||
// get the default background color for painting later
|
||||
SystemAttrStruct info;
|
||||
info.mColor = &mBackgroundColor;
|
||||
mDC->GetSystemAttribute(eSystemAttr_Color_WindowBackground, &info);
|
||||
|
||||
// set the foreground color of our rendering context so we don't
|
||||
// have to do it later.
|
||||
mRC->SetColor(mBackgroundColor);
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell(do_CreateInstance(kWebShellCID));
|
||||
NS_ENSURE_SUCCESS(SetDocShell(docShell), NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -1413,6 +1431,12 @@ NS_IMETHODIMP nsWebBrowser::EnsureFindImpl()
|
|||
return mFindImpl->Init();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::FillBackground(const nsRect &aRect)
|
||||
{
|
||||
mRC->FillRect(aRect);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsEventStatus PR_CALLBACK nsWebBrowser::HandleEvent(nsGUIEvent *aEvent)
|
||||
{
|
||||
|
@ -1474,6 +1498,12 @@ nsEventStatus PR_CALLBACK nsWebBrowser::HandleEvent(nsGUIEvent *aEvent)
|
|||
break;
|
||||
}
|
||||
|
||||
case NS_PAINT: {
|
||||
nsRect *rect = NS_STATIC_CAST(nsPaintEvent *, aEvent)->rect;
|
||||
browser->FillBackground(*rect);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,10 @@
|
|||
#include "nsIWebBrowserFind.h"
|
||||
#include "nsIWebBrowserPrint.h"
|
||||
|
||||
// for painting the background window
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIRenderingContext.h"
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsWeakPtr.h"
|
||||
|
||||
|
@ -122,6 +126,8 @@ protected:
|
|||
NS_IMETHOD UnBindListener(nsISupports *aListener, const nsIID& aIID);
|
||||
NS_IMETHOD EnsureFindImpl();
|
||||
|
||||
NS_IMETHOD FillBackground(const nsRect &aRect);
|
||||
|
||||
static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
|
||||
|
||||
protected:
|
||||
|
@ -141,6 +147,11 @@ protected:
|
|||
nsCOMPtr<nsIWebProgress> mWebProgress;
|
||||
nsWebBrowserFindImpl* mFindImpl;
|
||||
|
||||
// so that we can draw when we get expose events
|
||||
nsCOMPtr<nsIRenderingContext> mRC;
|
||||
nsCOMPtr<nsIDeviceContext> mDC;
|
||||
nscolor mBackgroundColor;
|
||||
|
||||
//Weak Reference interfaces...
|
||||
nsIWidget* mParentWidget;
|
||||
nsIDocShellTreeItem* mParent;
|
||||
|
|
Загрузка…
Ссылка в новой задаче