From 65a34766761ba7fdd2e916c036e31a15dce14eb5 Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Sun, 14 Nov 1999 02:51:25 +0000 Subject: [PATCH] pork jockey paint fixes. bug=18140, r=kmcclusk,pavlov --- content/base/src/nsDocumentViewer.cpp | 2 +- docshell/base/nsWebShell.cpp | 2 +- editor/base/nsEditor.cpp | 2 +- editor/base/nsEditorEventListeners.cpp | 4 +- editor/libeditor/base/nsEditor.cpp | 2 +- .../libeditor/text/nsEditorEventListeners.cpp | 4 +- layout/base/nsCSSFrameConstructor.cpp | 2 +- layout/base/nsDocumentViewer.cpp | 2 +- layout/base/nsPresShell.cpp | 2 +- layout/base/src/nsDocumentViewer.cpp | 2 +- layout/html/base/src/nsPresShell.cpp | 2 +- .../html/forms/src/nsGfxTextControlFrame.cpp | 4 +- .../html/style/src/nsCSSFrameConstructor.cpp | 2 +- view/public/nsIView.h | 17 +- view/public/nsIViewManager.h | 10 +- view/src/nsScrollPortView.cpp | 4 +- view/src/nsScrollingView.cpp | 6 +- view/src/nsView.cpp | 50 +- view/src/nsView.h | 14 +- view/src/nsViewManager.cpp | 485 ++++++------------ view/src/nsViewManager.h | 83 +-- webshell/src/nsWebShell.cpp | 2 +- webshell/tests/viewer/nsBrowserWindow.cpp | 2 +- webshell/tests/viewer/nsWebCrawler.cpp | 2 +- webshell/tests/viewer/nsXPBaseWindow.cpp | 3 +- 25 files changed, 283 insertions(+), 427 deletions(-) diff --git a/content/base/src/nsDocumentViewer.cpp b/content/base/src/nsDocumentViewer.cpp index 8d3ccfa45b066..2adf5a8dc0229 100644 --- a/content/base/src/nsDocumentViewer.cpp +++ b/content/base/src/nsDocumentViewer.cpp @@ -833,7 +833,7 @@ DocumentViewerImpl::SetEnableRendering(PRBool aOn) nsIView* view; mViewManager->GetRootView(view); // views are not refCounted if (view) { - mViewManager->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE); + mViewManager->UpdateView(view, NS_VMREFRESH_IMMEDIATE); } } else { diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index 3183e9fc50f72..d9b9f83ade1ba 100644 --- a/docshell/base/nsWebShell.cpp +++ b/docshell/base/nsWebShell.cpp @@ -1778,7 +1778,7 @@ nsWebShell::SetZoom(float aZoom) sv->ComputeScrollOffsets(); vm->GetRootView(rootview); if (nsnull != rootview) - vm->UpdateView(rootview, nsnull, 0); + vm->UpdateView(rootview, 0); NS_RELEASE(vm); } NS_RELEASE(shell); diff --git a/editor/base/nsEditor.cpp b/editor/base/nsEditor.cpp index a94cec1a4acc5..9b307ac07ee0b 100644 --- a/editor/base/nsEditor.cpp +++ b/editor/base/nsEditor.cpp @@ -3166,7 +3166,7 @@ void nsEditor::HACKForceRedraw() nsIView* view; viewmgr->GetRootView(view); // views are not refCounted if (view) { - viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE); + viewmgr->UpdateView(view,NS_VMREFRESH_IMMEDIATE); } } } diff --git a/editor/base/nsEditorEventListeners.cpp b/editor/base/nsEditorEventListeners.cpp index 3fa7ce17223c4..8cfa93354f48e 100644 --- a/editor/base/nsEditorEventListeners.cpp +++ b/editor/base/nsEditorEventListeners.cpp @@ -1211,7 +1211,7 @@ nsTextEditorFocusListener::Focus(nsIDOMEvent* aEvent) nsIView* view; viewmgr->GetRootView(view); // views are not refCounted if (view) { - viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE); + viewmgr->UpdateView(view,NS_VMREFRESH_IMMEDIATE); } } // end hack repaint @@ -1259,7 +1259,7 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent) nsIView* view; viewmgr->GetRootView(view); // views are not refCounted if (view) { - viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE); + viewmgr->UpdateView(view,NS_VMREFRESH_IMMEDIATE); } } // end hack repaint diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index a94cec1a4acc5..9b307ac07ee0b 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -3166,7 +3166,7 @@ void nsEditor::HACKForceRedraw() nsIView* view; viewmgr->GetRootView(view); // views are not refCounted if (view) { - viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE); + viewmgr->UpdateView(view,NS_VMREFRESH_IMMEDIATE); } } } diff --git a/editor/libeditor/text/nsEditorEventListeners.cpp b/editor/libeditor/text/nsEditorEventListeners.cpp index 3fa7ce17223c4..8cfa93354f48e 100644 --- a/editor/libeditor/text/nsEditorEventListeners.cpp +++ b/editor/libeditor/text/nsEditorEventListeners.cpp @@ -1211,7 +1211,7 @@ nsTextEditorFocusListener::Focus(nsIDOMEvent* aEvent) nsIView* view; viewmgr->GetRootView(view); // views are not refCounted if (view) { - viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE); + viewmgr->UpdateView(view,NS_VMREFRESH_IMMEDIATE); } } // end hack repaint @@ -1259,7 +1259,7 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent) nsIView* view; viewmgr->GetRootView(view); // views are not refCounted if (view) { - viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE); + viewmgr->UpdateView(view,NS_VMREFRESH_IMMEDIATE); } } // end hack repaint diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index fcabbfd3c1997..415d53bdb136c 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -6500,7 +6500,7 @@ SyncAndInvalidateView(nsIView* aView, nsIFrame* aFrame, if (viewIsVisible) { aViewManager->SetViewContentTransparency(aView, viewHasTransparentContent); aViewManager->SetViewVisibility(aView, nsViewVisibility_kShow); - aViewManager->UpdateView(aView, nsnull, NS_VMREFRESH_NO_SYNC); + aViewManager->UpdateView(aView, NS_VMREFRESH_NO_SYNC); } else { aViewManager->SetViewVisibility(aView, nsViewVisibility_kHide); diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 8d3ccfa45b066..2adf5a8dc0229 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -833,7 +833,7 @@ DocumentViewerImpl::SetEnableRendering(PRBool aOn) nsIView* view; mViewManager->GetRootView(view); // views are not refCounted if (view) { - mViewManager->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE); + mViewManager->UpdateView(view, NS_VMREFRESH_IMMEDIATE); } } else { diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index a6d7f5d1cd652..947a0559e8946 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -1631,7 +1631,7 @@ PresShell::ProcessReflowCommands() // see it. nsIView* rootView; mViewManager->GetRootView(rootView); - mViewManager->UpdateView(rootView, nsnull, NS_VMREFRESH_IMMEDIATE); + mViewManager->UpdateView(rootView, NS_VMREFRESH_IMMEDIATE); mInVerifyReflow = PR_TRUE; PRBool ok = VerifyIncrementalReflow(); diff --git a/layout/base/src/nsDocumentViewer.cpp b/layout/base/src/nsDocumentViewer.cpp index 8d3ccfa45b066..2adf5a8dc0229 100644 --- a/layout/base/src/nsDocumentViewer.cpp +++ b/layout/base/src/nsDocumentViewer.cpp @@ -833,7 +833,7 @@ DocumentViewerImpl::SetEnableRendering(PRBool aOn) nsIView* view; mViewManager->GetRootView(view); // views are not refCounted if (view) { - mViewManager->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE); + mViewManager->UpdateView(view, NS_VMREFRESH_IMMEDIATE); } } else { diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index a6d7f5d1cd652..947a0559e8946 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -1631,7 +1631,7 @@ PresShell::ProcessReflowCommands() // see it. nsIView* rootView; mViewManager->GetRootView(rootView); - mViewManager->UpdateView(rootView, nsnull, NS_VMREFRESH_IMMEDIATE); + mViewManager->UpdateView(rootView, NS_VMREFRESH_IMMEDIATE); mInVerifyReflow = PR_TRUE; PRBool ok = VerifyIncrementalReflow(); diff --git a/layout/html/forms/src/nsGfxTextControlFrame.cpp b/layout/html/forms/src/nsGfxTextControlFrame.cpp index 2d9166ca4068c..5e46628118939 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -1635,8 +1635,8 @@ nsGfxTextControlFrame::Reflow(nsIPresContext& aPresContext, { // single line text controls get a display frame rather than a subdoc. // the subdoc will be created when the frame first gets focus // create anonymous text content - nsIContent* content; - rv = NS_NewTextNode(&content); + nsCOMPtr content; + rv = NS_NewTextNode(getter_AddRefs(content)); if (NS_FAILED(rv)) { return rv; } if (!content) { return NS_ERROR_NULL_POINTER; } nsIDocument* doc; diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index fcabbfd3c1997..415d53bdb136c 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -6500,7 +6500,7 @@ SyncAndInvalidateView(nsIView* aView, nsIFrame* aFrame, if (viewIsVisible) { aViewManager->SetViewContentTransparency(aView, viewHasTransparentContent); aViewManager->SetViewVisibility(aView, nsViewVisibility_kShow); - aViewManager->UpdateView(aView, nsnull, NS_VMREFRESH_NO_SYNC); + aViewManager->UpdateView(aView, NS_VMREFRESH_NO_SYNC); } else { aViewManager->SetViewVisibility(aView, nsViewVisibility_kHide); diff --git a/view/public/nsIView.h b/view/public/nsIView.h index 52fe504e5958e..02e569d05518c 100644 --- a/view/public/nsIView.h +++ b/view/public/nsIView.h @@ -390,12 +390,6 @@ class nsIView : public nsISupports */ NS_IMETHOD GetDirtyRegion(nsIRegion *&aRegion) const = 0; - /** - * Sets the dirty region associated with this view. Used by the view - * manager. - */ - NS_IMETHOD SetDirtyRegion(nsIRegion *aRegion) = 0; - /** * Create a widget to associate with this view. This is a helper * function for SetWidget. @@ -430,16 +424,23 @@ class nsIView : public nsISupports * If we believe that all cutout view have a native widget, this * could be a replacement. * @param aWidget out parameter for widget that this view contains, - * or nsnull if there is none. + * or nsnull if there is none. */ NS_IMETHOD GetWidget(nsIWidget *&aWidget) const = 0; + + /** + * Returns PR_TRUE if the view has a widget associated with it. + * @param aHasWidget out parameter that indicates whether a view has a widget. + */ + NS_IMETHOD HasWidget(PRBool *aHasWidget) const = 0; + /** * Output debug info to FILE * @param out output file handle * @param aIndent indentation depth */ - virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0; + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0; /** * Set flags on view to allow customization of view behavior during diff --git a/view/public/nsIViewManager.h b/view/public/nsIViewManager.h index bfbeacc2b7cf3..d058a9095ab6e 100644 --- a/view/public/nsIViewManager.h +++ b/view/public/nsIViewManager.h @@ -118,16 +118,12 @@ class nsIViewManager : public nsISupports NS_IMETHOD Composite(void) = 0; /** - * Called to inform the view manager that some portion of a view - * is dirty and needs to be redrawn. The region passed in - * should be in the view's coordinate space. + * Called to inform the view manager that the entire area of a view + * is dirty and needs to be redrawn. * @param aView view to paint. should be root view - * @param region region to mark as damaged, if nsnull, then entire - * view is marked as damaged * @param aUpdateFlags see bottom of nsIViewManager.h for description */ - NS_IMETHOD UpdateView(nsIView *aView, nsIRegion *aRegion, - PRUint32 aUpdateFlags) = 0; + NS_IMETHOD UpdateView(nsIView *aView, PRUint32 aUpdateFlags) = 0; /** * Called to inform the view manager that some portion of a view diff --git a/view/src/nsScrollPortView.cpp b/view/src/nsScrollPortView.cpp index 9c9758084e4c5..ae23e5fc0c251 100644 --- a/view/src/nsScrollPortView.cpp +++ b/view/src/nsScrollPortView.cpp @@ -1570,11 +1570,11 @@ void nsScrollPortView::Scroll(nsIView *aScrolledView, PRInt32 aDx, PRInt32 aDy, if (nsnull == scrollWidget) { // if we don't have a scroll widget then we must just update. - mViewManager->UpdateView(this, nsnull, 0); + mViewManager->UpdateView(this, 0); } else if (CannotBitBlt(aScrolledView)) { // we can't blit for some reason just update the view and adjust any heavy weight widgets - mViewManager->UpdateView(this, nsnull, 0); + mViewManager->UpdateView(this, 0); AdjustChildWidgets(this, aScrolledView, 0, 0, scale); } else { // if we can blit and have a scrollwidget then scroll. // Scroll the contents of the widget by the specfied amount, and scroll diff --git a/view/src/nsScrollingView.cpp b/view/src/nsScrollingView.cpp index 9ea3d9f7a4081..3b1c8575fa6f2 100644 --- a/view/src/nsScrollingView.cpp +++ b/view/src/nsScrollingView.cpp @@ -168,7 +168,7 @@ NS_IMETHODIMP CornerView::ShowQuality(PRBool aShow) } } - mViewManager->UpdateView(this, nsnull, NS_VMREFRESH_IMMEDIATE); + mViewManager->UpdateView(this, NS_VMREFRESH_IMMEDIATE); } return NS_OK; } @@ -180,7 +180,7 @@ NS_IMETHODIMP CornerView::SetQuality(nsContentQuality aQuality) mQuality = aQuality; if (mVis == nsViewVisibility_kShow) - mViewManager->UpdateView(this, nsnull, NS_VMREFRESH_IMMEDIATE); + mViewManager->UpdateView(this, NS_VMREFRESH_IMMEDIATE); } return NS_OK; } @@ -1643,7 +1643,7 @@ void nsScrollingView::Scroll(nsIView *aScrolledView, PRInt32 aDx, PRInt32 aDy, f // XXX Repainting is really slow. The widget's Scroll() member function // needs an argument that specifies whether child widgets are scrolled, // and we need to be able to specify the rect to be scrolled... - mViewManager->UpdateView(mClipView, nsnull, 0); + mViewManager->UpdateView(mClipView, 0); AdjustChildWidgets(this, aScrolledView, 0, 0, scale); } else diff --git a/view/src/nsView.cpp b/view/src/nsView.cpp index b12a595af3908..e493cad05d740 100644 --- a/view/src/nsView.cpp +++ b/view/src/nsView.cpp @@ -40,6 +40,8 @@ #include "nsIRegion.h" #include "nsIClipView.h" +static NS_DEFINE_IID(kRegionCID, NS_REGION_CID); + //mmptemp static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent); @@ -1305,18 +1307,20 @@ NS_IMETHODIMP nsView :: GetWidget(nsIWidget *&aWidget) const return NS_OK; } +NS_IMETHODIMP nsView::HasWidget(PRBool *aHasWidget) const +{ + *aHasWidget = (mWindow != nsnull); + return NS_OK; +} + // // internal window creation functions // nsresult nsView :: LoadWidget(const nsCID &aClassIID) { - nsresult rv; + nsresult rv = nsComponentManager::CreateInstance(aClassIID, nsnull, NS_GET_IID(nsIWidget), (void**)&mWindow); - static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID); - rv = nsComponentManager::CreateInstance(aClassIID, nsnull, kIWidgetIID, (void**)&mWindow); - - if (NS_OK == rv) - { + if (NS_OK == rv) { // Set the widget's client data mWindow->SetClientData((void*)this); } @@ -1324,7 +1328,7 @@ nsresult nsView :: LoadWidget(const nsCID &aClassIID) return rv; } -void nsView :: List(FILE* out, PRInt32 aIndent) const +NS_IMETHODIMP nsView::List(FILE* out, PRInt32 aIndent) const { PRInt32 i; for (i = aIndent; --i >= 0; ) fputs(" ", out); @@ -1362,6 +1366,8 @@ void nsView :: List(FILE* out, PRInt32 aIndent) const } for (i = aIndent; --i >= 0; ) fputs(" ", out); fputs(">\n", out); + + return NS_OK; } NS_IMETHODIMP nsView :: SetViewFlags(PRUint32 aFlags) @@ -1412,19 +1418,27 @@ NS_IMETHODIMP nsView :: GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidge return NS_OK; } -NS_IMETHODIMP nsView :: GetDirtyRegion(nsIRegion *&aRegion) const +NS_IMETHODIMP nsView::GetDirtyRegion(nsIRegion *&aRegion) const { - aRegion = mDirtyRegion; - NS_IF_ADDREF(aRegion); - return NS_OK; -} + if (nsnull == mDirtyRegion) { + // The view doesn't have a dirty region so create one + nsresult rv = nsComponentManager::CreateInstance(kRegionCID, + nsnull, + NS_GET_IID(nsIRegion), + (void**) &mDirtyRegion); + + if (NS_FAILED(rv)) + return rv; + + rv = mDirtyRegion->Init(); + if (NS_FAILED(rv)) + return rv; + } -NS_IMETHODIMP nsView :: SetDirtyRegion(nsIRegion *aRegion) -{ - NS_IF_RELEASE(mDirtyRegion); - mDirtyRegion = aRegion; - NS_IF_ADDREF(mDirtyRegion); - return NS_OK; + aRegion = mDirtyRegion; + NS_ADDREF(aRegion); + + return NS_OK; } NS_IMETHODIMP nsView :: GetScratchPoint(nsPoint **aPoint) diff --git a/view/src/nsView.h b/view/src/nsView.h index 004808804c852..7597462befdf5 100644 --- a/view/src/nsView.h +++ b/view/src/nsView.h @@ -92,19 +92,19 @@ class nsView : public nsIView NS_IMETHOD GetClientData(void *&aData) const; NS_IMETHOD GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget); NS_IMETHOD GetDirtyRegion(nsIRegion*& aRegion) const; - NS_IMETHOD SetDirtyRegion(nsIRegion* aRegion); NS_IMETHOD CreateWidget(const nsIID &aWindowIID, nsWidgetInitData *aWidgetInitData = nsnull, nsNativeWidget aNative = nsnull, PRBool aEnableDragDrop = PR_TRUE); NS_IMETHOD SetWidget(nsIWidget *aWidget); NS_IMETHOD GetWidget(nsIWidget *&aWidget) const; - virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; - NS_IMETHOD SetViewFlags(PRUint32 aFlags); - NS_IMETHOD ClearViewFlags(PRUint32 aFlags); - NS_IMETHOD GetViewFlags(PRUint32 *aFlags) const; - NS_IMETHOD GetScratchPoint(nsPoint **aPoint); - NS_IMETHOD GetExtents(nsRect *aExtents); + NS_IMETHOD HasWidget(PRBool *aHasWidget) const; + NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + NS_IMETHOD SetViewFlags(PRUint32 aFlags); + NS_IMETHOD ClearViewFlags(PRUint32 aFlags); + NS_IMETHOD GetViewFlags(PRUint32 *aFlags) const; + NS_IMETHOD GetScratchPoint(nsPoint **aPoint); + NS_IMETHOD GetExtents(nsRect *aExtents); // Helper function to get the view that's associated with a widget static nsIView* GetViewFor(nsIWidget* aWidget); diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index 50dfb71bccd3e..8008f8d29173d 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -1325,35 +1325,26 @@ void nsViewManager :: RenderView(nsIView *aView, nsIRenderingContext &aRC, const aRC.PopState(aResult); } -void nsViewManager :: UpdateDirtyViews(nsIView *aView, nsRect *aParentRect) const +void nsViewManager::UpdateDirtyViews(nsIView *aView, nsRect *aParentRect) const { - nsRect pardamage; - nsRect bounds; - + nsRect bounds; aView->GetBounds(bounds); - //translate parent rect into child coords. - - if (nsnull != aParentRect) - { - pardamage = *aParentRect; + // translate parent rect into child coords. + nsRect parDamage; + if (nsnull != aParentRect) { + parDamage = *aParentRect; + parDamage.IntersectRect(bounds, parDamage); + parDamage.MoveBy(-bounds.x, -bounds.y); + } else + parDamage = bounds; - pardamage.IntersectRect(bounds, pardamage); - pardamage.MoveBy(-bounds.x, -bounds.y); - } - else - pardamage = bounds; - - if (PR_FALSE == pardamage.IsEmpty()) - { + if (PR_FALSE == parDamage.IsEmpty()) { nsIWidget *widget; - aView->GetWidget(widget); - - if (nsnull != widget) - { + if (nsnull != widget) { float scale; - nsRect pixrect = pardamage; + nsRect pixrect = parDamage; mContext->GetAppUnitsToDevUnits(scale); pixrect.ScaleRoundOut(scale); @@ -1370,20 +1361,27 @@ void nsViewManager :: UpdateDirtyViews(nsIView *aView, nsRect *aParentRect) cons aView->GetChild(0, child); - while (nsnull != child) - { - UpdateDirtyViews(child, &pardamage); + while (nsnull != child) { + UpdateDirtyViews(child, &parDamage); child->GetNextSibling(child); } } void nsViewManager::ProcessPendingUpdates(nsIView* aView) { - nsCOMPtr dirtyRegion; - aView->GetDirtyRegion(*getter_AddRefs(dirtyRegion)); - if (dirtyRegion != nsnull && !dirtyRegion->IsEmpty()) { - UpdateView(aView, dirtyRegion, 0); - dirtyRegion->Init(); + PRBool hasWidget; + aView->HasWidget(&hasWidget); + if (hasWidget) { + nsCOMPtr dirtyRegion; + aView->GetDirtyRegion(*getter_AddRefs(dirtyRegion)); + if (dirtyRegion != nsnull && !dirtyRegion->IsEmpty()) { + nsCOMPtr widget; + aView->GetWidget(*getter_AddRefs(widget)); + if (widget) { + widget->InvalidateRegion(dirtyRegion, PR_FALSE); + } + dirtyRegion->Init(); + } } // process pending updates in child view. @@ -1409,143 +1407,83 @@ NS_IMETHODIMP nsViewManager :: Composite() return NS_OK; } -NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, nsIRegion *aRegion, PRUint32 aUpdateFlags) +NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, PRUint32 aUpdateFlags) { - // TODO: should ads nsIWidget::Invalidate(nsIRegion*). - nsRect dirtyRect; - if (aRegion != nsnull) { - aRegion->GetBoundingBox(&dirtyRect.x, &dirtyRect.y, &dirtyRect.width, &dirtyRect.height); - } else { - aView->GetBounds(dirtyRect); - dirtyRect.x = dirtyRect.y = 0; - } - UpdateView(aView, dirtyRect, aUpdateFlags); - -#if 0 - // XXX Huh. What about the case where aRegion isn't nsull? - // XXX yeah? what about it? - if (aRegion == nsnull) - { - nsRect trect; - - // Mark the entire view as damaged - aView->GetBounds(trect); - trect.x = trect.y = 0; - UpdateView(aView, trect, aUpdateFlags); - } -#endif - - return NS_OK; + // Mark the entire view as damaged + nsRect bounds; + aView->GetBounds(bounds); + bounds.x = bounds.y = 0; + return UpdateView(aView, bounds, aUpdateFlags); } -NS_IMETHODIMP nsViewManager :: UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags) +NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags) { - NS_PRECONDITION(nsnull != aView, "null view"); - if (!mRefreshEnabled) { - // accumulate this rectangle in the view's dirty region, so we can process it later. - if (aRect.width != 0 && aRect.height != 0) { - AddRectToDirtyRegion(aView, aRect); - ++mUpdateCnt; - } - return NS_OK; - } - - // Ignore any silly requests... - if ((aRect.width == 0) || (aRect.height == 0)) - return NS_OK; - - // is this view even visible? - nsViewVisibility visibility; - aView->GetVisibility(visibility); - if (visibility == nsViewVisibility_kHide) - return NS_OK; - -#ifdef GS_DEBUG - printf("ViewManager::UpdateView: %p, rect ", aView); - stdout << aRect; - printf("\n"); -#endif - - // Find the nearest view (including this view) that has a widget - nsRect trect = aRect; - nsIView *par = aView; - nscoord x, y; - nsIView *widgetView = aView; - - do - { - nsIWidget *widget; - - // See if this view has a widget - widgetView->GetWidget(widget); - - if (nsnull != widget) - { - NS_RELEASE(widget); - break; - } - - // Get the parent view - widgetView->GetParent(widgetView); - } while (nsnull != widgetView); -// NS_ASSERTION(nsnull != widgetView, "no widget"); this assertion not valid for printing...MMP - - if (nsnull != widgetView) - { - if (0 == mUpdateCnt) - RestartTimer(); - - mUpdateCnt++; - - // Convert damage rect to coordinate space of containing view with - // a widget - // XXX Consolidate this code with the code above... -// if (aView != widgetView) -// { - // first our position - par->GetPosition(&x, &y); - trect.x += x; - trect.y += y; - - // go up parent chain until we hit the widgetView. - // make sure we include the widget view in the calculation - while ((nsnull != par) && (par != widgetView)) - { - par->GetParent(par); - - if (par == nsnull) - break; + NS_PRECONDITION(nsnull != aView, "null view"); + if (!mRefreshEnabled) { + // accumulate this rectangle in the view's dirty region, so we can process it later. + if (aRect.width != 0 && aRect.height != 0) { + AddRectToDirtyRegion(aView, aRect); + ++mUpdateCnt; + } + return NS_OK; + } - par->GetPosition(&x, &y); - trect.x += x; - trect.y += y; - } -// } + // Ignore any silly requests... + if ((aRect.width == 0) || (aRect.height == 0)) + return NS_OK; - // Add this rect to the widgetView's dirty region. + // is this view even visible? + nsViewVisibility visibility; + aView->GetVisibility(visibility); + if (visibility == nsViewVisibility_kHide) + return NS_OK; - if (nsnull != widgetView) - UpdateDirtyViews(widgetView, &trect); + // Find the nearest view (including this view) that has a widget + nsIView *widgetView = GetWidgetView(aView); + if (nsnull != widgetView) { + if (0 == mUpdateCnt) + RestartTimer(); - // See if we should do an immediate refresh or wait + mUpdateCnt++; - if (aUpdateFlags & NS_VMREFRESH_IMMEDIATE) - { - Composite(); - } - else if ((mTrueFrameRate > 0) && !(aUpdateFlags & NS_VMREFRESH_NO_SYNC)) - { - // or if a sync paint is allowed and it's time for the compositor to - // do a refresh +#if 0 + // Transform damaged rect to widgetView's coordinate system. + nsRect widgetRect = aRect; + nsIView *parentView = aView; + while (parentView != widgetView) { + nscoord x, y; + parentView->GetPosition(&x, &y); + widgetRect.x += x; + widgetRect.y += y; + parentView->GetParent(parentView); + } - PRInt32 deltams = PR_IntervalToMilliseconds(PR_IntervalNow() - mLastRefresh); + // Add this rect to the widgetView's dirty region. + if (nsnull != widgetView) + UpdateDirtyViews(widgetView, &widgetRect); +#else + // Go ahead and invalidate the entire rectangular area. + // regardless of parentage. + nsRect widgetRect = aRect; + ViewToWidget(aView, widgetView, widgetRect); + nsCOMPtr widget; + widgetView->GetWidget(*getter_AddRefs(widget)); + widget->Invalidate(widgetRect, PR_FALSE); +#endif - if (deltams > (1000 / (PRInt32)mTrueFrameRate)) - Composite(); - } - } + // See if we should do an immediate refresh or wait + if (aUpdateFlags & NS_VMREFRESH_IMMEDIATE) { + Composite(); + } else if ((mTrueFrameRate > 0) && !(aUpdateFlags & NS_VMREFRESH_NO_SYNC)) { + // or if a sync paint is allowed and it's time for the compositor to + // do a refresh + PRInt32 deltams = PR_IntervalToMilliseconds(PR_IntervalNow() - mLastRefresh); + if (deltams > (1000 / (PRInt32)mTrueFrameRate)) + Composite(); + } + } - return NS_OK; + return NS_OK; } NS_IMETHODIMP nsViewManager::UpdateAllViews(PRUint32 aUpdateFlags) @@ -1557,10 +1495,7 @@ NS_IMETHODIMP nsViewManager::UpdateAllViews(PRUint32 aUpdateFlags) void nsViewManager::UpdateViews(nsIView *aView, PRUint32 aUpdateFlags) { // update this view. - nsRect dirtyRect; - aView->GetBounds(dirtyRect); - dirtyRect.x = dirtyRect.y = 0; - UpdateView(aView, dirtyRect, aUpdateFlags); + UpdateView(aView, aUpdateFlags); // update all children as well. nsIView* childView = nsnull; @@ -1836,7 +1771,7 @@ NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, nsIV child->GetVisibility(visibility); if (nsViewVisibility_kHide != visibility) - UpdateView(child, nsnull, NS_VMREFRESH_NO_SYNC); + UpdateView(child, NS_VMREFRESH_NO_SYNC); } return NS_OK; } @@ -1883,7 +1818,7 @@ NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, PRIn child->GetVisibility(visibility); if (nsViewVisibility_kHide != visibility) - UpdateView(child, nsnull, NS_VMREFRESH_NO_SYNC); + UpdateView(child, NS_VMREFRESH_NO_SYNC); } return NS_OK; } @@ -1896,7 +1831,7 @@ NS_IMETHODIMP nsViewManager :: RemoveChild(nsIView *parent, nsIView *child) if ((nsnull != parent) && (nsnull != child)) { UpdateTransCnt(child, nsnull); - UpdateView(child, nsnull, NS_VMREFRESH_NO_SYNC); + UpdateView(child, NS_VMREFRESH_NO_SYNC); parent->RemoveChild(child); } @@ -1912,33 +1847,29 @@ NS_IMETHODIMP nsViewManager :: MoveViewBy(nsIView *aView, nscoord aX, nscoord aY return NS_OK; } -NS_IMETHODIMP nsViewManager :: MoveViewTo(nsIView *aView, nscoord aX, nscoord aY) +NS_IMETHODIMP nsViewManager::MoveViewTo(nsIView *aView, nscoord aX, nscoord aY) { - nscoord oldX; - nscoord oldY; + nscoord oldX, oldY; + aView->GetPosition(&oldX, &oldY); + aView->SetPosition(aX, aY); - aView->GetPosition(&oldX, &oldY); - aView->SetPosition(aX, aY); + // only do damage control if the view is visible - // only do damage control if the view is visible - - if ((aX != oldX) || (aY != oldY)) - { - nsViewVisibility visibility; - aView->GetVisibility(visibility); - if (visibility != nsViewVisibility_kHide) - { - nsRect bounds; - aView->GetBounds(bounds); - nsRect oldArea(oldX, oldY, bounds.width, bounds.height); - nsIView* parent; - aView->GetParent(parent); - UpdateView(parent, oldArea, NS_VMREFRESH_NO_SYNC); - nsRect newArea(aX, aY, bounds.width, bounds.height); - UpdateView(parent, newArea, NS_VMREFRESH_NO_SYNC); - } - } - return NS_OK; + if ((aX != oldX) || (aY != oldY)) { + nsViewVisibility visibility; + aView->GetVisibility(visibility); + if (visibility != nsViewVisibility_kHide) { + nsRect bounds; + aView->GetBounds(bounds); + nsRect oldArea(oldX, oldY, bounds.width, bounds.height); + nsIView* parentView; + aView->GetParent(parentView); + UpdateView(parentView, oldArea, NS_VMREFRESH_NO_SYNC); + nsRect newArea(aX, aY, bounds.width, bounds.height); + UpdateView(parentView, newArea, NS_VMREFRESH_NO_SYNC); + } + } + return NS_OK; } NS_IMETHODIMP nsViewManager::ResizeView(nsIView *aView, nscoord width, nscoord height) @@ -1968,7 +1899,7 @@ NS_IMETHODIMP nsViewManager::ResizeView(nsIView *aView, nscoord width, nscoord h // why just refreshing the bounding box is insufficient. nsRect oldBounds(x, y, oldWidth, oldHeight); UpdateView(parentView, oldBounds, NS_VMREFRESH_NO_SYNC); - UpdateView(parentView, nsnull, NS_VMREFRESH_NO_SYNC); + UpdateView(parentView, NS_VMREFRESH_NO_SYNC); #endif } @@ -2003,7 +1934,7 @@ NS_IMETHODIMP nsViewManager :: SetViewVisibility(nsIView *aView, nsViewVisibilit } } else { - UpdateView(aView, nsnull, NS_VMREFRESH_NO_SYNC); + UpdateView(aView, NS_VMREFRESH_NO_SYNC); } } return NS_OK; @@ -2144,7 +2075,7 @@ NS_IMETHODIMP nsViewManager :: SetViewContentTransparency(nsIView *aView, PRBool UpdateTransCnt(aView, nsnull); aView->SetContentTransparency(aTransparent); UpdateTransCnt(nsnull, aView); - UpdateView(aView, nsnull, NS_VMREFRESH_NO_SYNC); + UpdateView(aView, NS_VMREFRESH_NO_SYNC); } return NS_OK; @@ -2161,7 +2092,7 @@ NS_IMETHODIMP nsViewManager :: SetViewOpacity(nsIView *aView, float aOpacity) UpdateTransCnt(aView, nsnull); aView->SetOpacity(aOpacity); UpdateTransCnt(nsnull, aView); - UpdateView(aView, nsnull, NS_VMREFRESH_NO_SYNC); + UpdateView(aView, NS_VMREFRESH_NO_SYNC); } return NS_OK; @@ -2312,68 +2243,24 @@ nsIRenderingContext * nsViewManager :: CreateRenderingContext(nsIView &aView) return cx; } -void nsViewManager::AddRegionToDirtyRegion(nsIView* aView, const nsIRegion *aRegion) const -{ - // Get the dirty region associated with the view - nsIRegion *dirtyRegion; - - aView->GetDirtyRegion(dirtyRegion); - - if (nsnull == dirtyRegion) { - // The view doesn't have a dirty region so create one - nsresult rv = nsComponentManager::CreateInstance(kRegionCID, - nsnull, - NS_GET_IID(nsIRegion), - (void **)&dirtyRegion); - - if (NS_FAILED(rv)) return; - dirtyRegion->Init(); - aView->SetDirtyRegion(dirtyRegion); - } - - // since this is only used to buffer update requests, keep them in app units. - dirtyRegion->Union(*aRegion); - NS_RELEASE(dirtyRegion); -} - void nsViewManager::AddRectToDirtyRegion(nsIView* aView, const nsRect &aRect) const { - // Get the dirty region associated with the view - nsIRegion *dirtyRegion; - - aView->GetDirtyRegion(dirtyRegion); - - if (nsnull == dirtyRegion) { - // The view doesn't have a dirty region so create one - nsresult rv = nsComponentManager::CreateInstance(kRegionCID, - nsnull, - NS_GET_IID(nsIRegion), - (void **)&dirtyRegion); + // Find a view with an associated widget. We'll transform this rect from the + // current view's coordinate system to a "heavyweight" parent view, then convert + // the rect to pixel coordinates, and accumulate the rect into that view's dirty region. + nsRect widgetRect = aRect; + nsIView* widgetView = GetWidgetView(aView); + ViewToWidget(aView, widgetView, widgetRect); - if (NS_FAILED(rv)) return; - dirtyRegion->Init(); - aView->SetDirtyRegion(dirtyRegion); + // Get the dirty region associated with the widget view + nsCOMPtr dirtyRegion; + if (NS_SUCCEEDED(widgetView->GetDirtyRegion(*getter_AddRefs(dirtyRegion)))) { + // add this rect to the widget view's dirty region. + dirtyRegion->Union(widgetRect.x, widgetRect.y, widgetRect.width, widgetRect.height); } - - // since this is only used to buffer update requests, keep them in app units. - dirtyRegion->Union(aRect.x, aRect.y, aRect.width, aRect.height); - NS_RELEASE(dirtyRegion); - -#if 0 - // Dirty regions are in device units, and aRect is in app units so - // we need to convert to device units - nsRect trect = aRect; - float t2p; - - mContext->GetAppUnitsToDevUnits(t2p); - - trect.ScaleRoundOut(t2p); - dirtyRegion->Union(trect.x, trect.y, trect.width, trect.height); - NS_IF_RELEASE(dirtyRegion); -#endif } -void nsViewManager :: UpdateTransCnt(nsIView *oldview, nsIView *newview) +void nsViewManager::UpdateTransCnt(nsIView *oldview, nsIView *newview) { if (nsnull != oldview) { @@ -2754,84 +2641,6 @@ void nsViewManager::ShowDisplayList(PRInt32 flatlen) } } -#if 0 - -void nsViewManager :: FlattenViewTreeUp(nsIView *aView, PRInt32 *aIndex, - const nsRect *aDamageRect, nsIView *aParView, - nsVoidArray *aArray) -{ - nsIView *nextview; - nsRect bounds, irect; - PRBool trans; - float opacity; - PRBool haswidget; - nsViewVisibility vis; - nsPoint *point; - - aView->GetNextSibling(nextview); - - if (!nextview) - { - nextview = aParView; - nextview->GetParent(aParView); - } - - if (!aParView) - return; - - aParView->GetScratchPoint(&point); - - if (nextview) - { - nextview->GetBounds(bounds); - - bounds.x += point->x; - bounds.y += point->y; - - haswidget = DoesViewHaveNativeWidget(*nextview); - nextview->GetVisibility(vis); - nextview->HasTransparency(trans); - nextview->GetOpacity(opacity); - - if (!haswidget && irect.IntersectRect(bounds, *aDamageRect) && - (nsViewVisibility_kShow == vis) && (opacity > 0.0f)) - { - aArray->ReplaceElementAt(nextview, (*aIndex)++); - - nsRect *grect = (nsRect *)aArray->ElementAt(*aIndex); - - if (!grect) - { - grect = new nsRect(bounds.x, bounds.y, bounds.width, bounds.height); - - if (!grect) - { - (*aIndex)--; - return; - } - - aArray->ReplaceElementAt(grect, *aIndex); - } - else - *grect = bounds; - - (*aIndex)++; - - aArray->ReplaceElementAt(nsnull, (*aIndex)++); - - //if this view completely covers the damage area and it's opaque - //then we're done. - - if (!trans && (opacity == 1.0f) && (irect == *aDamageRect)) - return; - } - - FlattenViewTreeUp(nextview, aIndex, aDamageRect, aParView, aArray); - } -} - -#endif - void nsViewManager :: ComputeViewOffset(nsIView *aView, nscoord *aX, nscoord *aY, PRInt32 aFlag) { nsIView *parent; @@ -2868,7 +2677,6 @@ PRBool nsViewManager :: DoesViewHaveNativeWidget(nsIView &aView) void *nativewidget; nativewidget = widget->GetNativeData(NS_NATIVE_WIDGET); - NS_RELEASE(widget); if (nsnull != nativewidget) @@ -2889,3 +2697,30 @@ void nsViewManager :: RestartTimer(void) { SetFrameRate(mTrueFrameRate); } + +nsIView* nsViewManager::GetWidgetView(nsIView *aView) +{ + while (aView != nsnull) { + PRBool hasWidget; + aView->HasWidget(&hasWidget); + if (hasWidget) + return aView; + aView->GetParent(aView); + } + return nsnull; +} + +void nsViewManager::ViewToWidget(nsIView *aView, nsIView* aWidgetView, nsRect &aRect) +{ + while (aView != aWidgetView) { + nscoord x, y; + aView->GetPosition(&x, &y); + aRect.MoveBy(x, y); + aView->GetParent(aView); + } + + // finally, convert to device coordinates. + float t2p; + mContext->GetAppUnitsToDevUnits(t2p); + aRect.ScaleRoundOut(t2p); +} diff --git a/view/src/nsViewManager.h b/view/src/nsViewManager.h index bbd7448197695..3e77d797604d2 100644 --- a/view/src/nsViewManager.h +++ b/view/src/nsViewManager.h @@ -37,8 +37,7 @@ class nsISupportsArray; -class nsViewManager : public nsIViewManager -{ +class nsViewManager : public nsIViewManager { public: nsViewManager(); @@ -61,8 +60,7 @@ class nsViewManager : public nsIViewManager NS_IMETHOD Composite(void); - NS_IMETHOD UpdateView(nsIView *aView, nsIRegion *aRegion, - PRUint32 aUpdateFlags); + NS_IMETHOD UpdateView(nsIView *aView, PRUint32 aUpdateFlags); NS_IMETHOD UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags); NS_IMETHOD UpdateAllViews(PRUint32 aUpdateFlags); @@ -121,8 +119,8 @@ class nsViewManager : public nsIViewManager NS_IMETHOD BeginUpdateViewBatch(void); NS_IMETHOD EndUpdateViewBatch(void); - NS_IMETHOD SetRootScrollableView(nsIScrollableView *aScrollable); - NS_IMETHOD GetRootScrollableView(nsIScrollableView **aScrollable); + NS_IMETHOD SetRootScrollableView(nsIScrollableView *aScrollable); + NS_IMETHOD GetRootScrollableView(nsIScrollableView **aScrollable); nsDrawingSurface GetDrawingSurface(nsIRenderingContext &aContext, nsRect& aBounds); @@ -135,37 +133,50 @@ class nsViewManager : public nsIViewManager virtual ~nsViewManager(); private: - nsIRenderingContext *CreateRenderingContext(nsIView &aView); - void AddRegionToDirtyRegion(nsIView* aView, const nsIRegion *aRegion) const; - void AddRectToDirtyRegion(nsIView* aView, const nsRect &aRect) const; - void UpdateDirtyViews(nsIView *aView, nsRect *aParentRect) const; - void UpdateTransCnt(nsIView *oldview, nsIView *newview); - - void ProcessPendingUpdates(nsIView *aView); - void UpdateViews(nsIView *aView, PRUint32 aUpdateFlags); - - void Refresh(nsIView *aView, nsIRenderingContext *aContext, - nsIRegion *region, PRUint32 aUpdateFlags); - void Refresh(nsIView* aView, nsIRenderingContext *aContext, - const nsRect *rect, PRUint32 aUpdateFlags); - void RenderViews(nsIView *aRootView, nsIRenderingContext& aRC, const nsRect& aRect, - PRBool &aResult); - void RenderView(nsIView *aView, nsIRenderingContext &aRC, - const nsRect &aDamageRect, nsRect &aGlobalRect, PRBool &aResult); - PRBool CreateDisplayList(nsIView *aView, PRInt32 *aIndex, nscoord aOriginX, nscoord aOriginY, - nsIView *aRealView, const nsRect *aDamageRect = nsnull, - nsIView *aTopView = nsnull, nsVoidArray *aArray = nsnull, - nscoord aX = 0, nscoord aY = 0); -// void FlattenViewTreeUp(nsIView *aView, PRInt32 *aIndex, const nsRect *aDamageRect, -// nsIView *aStartView, nsVoidArray *aArray); - PRBool AddToDisplayList(nsVoidArray *aArray, PRInt32 *aIndex, - nsIView *aView, nsRect &aRect, PRUint32 aFlags); - void ShowDisplayList(PRInt32 flatlen); - void ComputeViewOffset(nsIView *aView, nscoord *aX, nscoord *aY, PRInt32 aFlag); - PRBool DoesViewHaveNativeWidget(nsIView &aView); - void PauseTimer(void); - void RestartTimer(void); + nsIRenderingContext *CreateRenderingContext(nsIView &aView); + void AddRectToDirtyRegion(nsIView* aView, const nsRect &aRect) const; + void UpdateDirtyViews(nsIView *aView, nsRect *aParentRect) const; + void UpdateTransCnt(nsIView *oldview, nsIView *newview); + + void ProcessPendingUpdates(nsIView *aView); + void UpdateViews(nsIView *aView, PRUint32 aUpdateFlags); + + void Refresh(nsIView *aView, nsIRenderingContext *aContext, + nsIRegion *region, PRUint32 aUpdateFlags); + void Refresh(nsIView* aView, nsIRenderingContext *aContext, + const nsRect *rect, PRUint32 aUpdateFlags); + void RenderViews(nsIView *aRootView, nsIRenderingContext& aRC, const nsRect& aRect, + PRBool &aResult); + void RenderView(nsIView *aView, nsIRenderingContext &aRC, + const nsRect &aDamageRect, nsRect &aGlobalRect, PRBool &aResult); + PRBool CreateDisplayList(nsIView *aView, PRInt32 *aIndex, nscoord aOriginX, nscoord aOriginY, + nsIView *aRealView, const nsRect *aDamageRect = nsnull, + nsIView *aTopView = nsnull, nsVoidArray *aArray = nsnull, + nscoord aX = 0, nscoord aY = 0); + PRBool AddToDisplayList(nsVoidArray *aArray, PRInt32 *aIndex, + nsIView *aView, nsRect &aRect, PRUint32 aFlags); + void ShowDisplayList(PRInt32 flatlen); + void ComputeViewOffset(nsIView *aView, nscoord *aX, nscoord *aY, PRInt32 aFlag); + PRBool DoesViewHaveNativeWidget(nsIView &aView); + void PauseTimer(void); + void RestartTimer(void); + + // Utilities + + /** + * Returns the nearest parent view with an attached widget. Can be the + * same view as passed-in. + */ + nsIView* GetWidgetView(nsIView *aView); + + /** + * Transforms a rectangle from specified view's coordinate system to + * the first parent that has an attached widget. + */ + void ViewToWidget(nsIView *aView, nsIView* aWidgetView, nsRect &aRect); + // void WidgetToView(nsIView* aView, nsRect &aWidgetRect); +private: nsIDeviceContext *mContext; nsIViewObserver *mObserver; nsIWidget *mRootWindow; diff --git a/webshell/src/nsWebShell.cpp b/webshell/src/nsWebShell.cpp index 3183e9fc50f72..d9b9f83ade1ba 100644 --- a/webshell/src/nsWebShell.cpp +++ b/webshell/src/nsWebShell.cpp @@ -1778,7 +1778,7 @@ nsWebShell::SetZoom(float aZoom) sv->ComputeScrollOffsets(); vm->GetRootView(rootview); if (nsnull != rootview) - vm->UpdateView(rootview, nsnull, 0); + vm->UpdateView(rootview, 0); NS_RELEASE(vm); } NS_RELEASE(shell); diff --git a/webshell/tests/viewer/nsBrowserWindow.cpp b/webshell/tests/viewer/nsBrowserWindow.cpp index d35ab9f6c127a..0b779f4b3c343 100644 --- a/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/webshell/tests/viewer/nsBrowserWindow.cpp @@ -886,7 +886,7 @@ NS_IMETHODIMP nsBrowserWindow::ForceRefresh() nsIView* root; vm->GetRootView(root); if (nsnull != root) { - vm->UpdateView(root, (nsIRegion*)nsnull, NS_VMREFRESH_IMMEDIATE); + vm->UpdateView(root, NS_VMREFRESH_IMMEDIATE); } } NS_RELEASE(shell); diff --git a/webshell/tests/viewer/nsWebCrawler.cpp b/webshell/tests/viewer/nsWebCrawler.cpp index 54926cd00c2fc..859e5411ae436 100644 --- a/webshell/tests/viewer/nsWebCrawler.cpp +++ b/webshell/tests/viewer/nsWebCrawler.cpp @@ -277,7 +277,7 @@ nsWebCrawler::OnEndDocumentLoad(nsIDocumentLoader* loader, if (vm) { nsIView* rootView; vm->GetRootView(rootView); - vm->UpdateView(rootView, nsnull, NS_VMREFRESH_IMMEDIATE); + vm->UpdateView(rootView, NS_VMREFRESH_IMMEDIATE); } #ifdef NS_DEBUG diff --git a/webshell/tests/viewer/nsXPBaseWindow.cpp b/webshell/tests/viewer/nsXPBaseWindow.cpp index 2babcb44e8de4..0f7f73b5142fb 100644 --- a/webshell/tests/viewer/nsXPBaseWindow.cpp +++ b/webshell/tests/viewer/nsXPBaseWindow.cpp @@ -261,8 +261,7 @@ void nsXPBaseWindow::ForceRefresh() nsIView* root; vm->GetRootView(root); if (nsnull != root) { - vm->UpdateView(root, (nsIRegion*)nsnull, NS_VMREFRESH_IMMEDIATE | - NS_VMREFRESH_AUTO_DOUBLE_BUFFER); + vm->UpdateView(root, NS_VMREFRESH_IMMEDIATE | NS_VMREFRESH_AUTO_DOUBLE_BUFFER); } } NS_RELEASE(shell);