Skip to content

Commit

Permalink
pork jockey paint fixes. bug=18140, r=kmcclusk,pavlov
Browse files Browse the repository at this point in the history
  • Loading branch information
beard%netscape.com committed Nov 14, 1999
1 parent 927eb4f commit 65a3476
Show file tree
Hide file tree
Showing 25 changed files with 283 additions and 427 deletions.
2 changes: 1 addition & 1 deletion content/base/src/nsDocumentViewer.cpp
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion docshell/base/nsWebShell.cpp
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion editor/base/nsEditor.cpp
Expand Up @@ -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);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions editor/base/nsEditorEventListeners.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion editor/libeditor/base/nsEditor.cpp
Expand Up @@ -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);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions editor/libeditor/text/nsEditorEventListeners.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion layout/base/nsCSSFrameConstructor.cpp
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion layout/base/nsDocumentViewer.cpp
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion layout/base/nsPresShell.cpp
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion layout/base/src/nsDocumentViewer.cpp
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion layout/html/base/src/nsPresShell.cpp
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions layout/html/forms/src/nsGfxTextControlFrame.cpp
Expand Up @@ -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<nsIContent> content;
rv = NS_NewTextNode(getter_AddRefs(content));
if (NS_FAILED(rv)) { return rv; }
if (!content) { return NS_ERROR_NULL_POINTER; }
nsIDocument* doc;
Expand Down
2 changes: 1 addition & 1 deletion layout/html/style/src/nsCSSFrameConstructor.cpp
Expand Up @@ -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);
Expand Down
17 changes: 9 additions & 8 deletions view/public/nsIView.h
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions view/public/nsIViewManager.h
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions view/src/nsScrollPortView.cpp
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions view/src/nsScrollingView.cpp
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
50 changes: 32 additions & 18 deletions view/src/nsView.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -1305,26 +1307,28 @@ 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);
}

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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions view/src/nsView.h
Expand Up @@ -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);
Expand Down

0 comments on commit 65a3476

Please sign in to comment.