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;
|
nsIView* view;
|
||||||
mViewManager->GetRootView(view); // views are not refCounted
|
mViewManager->GetRootView(view); // views are not refCounted
|
||||||
if (view) {
|
if (view) {
|
||||||
mViewManager->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
mViewManager->UpdateView(view, NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1778,7 +1778,7 @@ nsWebShell::SetZoom(float aZoom)
|
||||||
sv->ComputeScrollOffsets();
|
sv->ComputeScrollOffsets();
|
||||||
vm->GetRootView(rootview);
|
vm->GetRootView(rootview);
|
||||||
if (nsnull != rootview)
|
if (nsnull != rootview)
|
||||||
vm->UpdateView(rootview, nsnull, 0);
|
vm->UpdateView(rootview, 0);
|
||||||
NS_RELEASE(vm);
|
NS_RELEASE(vm);
|
||||||
}
|
}
|
||||||
NS_RELEASE(shell);
|
NS_RELEASE(shell);
|
||||||
|
|
|
@ -3166,7 +3166,7 @@ void nsEditor::HACKForceRedraw()
|
||||||
nsIView* view;
|
nsIView* view;
|
||||||
viewmgr->GetRootView(view); // views are not refCounted
|
viewmgr->GetRootView(view); // views are not refCounted
|
||||||
if (view) {
|
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;
|
nsIView* view;
|
||||||
viewmgr->GetRootView(view); // views are not refCounted
|
viewmgr->GetRootView(view); // views are not refCounted
|
||||||
if (view) {
|
if (view) {
|
||||||
viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
viewmgr->UpdateView(view,NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end hack repaint
|
// end hack repaint
|
||||||
|
@ -1259,7 +1259,7 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent)
|
||||||
nsIView* view;
|
nsIView* view;
|
||||||
viewmgr->GetRootView(view); // views are not refCounted
|
viewmgr->GetRootView(view); // views are not refCounted
|
||||||
if (view) {
|
if (view) {
|
||||||
viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
viewmgr->UpdateView(view,NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end hack repaint
|
// end hack repaint
|
||||||
|
|
|
@ -3166,7 +3166,7 @@ void nsEditor::HACKForceRedraw()
|
||||||
nsIView* view;
|
nsIView* view;
|
||||||
viewmgr->GetRootView(view); // views are not refCounted
|
viewmgr->GetRootView(view); // views are not refCounted
|
||||||
if (view) {
|
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;
|
nsIView* view;
|
||||||
viewmgr->GetRootView(view); // views are not refCounted
|
viewmgr->GetRootView(view); // views are not refCounted
|
||||||
if (view) {
|
if (view) {
|
||||||
viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
viewmgr->UpdateView(view,NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end hack repaint
|
// end hack repaint
|
||||||
|
@ -1259,7 +1259,7 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent)
|
||||||
nsIView* view;
|
nsIView* view;
|
||||||
viewmgr->GetRootView(view); // views are not refCounted
|
viewmgr->GetRootView(view); // views are not refCounted
|
||||||
if (view) {
|
if (view) {
|
||||||
viewmgr->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
viewmgr->UpdateView(view,NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end hack repaint
|
// end hack repaint
|
||||||
|
|
|
@ -6500,7 +6500,7 @@ SyncAndInvalidateView(nsIView* aView, nsIFrame* aFrame,
|
||||||
if (viewIsVisible) {
|
if (viewIsVisible) {
|
||||||
aViewManager->SetViewContentTransparency(aView, viewHasTransparentContent);
|
aViewManager->SetViewContentTransparency(aView, viewHasTransparentContent);
|
||||||
aViewManager->SetViewVisibility(aView, nsViewVisibility_kShow);
|
aViewManager->SetViewVisibility(aView, nsViewVisibility_kShow);
|
||||||
aViewManager->UpdateView(aView, nsnull, NS_VMREFRESH_NO_SYNC);
|
aViewManager->UpdateView(aView, NS_VMREFRESH_NO_SYNC);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aViewManager->SetViewVisibility(aView, nsViewVisibility_kHide);
|
aViewManager->SetViewVisibility(aView, nsViewVisibility_kHide);
|
||||||
|
|
|
@ -833,7 +833,7 @@ DocumentViewerImpl::SetEnableRendering(PRBool aOn)
|
||||||
nsIView* view;
|
nsIView* view;
|
||||||
mViewManager->GetRootView(view); // views are not refCounted
|
mViewManager->GetRootView(view); // views are not refCounted
|
||||||
if (view) {
|
if (view) {
|
||||||
mViewManager->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
mViewManager->UpdateView(view, NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1631,7 +1631,7 @@ PresShell::ProcessReflowCommands()
|
||||||
// see it.
|
// see it.
|
||||||
nsIView* rootView;
|
nsIView* rootView;
|
||||||
mViewManager->GetRootView(rootView);
|
mViewManager->GetRootView(rootView);
|
||||||
mViewManager->UpdateView(rootView, nsnull, NS_VMREFRESH_IMMEDIATE);
|
mViewManager->UpdateView(rootView, NS_VMREFRESH_IMMEDIATE);
|
||||||
|
|
||||||
mInVerifyReflow = PR_TRUE;
|
mInVerifyReflow = PR_TRUE;
|
||||||
PRBool ok = VerifyIncrementalReflow();
|
PRBool ok = VerifyIncrementalReflow();
|
||||||
|
|
|
@ -833,7 +833,7 @@ DocumentViewerImpl::SetEnableRendering(PRBool aOn)
|
||||||
nsIView* view;
|
nsIView* view;
|
||||||
mViewManager->GetRootView(view); // views are not refCounted
|
mViewManager->GetRootView(view); // views are not refCounted
|
||||||
if (view) {
|
if (view) {
|
||||||
mViewManager->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
mViewManager->UpdateView(view, NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1631,7 +1631,7 @@ PresShell::ProcessReflowCommands()
|
||||||
// see it.
|
// see it.
|
||||||
nsIView* rootView;
|
nsIView* rootView;
|
||||||
mViewManager->GetRootView(rootView);
|
mViewManager->GetRootView(rootView);
|
||||||
mViewManager->UpdateView(rootView, nsnull, NS_VMREFRESH_IMMEDIATE);
|
mViewManager->UpdateView(rootView, NS_VMREFRESH_IMMEDIATE);
|
||||||
|
|
||||||
mInVerifyReflow = PR_TRUE;
|
mInVerifyReflow = PR_TRUE;
|
||||||
PRBool ok = VerifyIncrementalReflow();
|
PRBool ok = VerifyIncrementalReflow();
|
||||||
|
|
|
@ -1635,8 +1635,8 @@ nsGfxTextControlFrame::Reflow(nsIPresContext& aPresContext,
|
||||||
{ // single line text controls get a display frame rather than a subdoc.
|
{ // single line text controls get a display frame rather than a subdoc.
|
||||||
// the subdoc will be created when the frame first gets focus
|
// the subdoc will be created when the frame first gets focus
|
||||||
// create anonymous text content
|
// create anonymous text content
|
||||||
nsIContent* content;
|
nsCOMPtr<nsIContent> content;
|
||||||
rv = NS_NewTextNode(&content);
|
rv = NS_NewTextNode(getter_AddRefs(content));
|
||||||
if (NS_FAILED(rv)) { return rv; }
|
if (NS_FAILED(rv)) { return rv; }
|
||||||
if (!content) { return NS_ERROR_NULL_POINTER; }
|
if (!content) { return NS_ERROR_NULL_POINTER; }
|
||||||
nsIDocument* doc;
|
nsIDocument* doc;
|
||||||
|
|
|
@ -6500,7 +6500,7 @@ SyncAndInvalidateView(nsIView* aView, nsIFrame* aFrame,
|
||||||
if (viewIsVisible) {
|
if (viewIsVisible) {
|
||||||
aViewManager->SetViewContentTransparency(aView, viewHasTransparentContent);
|
aViewManager->SetViewContentTransparency(aView, viewHasTransparentContent);
|
||||||
aViewManager->SetViewVisibility(aView, nsViewVisibility_kShow);
|
aViewManager->SetViewVisibility(aView, nsViewVisibility_kShow);
|
||||||
aViewManager->UpdateView(aView, nsnull, NS_VMREFRESH_NO_SYNC);
|
aViewManager->UpdateView(aView, NS_VMREFRESH_NO_SYNC);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aViewManager->SetViewVisibility(aView, nsViewVisibility_kHide);
|
aViewManager->SetViewVisibility(aView, nsViewVisibility_kHide);
|
||||||
|
|
|
@ -390,12 +390,6 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetDirtyRegion(nsIRegion *&aRegion) const = 0;
|
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
|
* Create a widget to associate with this view. This is a helper
|
||||||
* function for SetWidget.
|
* function for SetWidget.
|
||||||
|
@ -430,16 +424,23 @@ public:
|
||||||
* If we believe that all cutout view have a native widget, this
|
* If we believe that all cutout view have a native widget, this
|
||||||
* could be a replacement.
|
* could be a replacement.
|
||||||
* @param aWidget out parameter for widget that this view contains,
|
* @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;
|
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
|
* Output debug info to FILE
|
||||||
* @param out output file handle
|
* @param out output file handle
|
||||||
* @param aIndent indentation depth
|
* @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
|
* Set flags on view to allow customization of view behavior during
|
||||||
|
|
|
@ -118,16 +118,12 @@ public:
|
||||||
NS_IMETHOD Composite(void) = 0;
|
NS_IMETHOD Composite(void) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to inform the view manager that some portion of a view
|
* Called to inform the view manager that the entire area of a view
|
||||||
* is dirty and needs to be redrawn. The region passed in
|
* is dirty and needs to be redrawn.
|
||||||
* should be in the view's coordinate space.
|
|
||||||
* @param aView view to paint. should be root view
|
* @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
|
* @param aUpdateFlags see bottom of nsIViewManager.h for description
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD UpdateView(nsIView *aView, nsIRegion *aRegion,
|
NS_IMETHOD UpdateView(nsIView *aView, PRUint32 aUpdateFlags) = 0;
|
||||||
PRUint32 aUpdateFlags) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to inform the view manager that some portion of a view
|
* 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 (nsnull == scrollWidget)
|
||||||
{
|
{
|
||||||
// if we don't have a scroll widget then we must just update.
|
// 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)) {
|
} else if (CannotBitBlt(aScrolledView)) {
|
||||||
// we can't blit for some reason just update the view and adjust any heavy weight widgets
|
// 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);
|
AdjustChildWidgets(this, aScrolledView, 0, 0, scale);
|
||||||
} else { // if we can blit and have a scrollwidget then scroll.
|
} else { // if we can blit and have a scrollwidget then scroll.
|
||||||
// Scroll the contents of the widget by the specfied amount, and 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;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ NS_IMETHODIMP CornerView::SetQuality(nsContentQuality aQuality)
|
||||||
mQuality = aQuality;
|
mQuality = aQuality;
|
||||||
|
|
||||||
if (mVis == nsViewVisibility_kShow)
|
if (mVis == nsViewVisibility_kShow)
|
||||||
mViewManager->UpdateView(this, nsnull, NS_VMREFRESH_IMMEDIATE);
|
mViewManager->UpdateView(this, NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
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
|
// XXX Repainting is really slow. The widget's Scroll() member function
|
||||||
// needs an argument that specifies whether child widgets are scrolled,
|
// needs an argument that specifies whether child widgets are scrolled,
|
||||||
// and we need to be able to specify the rect to be 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);
|
AdjustChildWidgets(this, aScrolledView, 0, 0, scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#include "nsIRegion.h"
|
#include "nsIRegion.h"
|
||||||
#include "nsIClipView.h"
|
#include "nsIClipView.h"
|
||||||
|
|
||||||
|
static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
|
||||||
|
|
||||||
//mmptemp
|
//mmptemp
|
||||||
|
|
||||||
static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
|
static nsEventStatus PR_CALLBACK HandleEvent(nsGUIEvent *aEvent);
|
||||||
|
@ -1305,18 +1307,20 @@ NS_IMETHODIMP nsView :: GetWidget(nsIWidget *&aWidget) const
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsView::HasWidget(PRBool *aHasWidget) const
|
||||||
|
{
|
||||||
|
*aHasWidget = (mWindow != nsnull);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// internal window creation functions
|
// internal window creation functions
|
||||||
//
|
//
|
||||||
nsresult nsView :: LoadWidget(const nsCID &aClassIID)
|
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);
|
if (NS_OK == rv) {
|
||||||
rv = nsComponentManager::CreateInstance(aClassIID, nsnull, kIWidgetIID, (void**)&mWindow);
|
|
||||||
|
|
||||||
if (NS_OK == rv)
|
|
||||||
{
|
|
||||||
// Set the widget's client data
|
// Set the widget's client data
|
||||||
mWindow->SetClientData((void*)this);
|
mWindow->SetClientData((void*)this);
|
||||||
}
|
}
|
||||||
|
@ -1324,7 +1328,7 @@ nsresult nsView :: LoadWidget(const nsCID &aClassIID)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsView :: List(FILE* out, PRInt32 aIndent) const
|
NS_IMETHODIMP nsView::List(FILE* out, PRInt32 aIndent) const
|
||||||
{
|
{
|
||||||
PRInt32 i;
|
PRInt32 i;
|
||||||
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
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);
|
for (i = aIndent; --i >= 0; ) fputs(" ", out);
|
||||||
fputs(">\n", out);
|
fputs(">\n", out);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: SetViewFlags(PRUint32 aFlags)
|
NS_IMETHODIMP nsView :: SetViewFlags(PRUint32 aFlags)
|
||||||
|
@ -1412,19 +1418,27 @@ NS_IMETHODIMP nsView :: GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidge
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: GetDirtyRegion(nsIRegion *&aRegion) const
|
NS_IMETHODIMP nsView::GetDirtyRegion(nsIRegion *&aRegion) const
|
||||||
{
|
{
|
||||||
aRegion = mDirtyRegion;
|
if (nsnull == mDirtyRegion) {
|
||||||
NS_IF_ADDREF(aRegion);
|
// The view doesn't have a dirty region so create one
|
||||||
return NS_OK;
|
nsresult rv = nsComponentManager::CreateInstance(kRegionCID,
|
||||||
}
|
nsnull,
|
||||||
|
NS_GET_IID(nsIRegion),
|
||||||
|
(void**) &mDirtyRegion);
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: SetDirtyRegion(nsIRegion *aRegion)
|
if (NS_FAILED(rv))
|
||||||
{
|
return rv;
|
||||||
NS_IF_RELEASE(mDirtyRegion);
|
|
||||||
mDirtyRegion = aRegion;
|
rv = mDirtyRegion->Init();
|
||||||
NS_IF_ADDREF(mDirtyRegion);
|
if (NS_FAILED(rv))
|
||||||
return NS_OK;
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
aRegion = mDirtyRegion;
|
||||||
|
NS_ADDREF(aRegion);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsView :: GetScratchPoint(nsPoint **aPoint)
|
NS_IMETHODIMP nsView :: GetScratchPoint(nsPoint **aPoint)
|
||||||
|
|
|
@ -92,19 +92,19 @@ public:
|
||||||
NS_IMETHOD GetClientData(void *&aData) const;
|
NS_IMETHOD GetClientData(void *&aData) const;
|
||||||
NS_IMETHOD GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget);
|
NS_IMETHOD GetOffsetFromWidget(nscoord *aDx, nscoord *aDy, nsIWidget *&aWidget);
|
||||||
NS_IMETHOD GetDirtyRegion(nsIRegion*& aRegion) const;
|
NS_IMETHOD GetDirtyRegion(nsIRegion*& aRegion) const;
|
||||||
NS_IMETHOD SetDirtyRegion(nsIRegion* aRegion);
|
|
||||||
NS_IMETHOD CreateWidget(const nsIID &aWindowIID,
|
NS_IMETHOD CreateWidget(const nsIID &aWindowIID,
|
||||||
nsWidgetInitData *aWidgetInitData = nsnull,
|
nsWidgetInitData *aWidgetInitData = nsnull,
|
||||||
nsNativeWidget aNative = nsnull,
|
nsNativeWidget aNative = nsnull,
|
||||||
PRBool aEnableDragDrop = PR_TRUE);
|
PRBool aEnableDragDrop = PR_TRUE);
|
||||||
NS_IMETHOD SetWidget(nsIWidget *aWidget);
|
NS_IMETHOD SetWidget(nsIWidget *aWidget);
|
||||||
NS_IMETHOD GetWidget(nsIWidget *&aWidget) const;
|
NS_IMETHOD GetWidget(nsIWidget *&aWidget) const;
|
||||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
NS_IMETHOD HasWidget(PRBool *aHasWidget) const;
|
||||||
NS_IMETHOD SetViewFlags(PRUint32 aFlags);
|
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||||
NS_IMETHOD ClearViewFlags(PRUint32 aFlags);
|
NS_IMETHOD SetViewFlags(PRUint32 aFlags);
|
||||||
NS_IMETHOD GetViewFlags(PRUint32 *aFlags) const;
|
NS_IMETHOD ClearViewFlags(PRUint32 aFlags);
|
||||||
NS_IMETHOD GetScratchPoint(nsPoint **aPoint);
|
NS_IMETHOD GetViewFlags(PRUint32 *aFlags) const;
|
||||||
NS_IMETHOD GetExtents(nsRect *aExtents);
|
NS_IMETHOD GetScratchPoint(nsPoint **aPoint);
|
||||||
|
NS_IMETHOD GetExtents(nsRect *aExtents);
|
||||||
|
|
||||||
// Helper function to get the view that's associated with a widget
|
// Helper function to get the view that's associated with a widget
|
||||||
static nsIView* GetViewFor(nsIWidget* aWidget);
|
static nsIView* GetViewFor(nsIWidget* aWidget);
|
||||||
|
|
|
@ -1325,35 +1325,26 @@ void nsViewManager :: RenderView(nsIView *aView, nsIRenderingContext &aRC, const
|
||||||
aRC.PopState(aResult);
|
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);
|
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)
|
if (PR_FALSE == parDamage.IsEmpty()) {
|
||||||
{
|
|
||||||
pardamage = *aParentRect;
|
|
||||||
|
|
||||||
pardamage.IntersectRect(bounds, pardamage);
|
|
||||||
pardamage.MoveBy(-bounds.x, -bounds.y);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
pardamage = bounds;
|
|
||||||
|
|
||||||
if (PR_FALSE == pardamage.IsEmpty())
|
|
||||||
{
|
|
||||||
nsIWidget *widget;
|
nsIWidget *widget;
|
||||||
|
|
||||||
aView->GetWidget(widget);
|
aView->GetWidget(widget);
|
||||||
|
if (nsnull != widget) {
|
||||||
if (nsnull != widget)
|
|
||||||
{
|
|
||||||
float scale;
|
float scale;
|
||||||
nsRect pixrect = pardamage;
|
nsRect pixrect = parDamage;
|
||||||
|
|
||||||
mContext->GetAppUnitsToDevUnits(scale);
|
mContext->GetAppUnitsToDevUnits(scale);
|
||||||
pixrect.ScaleRoundOut(scale);
|
pixrect.ScaleRoundOut(scale);
|
||||||
|
@ -1370,20 +1361,27 @@ void nsViewManager :: UpdateDirtyViews(nsIView *aView, nsRect *aParentRect) cons
|
||||||
|
|
||||||
aView->GetChild(0, child);
|
aView->GetChild(0, child);
|
||||||
|
|
||||||
while (nsnull != child)
|
while (nsnull != child) {
|
||||||
{
|
UpdateDirtyViews(child, &parDamage);
|
||||||
UpdateDirtyViews(child, &pardamage);
|
|
||||||
child->GetNextSibling(child);
|
child->GetNextSibling(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsViewManager::ProcessPendingUpdates(nsIView* aView)
|
void nsViewManager::ProcessPendingUpdates(nsIView* aView)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIRegion> dirtyRegion;
|
PRBool hasWidget;
|
||||||
aView->GetDirtyRegion(*getter_AddRefs(dirtyRegion));
|
aView->HasWidget(&hasWidget);
|
||||||
if (dirtyRegion != nsnull && !dirtyRegion->IsEmpty()) {
|
if (hasWidget) {
|
||||||
UpdateView(aView, dirtyRegion, 0);
|
nsCOMPtr<nsIRegion> dirtyRegion;
|
||||||
dirtyRegion->Init();
|
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.
|
// process pending updates in child view.
|
||||||
|
@ -1409,143 +1407,83 @@ NS_IMETHODIMP nsViewManager :: Composite()
|
||||||
return NS_OK;
|
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*).
|
// Mark the entire view as damaged
|
||||||
nsRect dirtyRect;
|
nsRect bounds;
|
||||||
if (aRegion != nsnull) {
|
aView->GetBounds(bounds);
|
||||||
aRegion->GetBoundingBox(&dirtyRect.x, &dirtyRect.y, &dirtyRect.width, &dirtyRect.height);
|
bounds.x = bounds.y = 0;
|
||||||
} else {
|
return UpdateView(aView, bounds, aUpdateFlags);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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");
|
NS_PRECONDITION(nsnull != aView, "null view");
|
||||||
if (!mRefreshEnabled) {
|
if (!mRefreshEnabled) {
|
||||||
// accumulate this rectangle in the view's dirty region, so we can process it later.
|
// accumulate this rectangle in the view's dirty region, so we can process it later.
|
||||||
if (aRect.width != 0 && aRect.height != 0) {
|
if (aRect.width != 0 && aRect.height != 0) {
|
||||||
AddRectToDirtyRegion(aView, aRect);
|
AddRectToDirtyRegion(aView, aRect);
|
||||||
++mUpdateCnt;
|
++mUpdateCnt;
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore any silly requests...
|
// Ignore any silly requests...
|
||||||
if ((aRect.width == 0) || (aRect.height == 0))
|
if ((aRect.width == 0) || (aRect.height == 0))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
// is this view even visible?
|
|
||||||
nsViewVisibility visibility;
|
|
||||||
aView->GetVisibility(visibility);
|
|
||||||
if (visibility == nsViewVisibility_kHide)
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
#ifdef GS_DEBUG
|
// is this view even visible?
|
||||||
printf("ViewManager::UpdateView: %p, rect ", aView);
|
nsViewVisibility visibility;
|
||||||
stdout << aRect;
|
aView->GetVisibility(visibility);
|
||||||
printf("\n");
|
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
|
#endif
|
||||||
|
|
||||||
// Find the nearest view (including this view) that has a widget
|
// See if we should do an immediate refresh or wait
|
||||||
nsRect trect = aRect;
|
if (aUpdateFlags & NS_VMREFRESH_IMMEDIATE) {
|
||||||
nsIView *par = aView;
|
Composite();
|
||||||
nscoord x, y;
|
} else if ((mTrueFrameRate > 0) && !(aUpdateFlags & NS_VMREFRESH_NO_SYNC)) {
|
||||||
nsIView *widgetView = aView;
|
// 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
|
return NS_OK;
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsViewManager::UpdateAllViews(PRUint32 aUpdateFlags)
|
NS_IMETHODIMP nsViewManager::UpdateAllViews(PRUint32 aUpdateFlags)
|
||||||
|
@ -1557,10 +1495,7 @@ NS_IMETHODIMP nsViewManager::UpdateAllViews(PRUint32 aUpdateFlags)
|
||||||
void nsViewManager::UpdateViews(nsIView *aView, PRUint32 aUpdateFlags)
|
void nsViewManager::UpdateViews(nsIView *aView, PRUint32 aUpdateFlags)
|
||||||
{
|
{
|
||||||
// update this view.
|
// update this view.
|
||||||
nsRect dirtyRect;
|
UpdateView(aView, aUpdateFlags);
|
||||||
aView->GetBounds(dirtyRect);
|
|
||||||
dirtyRect.x = dirtyRect.y = 0;
|
|
||||||
UpdateView(aView, dirtyRect, aUpdateFlags);
|
|
||||||
|
|
||||||
// update all children as well.
|
// update all children as well.
|
||||||
nsIView* childView = nsnull;
|
nsIView* childView = nsnull;
|
||||||
|
@ -1836,7 +1771,7 @@ NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, nsIV
|
||||||
child->GetVisibility(visibility);
|
child->GetVisibility(visibility);
|
||||||
|
|
||||||
if (nsViewVisibility_kHide != visibility)
|
if (nsViewVisibility_kHide != visibility)
|
||||||
UpdateView(child, nsnull, NS_VMREFRESH_NO_SYNC);
|
UpdateView(child, NS_VMREFRESH_NO_SYNC);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -1883,7 +1818,7 @@ NS_IMETHODIMP nsViewManager :: InsertChild(nsIView *parent, nsIView *child, PRIn
|
||||||
child->GetVisibility(visibility);
|
child->GetVisibility(visibility);
|
||||||
|
|
||||||
if (nsViewVisibility_kHide != visibility)
|
if (nsViewVisibility_kHide != visibility)
|
||||||
UpdateView(child, nsnull, NS_VMREFRESH_NO_SYNC);
|
UpdateView(child, NS_VMREFRESH_NO_SYNC);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -1896,7 +1831,7 @@ NS_IMETHODIMP nsViewManager :: RemoveChild(nsIView *parent, nsIView *child)
|
||||||
if ((nsnull != parent) && (nsnull != child))
|
if ((nsnull != parent) && (nsnull != child))
|
||||||
{
|
{
|
||||||
UpdateTransCnt(child, nsnull);
|
UpdateTransCnt(child, nsnull);
|
||||||
UpdateView(child, nsnull, NS_VMREFRESH_NO_SYNC);
|
UpdateView(child, NS_VMREFRESH_NO_SYNC);
|
||||||
parent->RemoveChild(child);
|
parent->RemoveChild(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1912,33 +1847,29 @@ NS_IMETHODIMP nsViewManager :: MoveViewBy(nsIView *aView, nscoord aX, nscoord aY
|
||||||
return NS_OK;
|
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 oldX, oldY;
|
||||||
nscoord oldY;
|
aView->GetPosition(&oldX, &oldY);
|
||||||
|
aView->SetPosition(aX, aY);
|
||||||
|
|
||||||
aView->GetPosition(&oldX, &oldY);
|
// only do damage control if the view is visible
|
||||||
aView->SetPosition(aX, aY);
|
|
||||||
|
|
||||||
// only do damage control if the view is visible
|
if ((aX != oldX) || (aY != oldY)) {
|
||||||
|
nsViewVisibility visibility;
|
||||||
if ((aX != oldX) || (aY != oldY))
|
aView->GetVisibility(visibility);
|
||||||
{
|
if (visibility != nsViewVisibility_kHide) {
|
||||||
nsViewVisibility visibility;
|
nsRect bounds;
|
||||||
aView->GetVisibility(visibility);
|
aView->GetBounds(bounds);
|
||||||
if (visibility != nsViewVisibility_kHide)
|
nsRect oldArea(oldX, oldY, bounds.width, bounds.height);
|
||||||
{
|
nsIView* parentView;
|
||||||
nsRect bounds;
|
aView->GetParent(parentView);
|
||||||
aView->GetBounds(bounds);
|
UpdateView(parentView, oldArea, NS_VMREFRESH_NO_SYNC);
|
||||||
nsRect oldArea(oldX, oldY, bounds.width, bounds.height);
|
nsRect newArea(aX, aY, bounds.width, bounds.height);
|
||||||
nsIView* parent;
|
UpdateView(parentView, newArea, NS_VMREFRESH_NO_SYNC);
|
||||||
aView->GetParent(parent);
|
}
|
||||||
UpdateView(parent, oldArea, NS_VMREFRESH_NO_SYNC);
|
}
|
||||||
nsRect newArea(aX, aY, bounds.width, bounds.height);
|
return NS_OK;
|
||||||
UpdateView(parent, newArea, NS_VMREFRESH_NO_SYNC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsViewManager::ResizeView(nsIView *aView, nscoord width, nscoord height)
|
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.
|
// why just refreshing the bounding box is insufficient.
|
||||||
nsRect oldBounds(x, y, oldWidth, oldHeight);
|
nsRect oldBounds(x, y, oldWidth, oldHeight);
|
||||||
UpdateView(parentView, oldBounds, NS_VMREFRESH_NO_SYNC);
|
UpdateView(parentView, oldBounds, NS_VMREFRESH_NO_SYNC);
|
||||||
UpdateView(parentView, nsnull, NS_VMREFRESH_NO_SYNC);
|
UpdateView(parentView, NS_VMREFRESH_NO_SYNC);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2003,7 +1934,7 @@ NS_IMETHODIMP nsViewManager :: SetViewVisibility(nsIView *aView, nsViewVisibilit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
UpdateView(aView, nsnull, NS_VMREFRESH_NO_SYNC);
|
UpdateView(aView, NS_VMREFRESH_NO_SYNC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -2144,7 +2075,7 @@ NS_IMETHODIMP nsViewManager :: SetViewContentTransparency(nsIView *aView, PRBool
|
||||||
UpdateTransCnt(aView, nsnull);
|
UpdateTransCnt(aView, nsnull);
|
||||||
aView->SetContentTransparency(aTransparent);
|
aView->SetContentTransparency(aTransparent);
|
||||||
UpdateTransCnt(nsnull, aView);
|
UpdateTransCnt(nsnull, aView);
|
||||||
UpdateView(aView, nsnull, NS_VMREFRESH_NO_SYNC);
|
UpdateView(aView, NS_VMREFRESH_NO_SYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -2161,7 +2092,7 @@ NS_IMETHODIMP nsViewManager :: SetViewOpacity(nsIView *aView, float aOpacity)
|
||||||
UpdateTransCnt(aView, nsnull);
|
UpdateTransCnt(aView, nsnull);
|
||||||
aView->SetOpacity(aOpacity);
|
aView->SetOpacity(aOpacity);
|
||||||
UpdateTransCnt(nsnull, aView);
|
UpdateTransCnt(nsnull, aView);
|
||||||
UpdateView(aView, nsnull, NS_VMREFRESH_NO_SYNC);
|
UpdateView(aView, NS_VMREFRESH_NO_SYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -2312,68 +2243,24 @@ nsIRenderingContext * nsViewManager :: CreateRenderingContext(nsIView &aView)
|
||||||
return cx;
|
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
|
void nsViewManager::AddRectToDirtyRegion(nsIView* aView, const nsRect &aRect) const
|
||||||
{
|
{
|
||||||
// Get the dirty region associated with the view
|
// Find a view with an associated widget. We'll transform this rect from the
|
||||||
nsIRegion *dirtyRegion;
|
// 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);
|
// Get the dirty region associated with the widget view
|
||||||
|
nsCOMPtr<nsIRegion> dirtyRegion;
|
||||||
if (nsnull == dirtyRegion) {
|
if (NS_SUCCEEDED(widgetView->GetDirtyRegion(*getter_AddRefs(dirtyRegion)))) {
|
||||||
// The view doesn't have a dirty region so create one
|
// add this rect to the widget view's dirty region.
|
||||||
nsresult rv = nsComponentManager::CreateInstance(kRegionCID,
|
dirtyRegion->Union(widgetRect.x, widgetRect.y, widgetRect.width, widgetRect.height);
|
||||||
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(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)
|
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)
|
void nsViewManager :: ComputeViewOffset(nsIView *aView, nscoord *aX, nscoord *aY, PRInt32 aFlag)
|
||||||
{
|
{
|
||||||
nsIView *parent;
|
nsIView *parent;
|
||||||
|
@ -2868,7 +2677,6 @@ PRBool nsViewManager :: DoesViewHaveNativeWidget(nsIView &aView)
|
||||||
void *nativewidget;
|
void *nativewidget;
|
||||||
|
|
||||||
nativewidget = widget->GetNativeData(NS_NATIVE_WIDGET);
|
nativewidget = widget->GetNativeData(NS_NATIVE_WIDGET);
|
||||||
|
|
||||||
NS_RELEASE(widget);
|
NS_RELEASE(widget);
|
||||||
|
|
||||||
if (nsnull != nativewidget)
|
if (nsnull != nativewidget)
|
||||||
|
@ -2889,3 +2697,30 @@ void nsViewManager :: RestartTimer(void)
|
||||||
{
|
{
|
||||||
SetFrameRate(mTrueFrameRate);
|
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 nsISupportsArray;
|
||||||
|
|
||||||
class nsViewManager : public nsIViewManager
|
class nsViewManager : public nsIViewManager {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
nsViewManager();
|
nsViewManager();
|
||||||
|
|
||||||
|
@ -61,8 +60,7 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD Composite(void);
|
NS_IMETHOD Composite(void);
|
||||||
|
|
||||||
NS_IMETHOD UpdateView(nsIView *aView, nsIRegion *aRegion,
|
NS_IMETHOD UpdateView(nsIView *aView, PRUint32 aUpdateFlags);
|
||||||
PRUint32 aUpdateFlags);
|
|
||||||
NS_IMETHOD UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags);
|
NS_IMETHOD UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags);
|
||||||
NS_IMETHOD UpdateAllViews(PRUint32 aUpdateFlags);
|
NS_IMETHOD UpdateAllViews(PRUint32 aUpdateFlags);
|
||||||
|
|
||||||
|
@ -121,8 +119,8 @@ public:
|
||||||
NS_IMETHOD BeginUpdateViewBatch(void);
|
NS_IMETHOD BeginUpdateViewBatch(void);
|
||||||
NS_IMETHOD EndUpdateViewBatch(void);
|
NS_IMETHOD EndUpdateViewBatch(void);
|
||||||
|
|
||||||
NS_IMETHOD SetRootScrollableView(nsIScrollableView *aScrollable);
|
NS_IMETHOD SetRootScrollableView(nsIScrollableView *aScrollable);
|
||||||
NS_IMETHOD GetRootScrollableView(nsIScrollableView **aScrollable);
|
NS_IMETHOD GetRootScrollableView(nsIScrollableView **aScrollable);
|
||||||
|
|
||||||
nsDrawingSurface GetDrawingSurface(nsIRenderingContext &aContext, nsRect& aBounds);
|
nsDrawingSurface GetDrawingSurface(nsIRenderingContext &aContext, nsRect& aBounds);
|
||||||
|
|
||||||
|
@ -135,37 +133,50 @@ protected:
|
||||||
virtual ~nsViewManager();
|
virtual ~nsViewManager();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsIRenderingContext *CreateRenderingContext(nsIView &aView);
|
nsIRenderingContext *CreateRenderingContext(nsIView &aView);
|
||||||
void AddRegionToDirtyRegion(nsIView* aView, const nsIRegion *aRegion) const;
|
void AddRectToDirtyRegion(nsIView* aView, const nsRect &aRect) const;
|
||||||
void AddRectToDirtyRegion(nsIView* aView, const nsRect &aRect) const;
|
void UpdateDirtyViews(nsIView *aView, nsRect *aParentRect) const;
|
||||||
void UpdateDirtyViews(nsIView *aView, nsRect *aParentRect) const;
|
void UpdateTransCnt(nsIView *oldview, nsIView *newview);
|
||||||
void UpdateTransCnt(nsIView *oldview, nsIView *newview);
|
|
||||||
|
|
||||||
void ProcessPendingUpdates(nsIView *aView);
|
void ProcessPendingUpdates(nsIView *aView);
|
||||||
void UpdateViews(nsIView *aView, PRUint32 aUpdateFlags);
|
void UpdateViews(nsIView *aView, PRUint32 aUpdateFlags);
|
||||||
|
|
||||||
void Refresh(nsIView *aView, nsIRenderingContext *aContext,
|
void Refresh(nsIView *aView, nsIRenderingContext *aContext,
|
||||||
nsIRegion *region, PRUint32 aUpdateFlags);
|
nsIRegion *region, PRUint32 aUpdateFlags);
|
||||||
void Refresh(nsIView* aView, nsIRenderingContext *aContext,
|
void Refresh(nsIView* aView, nsIRenderingContext *aContext,
|
||||||
const nsRect *rect, PRUint32 aUpdateFlags);
|
const nsRect *rect, PRUint32 aUpdateFlags);
|
||||||
void RenderViews(nsIView *aRootView, nsIRenderingContext& aRC, const nsRect& aRect,
|
void RenderViews(nsIView *aRootView, nsIRenderingContext& aRC, const nsRect& aRect,
|
||||||
PRBool &aResult);
|
PRBool &aResult);
|
||||||
void RenderView(nsIView *aView, nsIRenderingContext &aRC,
|
void RenderView(nsIView *aView, nsIRenderingContext &aRC,
|
||||||
const nsRect &aDamageRect, nsRect &aGlobalRect, PRBool &aResult);
|
const nsRect &aDamageRect, nsRect &aGlobalRect, PRBool &aResult);
|
||||||
PRBool CreateDisplayList(nsIView *aView, PRInt32 *aIndex, nscoord aOriginX, nscoord aOriginY,
|
PRBool CreateDisplayList(nsIView *aView, PRInt32 *aIndex, nscoord aOriginX, nscoord aOriginY,
|
||||||
nsIView *aRealView, const nsRect *aDamageRect = nsnull,
|
nsIView *aRealView, const nsRect *aDamageRect = nsnull,
|
||||||
nsIView *aTopView = nsnull, nsVoidArray *aArray = nsnull,
|
nsIView *aTopView = nsnull, nsVoidArray *aArray = nsnull,
|
||||||
nscoord aX = 0, nscoord aY = 0);
|
nscoord aX = 0, nscoord aY = 0);
|
||||||
// void FlattenViewTreeUp(nsIView *aView, PRInt32 *aIndex, const nsRect *aDamageRect,
|
PRBool AddToDisplayList(nsVoidArray *aArray, PRInt32 *aIndex,
|
||||||
// nsIView *aStartView, nsVoidArray *aArray);
|
nsIView *aView, nsRect &aRect, PRUint32 aFlags);
|
||||||
PRBool AddToDisplayList(nsVoidArray *aArray, PRInt32 *aIndex,
|
void ShowDisplayList(PRInt32 flatlen);
|
||||||
nsIView *aView, nsRect &aRect, PRUint32 aFlags);
|
void ComputeViewOffset(nsIView *aView, nscoord *aX, nscoord *aY, PRInt32 aFlag);
|
||||||
void ShowDisplayList(PRInt32 flatlen);
|
PRBool DoesViewHaveNativeWidget(nsIView &aView);
|
||||||
void ComputeViewOffset(nsIView *aView, nscoord *aX, nscoord *aY, PRInt32 aFlag);
|
void PauseTimer(void);
|
||||||
PRBool DoesViewHaveNativeWidget(nsIView &aView);
|
void RestartTimer(void);
|
||||||
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;
|
nsIDeviceContext *mContext;
|
||||||
nsIViewObserver *mObserver;
|
nsIViewObserver *mObserver;
|
||||||
nsIWidget *mRootWindow;
|
nsIWidget *mRootWindow;
|
||||||
|
|
|
@ -1778,7 +1778,7 @@ nsWebShell::SetZoom(float aZoom)
|
||||||
sv->ComputeScrollOffsets();
|
sv->ComputeScrollOffsets();
|
||||||
vm->GetRootView(rootview);
|
vm->GetRootView(rootview);
|
||||||
if (nsnull != rootview)
|
if (nsnull != rootview)
|
||||||
vm->UpdateView(rootview, nsnull, 0);
|
vm->UpdateView(rootview, 0);
|
||||||
NS_RELEASE(vm);
|
NS_RELEASE(vm);
|
||||||
}
|
}
|
||||||
NS_RELEASE(shell);
|
NS_RELEASE(shell);
|
||||||
|
|
|
@ -886,7 +886,7 @@ NS_IMETHODIMP nsBrowserWindow::ForceRefresh()
|
||||||
nsIView* root;
|
nsIView* root;
|
||||||
vm->GetRootView(root);
|
vm->GetRootView(root);
|
||||||
if (nsnull != root) {
|
if (nsnull != root) {
|
||||||
vm->UpdateView(root, (nsIRegion*)nsnull, NS_VMREFRESH_IMMEDIATE);
|
vm->UpdateView(root, NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NS_RELEASE(shell);
|
NS_RELEASE(shell);
|
||||||
|
|
|
@ -277,7 +277,7 @@ nsWebCrawler::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
||||||
if (vm) {
|
if (vm) {
|
||||||
nsIView* rootView;
|
nsIView* rootView;
|
||||||
vm->GetRootView(rootView);
|
vm->GetRootView(rootView);
|
||||||
vm->UpdateView(rootView, nsnull, NS_VMREFRESH_IMMEDIATE);
|
vm->UpdateView(rootView, NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
|
|
|
@ -261,8 +261,7 @@ void nsXPBaseWindow::ForceRefresh()
|
||||||
nsIView* root;
|
nsIView* root;
|
||||||
vm->GetRootView(root);
|
vm->GetRootView(root);
|
||||||
if (nsnull != root) {
|
if (nsnull != root) {
|
||||||
vm->UpdateView(root, (nsIRegion*)nsnull, NS_VMREFRESH_IMMEDIATE |
|
vm->UpdateView(root, NS_VMREFRESH_IMMEDIATE | NS_VMREFRESH_AUTO_DOUBLE_BUFFER);
|
||||||
NS_VMREFRESH_AUTO_DOUBLE_BUFFER);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NS_RELEASE(shell);
|
NS_RELEASE(shell);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче