pork jockey paint fixes. bug=18140, r=kmcclusk,pavlov
This commit is contained in:
Родитель
b77b8570ce
Коммит
54792d43d1
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -390,12 +390,6 @@ public:
|
|||
*/
|
||||
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 @@ public:
|
|||
* 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
|
||||
|
|
|
@ -118,16 +118,12 @@ public:
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
NS_IMETHODIMP nsView :: SetDirtyRegion(nsIRegion *aRegion)
|
||||
{
|
||||
NS_IF_RELEASE(mDirtyRegion);
|
||||
mDirtyRegion = aRegion;
|
||||
NS_IF_ADDREF(mDirtyRegion);
|
||||
return NS_OK;
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = mDirtyRegion->Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
aRegion = mDirtyRegion;
|
||||
NS_ADDREF(aRegion);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsView :: GetScratchPoint(nsPoint **aPoint)
|
||||
|
|
|
@ -92,19 +92,19 @@ public:
|
|||
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);
|
||||
|
|
|
@ -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.
|
||||
// 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;
|
||||
|
||||
if (nsnull != aParentRect)
|
||||
{
|
||||
pardamage = *aParentRect;
|
||||
|
||||
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<nsIRegion> 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<nsIRegion> dirtyRegion;
|
||||
aView->GetDirtyRegion(*getter_AddRefs(dirtyRegion));
|
||||
if (dirtyRegion != nsnull && !dirtyRegion->IsEmpty()) {
|
||||
nsCOMPtr<nsIWidget> 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;
|
||||
}
|
||||
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;
|
||||
// Ignore any silly requests...
|
||||
if ((aRect.width == 0) || (aRect.height == 0))
|
||||
return NS_OK;
|
||||
|
||||
#ifdef GS_DEBUG
|
||||
printf("ViewManager::UpdateView: %p, rect ", aView);
|
||||
stdout << aRect;
|
||||
printf("\n");
|
||||
// is this view even visible?
|
||||
nsViewVisibility visibility;
|
||||
aView->GetVisibility(visibility);
|
||||
if (visibility == nsViewVisibility_kHide)
|
||||
return NS_OK;
|
||||
|
||||
// Find the nearest view (including this view) that has a widget
|
||||
nsIView *widgetView = GetWidgetView(aView);
|
||||
if (nsnull != widgetView) {
|
||||
if (0 == mUpdateCnt)
|
||||
RestartTimer();
|
||||
|
||||
mUpdateCnt++;
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
// 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<nsIWidget> widget;
|
||||
widgetView->GetWidget(*getter_AddRefs(widget));
|
||||
widget->Invalidate(widgetRect, PR_FALSE);
|
||||
#endif
|
||||
|
||||
// Find the nearest view (including this view) that has a widget
|
||||
nsRect trect = aRect;
|
||||
nsIView *par = aView;
|
||||
nscoord x, y;
|
||||
nsIView *widgetView = aView;
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
par->GetPosition(&x, &y);
|
||||
trect.x += x;
|
||||
trect.y += y;
|
||||
}
|
||||
// }
|
||||
|
||||
// Add this rect to the widgetView's dirty region.
|
||||
|
||||
if (nsnull != widgetView)
|
||||
UpdateDirtyViews(widgetView, &trect);
|
||||
|
||||
// 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;
|
||||
// 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);
|
||||
|
||||
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);
|
||||
// Get the dirty region associated with the widget view
|
||||
nsCOMPtr<nsIRegion> 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);
|
||||
}
|
||||
|
|
|
@ -37,8 +37,7 @@
|
|||
|
||||
class nsISupportsArray;
|
||||
|
||||
class nsViewManager : public nsIViewManager
|
||||
{
|
||||
class nsViewManager : public nsIViewManager {
|
||||
public:
|
||||
nsViewManager();
|
||||
|
||||
|
@ -61,8 +60,7 @@ public:
|
|||
|
||||
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 @@ public:
|
|||
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 @@ protected:
|
|||
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);
|
||||
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 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);
|
||||
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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче