When creating the root view's widget, don't show it. This prevents full-page Invalidates during page load caused by showing and then hiding the widget. Bug 97895, r=blizzard, sr=hyatt.

This commit is contained in:
bryner%netscape.com 2001-10-31 05:06:31 +00:00
Родитель 1482877627
Коммит c3d6f78b18
12 изменённых файлов: 37 добавлений и 43 удалений

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

@ -1391,7 +1391,6 @@ DocumentViewerImpl::SetPreviousViewer(nsIContentViewer* aViewer)
// link from the chain. This ensures that at most only 2 documents are alive // link from the chain. This ensures that at most only 2 documents are alive
// and undestroyed at any given time (the one that is showing and the one that // and undestroyed at any given time (the one that is showing and the one that
// is loading with painting suppressed). // is loading with painting suppressed).
aViewer->Validate();
nsCOMPtr<nsIContentViewer> prevViewer; nsCOMPtr<nsIContentViewer> prevViewer;
aViewer->GetPreviousViewer(getter_AddRefs(prevViewer)); aViewer->GetPreviousViewer(getter_AddRefs(prevViewer));
if (prevViewer) { if (prevViewer) {
@ -1463,15 +1462,6 @@ DocumentViewerImpl::Hide(void)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
DocumentViewerImpl::Validate(void)
{
NS_PRECONDITION(mWindow, "null window");
if (mWindow)
mWindow->Validate();
return NS_OK;
}
nsresult nsresult
DocumentViewerImpl::FindFrameSetWithIID(nsIContent * aParentContent, const nsIID& aIID) DocumentViewerImpl::FindFrameSetWithIID(nsIContent * aParentContent, const nsIID& aIID)
{ {
@ -3827,7 +3817,9 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return rv; return rv;
rv = mView->CreateWidget(kWidgetCID, nsnull, aParentWidget->GetNativeData(NS_NATIVE_WIDGET)); rv = mView->CreateWidget(kWidgetCID, nsnull,
aParentWidget->GetNativeData(NS_NATIVE_WIDGET),
PR_TRUE, PR_FALSE);
if (rv != NS_OK) if (rv != NS_OK)
return rv; return rv;

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

@ -55,7 +55,6 @@ interface nsIContentViewer : nsISupports
void show(); void show();
void hide(); void hide();
void validate();
attribute boolean enableRendering; attribute boolean enableRendering;
}; };

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

@ -1391,7 +1391,6 @@ DocumentViewerImpl::SetPreviousViewer(nsIContentViewer* aViewer)
// link from the chain. This ensures that at most only 2 documents are alive // link from the chain. This ensures that at most only 2 documents are alive
// and undestroyed at any given time (the one that is showing and the one that // and undestroyed at any given time (the one that is showing and the one that
// is loading with painting suppressed). // is loading with painting suppressed).
aViewer->Validate();
nsCOMPtr<nsIContentViewer> prevViewer; nsCOMPtr<nsIContentViewer> prevViewer;
aViewer->GetPreviousViewer(getter_AddRefs(prevViewer)); aViewer->GetPreviousViewer(getter_AddRefs(prevViewer));
if (prevViewer) { if (prevViewer) {
@ -1463,15 +1462,6 @@ DocumentViewerImpl::Hide(void)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
DocumentViewerImpl::Validate(void)
{
NS_PRECONDITION(mWindow, "null window");
if (mWindow)
mWindow->Validate();
return NS_OK;
}
nsresult nsresult
DocumentViewerImpl::FindFrameSetWithIID(nsIContent * aParentContent, const nsIID& aIID) DocumentViewerImpl::FindFrameSetWithIID(nsIContent * aParentContent, const nsIID& aIID)
{ {
@ -3827,7 +3817,9 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return rv; return rv;
rv = mView->CreateWidget(kWidgetCID, nsnull, aParentWidget->GetNativeData(NS_NATIVE_WIDGET)); rv = mView->CreateWidget(kWidgetCID, nsnull,
aParentWidget->GetNativeData(NS_NATIVE_WIDGET),
PR_TRUE, PR_FALSE);
if (rv != NS_OK) if (rv != NS_OK)
return rv; return rv;

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

@ -577,14 +577,6 @@ PluginViewerImpl::SetPreviousViewer(nsIContentViewer* aViewer)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
PluginViewerImpl::Validate()
{
if (mWindow)
mWindow->Validate();
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
PluginViewerImpl::SetBounds(const nsRect& aBounds) PluginViewerImpl::SetBounds(const nsRect& aBounds)
{ {

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

@ -434,7 +434,8 @@ public:
NS_IMETHOD CreateWidget(const nsIID &aWindowIID, NS_IMETHOD CreateWidget(const nsIID &aWindowIID,
nsWidgetInitData *aWidgetInitData = nsnull, nsWidgetInitData *aWidgetInitData = nsnull,
nsNativeWidget aNative = nsnull, nsNativeWidget aNative = nsnull,
PRBool aEnableDragDrop = PR_TRUE) = 0; PRBool aEnableDragDrop = PR_TRUE,
PRBool aResetVisibility = PR_TRUE) = 0;
/** /**
* Set the widget associated with this view. * Set the widget associated with this view.

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

@ -942,7 +942,8 @@ NS_IMETHODIMP nsView :: GetClientData(void *&aData) const
NS_IMETHODIMP nsView :: CreateWidget(const nsIID &aWindowIID, NS_IMETHODIMP nsView :: CreateWidget(const nsIID &aWindowIID,
nsWidgetInitData *aWidgetInitData, nsWidgetInitData *aWidgetInitData,
nsNativeWidget aNative, nsNativeWidget aNative,
PRBool aEnableDragDrop) PRBool aEnableDragDrop,
PRBool aResetVisibility)
{ {
nsIDeviceContext *dx; nsIDeviceContext *dx;
nsRect trect = mBounds; nsRect trect = mBounds;
@ -983,10 +984,12 @@ NS_IMETHODIMP nsView :: CreateWidget(const nsIID &aWindowIID,
//make sure visibility state is accurate //make sure visibility state is accurate
nsViewVisibility vis; if (aResetVisibility) {
nsViewVisibility vis;
GetVisibility(vis);
SetVisibility(vis); GetVisibility(vis);
SetVisibility(vis);
}
NS_RELEASE(dx); NS_RELEASE(dx);

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

@ -115,7 +115,8 @@ public:
NS_IMETHOD CreateWidget(const nsIID &aWindowIID, NS_IMETHOD CreateWidget(const nsIID &aWindowIID,
nsWidgetInitData *aWidgetInitData = nsnull, nsWidgetInitData *aWidgetInitData = nsnull,
nsNativeWidget aNative = nsnull, nsNativeWidget aNative = nsnull,
PRBool aEnableDragDrop = PR_TRUE); PRBool aEnableDragDrop = PR_TRUE,
PRBool aResetVisibility = PR_TRUE);
NS_IMETHOD SetWidget(nsIWidget *aWidget); NS_IMETHOD SetWidget(nsIWidget *aWidget);
NS_IMETHOD GetWidget(nsIWidget *&aWidget) const; NS_IMETHOD GetWidget(nsIWidget *&aWidget) const;
NS_IMETHOD HasWidget(PRBool *aHasWidget) const; NS_IMETHOD HasWidget(PRBool *aHasWidget) const;

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

@ -405,7 +405,8 @@ public:
NS_IMETHOD CreateWidget(const nsIID &aWindowIID, NS_IMETHOD CreateWidget(const nsIID &aWindowIID,
nsWidgetInitData *aWidgetInitData = nsnull, nsWidgetInitData *aWidgetInitData = nsnull,
nsNativeWidget aNative = nsnull, nsNativeWidget aNative = nsnull,
PRBool aEnableDragDrop = PR_TRUE) PRBool aEnableDragDrop = PR_TRUE,
PRBool aResetVisibility = PR_TRUE)
{ NS_ASSERTION(PR_FALSE, "Unimplemented"); return NS_ERROR_NOT_IMPLEMENTED; } { NS_ASSERTION(PR_FALSE, "Unimplemented"); return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD SetWidget(nsIWidget *aWidget) NS_IMETHOD SetWidget(nsIWidget *aWidget)
{ return NS_OK; } { return NS_OK; }

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

@ -870,6 +870,12 @@ NS_IMETHODIMP nsWidget::SetCursor(nsCursor aCursor)
#define CAPS_LOCK_IS_ON \ #define CAPS_LOCK_IS_ON \
(nsWidget::sDebugFeedback && (nsGtkUtils::gdk_keyboard_get_modifiers() & GDK_LOCK_MASK)) (nsWidget::sDebugFeedback && (nsGtkUtils::gdk_keyboard_get_modifiers() & GDK_LOCK_MASK))
NS_IMETHODIMP nsWidget::Validate()
{
mUpdateArea->SetTo(0, 0, 0, 0);
return NS_OK;
}
NS_IMETHODIMP nsWidget::Invalidate(PRBool aIsSynchronous) NS_IMETHODIMP nsWidget::Invalidate(PRBool aIsSynchronous)
{ {
if (!mWidget) if (!mWidget)

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

@ -162,6 +162,7 @@ public:
NS_IMETHOD CaptureMouse(PRBool aCapture) { return NS_ERROR_FAILURE; } NS_IMETHOD CaptureMouse(PRBool aCapture) { return NS_ERROR_FAILURE; }
NS_IMETHOD Validate();
NS_IMETHOD Invalidate(PRBool aIsSynchronous); NS_IMETHOD Invalidate(PRBool aIsSynchronous);
NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous); NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous);
NS_IMETHOD InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSynchronous); NS_IMETHOD InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSynchronous);

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

@ -182,8 +182,6 @@ nsWindow::nsWindow()
{ {
mShell = nsnull; mShell = nsnull;
mResized = PR_FALSE; mResized = PR_FALSE;
mVisible = PR_FALSE;
mDisplayed = PR_FALSE;
mLowerLeft = PR_FALSE; mLowerLeft = PR_FALSE;
mWindowType = eWindowType_child; mWindowType = eWindowType_child;
mBorderStyle = eBorderStyle_default; mBorderStyle = eBorderStyle_default;
@ -965,6 +963,15 @@ void nsWindow::NativeGrab(PRBool aGrab)
} }
} }
NS_IMETHODIMP nsWindow::Validate()
{
if (mIsUpdating) {
mUpdateArea->SetTo(0, 0, 0, 0);
UnqueueDraw();
}
return NS_OK;
}
NS_IMETHODIMP nsWindow::Invalidate(PRBool aIsSynchronous) NS_IMETHODIMP nsWindow::Invalidate(PRBool aIsSynchronous)
{ {

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

@ -101,6 +101,7 @@ public:
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener,
PRBool aDoCapture, PRBool aDoCapture,
PRBool aConsumeRollupEvent); PRBool aConsumeRollupEvent);
NS_IMETHOD Validate();
NS_IMETHOD Invalidate(PRBool aIsSynchronous); NS_IMETHOD Invalidate(PRBool aIsSynchronous);
NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous); NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous);
NS_IMETHOD InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSynchronous); NS_IMETHOD InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSynchronous);
@ -209,8 +210,6 @@ protected:
virtual void InitCallbacks(char * aName = nsnull); virtual void InitCallbacks(char * aName = nsnull);
NS_IMETHOD CreateNative(GtkObject *parentWidget); NS_IMETHOD CreateNative(GtkObject *parentWidget);
PRBool mVisible;
PRBool mDisplayed;
PRBool mIsTooSmall; PRBool mIsTooSmall;
// Resize event management // Resize event management