Bug 598482 part 20 - Rename Update to Invalidate; view updates are now always asynchronous. r=roc

This commit is contained in:
Markus Stange 2011-12-23 22:52:25 -05:00
Родитель 4303a5be98
Коммит 2d49769823
9 изменённых файлов: 52 добавлений и 53 удалений

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

@ -4732,7 +4732,7 @@ nsDocShell::Repaint(bool aForce)
nsIViewManager* viewManager = presShell->GetViewManager();
NS_ENSURE_TRUE(viewManager, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(viewManager->UpdateAllViews(), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(viewManager->InvalidateAllViews(), NS_ERROR_FAILURE);
return NS_OK;
}
@ -7323,7 +7323,7 @@ nsDocShell::RestoreFromHistory()
// call Thaw. So we issue the invalidate here.
newRootView = newVM->GetRootView();
if (newRootView) {
newVM->UpdateView(newRootView);
newVM->InvalidateView(newRootView);
}
}
}

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

@ -1554,7 +1554,7 @@ DocumentViewerImpl::Destroy()
// The invalidate that removing this view causes is dropped because
// the Freeze call above sets painting to be suppressed for our
// document. So we do it ourselves and make it happen.
vm->UpdateViewNoSuppression(rootView,
vm->InvalidateViewNoSuppression(rootView,
rootView->GetBounds() - rootView->GetPosition());
nsIView *rootViewParent = rootView->GetParent();

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

@ -7371,7 +7371,7 @@ PresShell::DoVerifyReflow()
// First synchronously render what we have so far so that we can
// see it.
nsIView* rootView = mViewManager->GetRootView();
mViewManager->UpdateView(rootView);
mViewManager->InvalidateView(rootView);
FlushPendingNotifications(Flush_Layout);
mInVerifyReflow = true;

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

@ -4659,7 +4659,7 @@ nsIFrame::InvalidateRoot(const nsRect& aDamageRect, PRUint32 aFlags)
nsIView* view = GetView();
NS_ASSERTION(view, "This can only be called on frames with views");
view->GetViewManager()->UpdateViewNoSuppression(view, rect);
view->GetViewManager()->InvalidateViewNoSuppression(view, rect);
}
void

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

@ -562,7 +562,7 @@ void nsLayoutDebuggingTools::ForceRefresh()
return;
nsIView* root = vm->GetRootView();
if (root) {
vm->UpdateView(root);
vm->InvalidateView(root);
}
}

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

@ -121,7 +121,7 @@ public:
* is dirty and needs to be redrawn.
* @param aView view to paint. should be root view
*/
NS_IMETHOD UpdateView(nsIView *aView) = 0;
NS_IMETHOD InvalidateView(nsIView *aView) = 0;
/**
* Called to inform the view manager that some portion of a view is dirty and
@ -130,13 +130,12 @@ public:
* @param aView view to paint. should be root view
* @param rect rect to mark as damaged
*/
NS_IMETHOD UpdateViewNoSuppression(nsIView *aView, const nsRect &aRect) = 0;
NS_IMETHOD InvalidateViewNoSuppression(nsIView *aView, const nsRect &aRect) = 0;
/**
* Called to inform the view manager that it should redraw all views.
* @param aView view to paint. should be root view
* Called to inform the view manager that it should invalidate all views.
*/
NS_IMETHOD UpdateAllViews() = 0;
NS_IMETHOD InvalidateAllViews() = 0;
/**
* Called to dispatch an event to the appropriate view. Often called

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

@ -375,7 +375,7 @@ void nsViewManager::Refresh(nsView *aView, nsIWidget *aWidget,
if (RootViewManager()->mRecursiveRefreshPending) {
RootViewManager()->mRecursiveRefreshPending = false;
UpdateAllViews();
InvalidateAllViews();
}
}
@ -437,14 +437,14 @@ void nsViewManager::FlushDirtyRegionToWidget(nsView* aView)
nsRegion r =
ConvertRegionBetweenViews(*dirtyRegion, aView, nearestViewWithWidget);
nsViewManager* widgetVM = nearestViewWithWidget->GetViewManager();
widgetVM->UpdateWidgetArea(nearestViewWithWidget, r);
widgetVM->InvalidateWidgetArea(nearestViewWithWidget, r);
dirtyRegion->SetEmpty();
}
NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView)
NS_IMETHODIMP nsViewManager::InvalidateView(nsIView *aView)
{
// Mark the entire view as damaged
return UpdateView(aView, aView->GetDimensions());
return InvalidateView(aView, aView->GetDimensions());
}
static void
@ -474,16 +474,16 @@ nsViewManager::PostPendingUpdate()
* every widget child of aWidgetView, plus aWidgetView's own widget
*/
void
nsViewManager::UpdateWidgetArea(nsView *aWidgetView,
const nsRegion &aDamagedRegion)
nsViewManager::InvalidateWidgetArea(nsView *aWidgetView,
const nsRegion &aDamagedRegion)
{
NS_ASSERTION(aWidgetView->GetViewManager() == this,
"UpdateWidgetArea called on view we don't own");
"InvalidateWidgetArea called on view we don't own");
nsIWidget* widget = aWidgetView->GetWidget();
#if 0
nsRect dbgBounds = aDamagedRegion.GetBounds();
printf("UpdateWidgetArea view:%X (%d) widget:%X region: %d, %d, %d, %d\n",
printf("InvalidateWidgetArea view:%X (%d) widget:%X region: %d, %d, %d, %d\n",
aWidgetView, aWidgetView->IsAttachedToTopLevel(),
widget, dbgBounds.x, dbgBounds.y, dbgBounds.width, dbgBounds.height);
#endif
@ -576,7 +576,7 @@ ShouldIgnoreInvalidation(nsViewManager* aVM)
return false;
}
nsresult nsViewManager::UpdateView(nsIView *aView, const nsRect &aRect)
nsresult nsViewManager::InvalidateView(nsIView *aView, const nsRect &aRect)
{
// If painting is suppressed in the presshell or an ancestor drop all
// invalidates, it will invalidate everything when it unsuppresses.
@ -584,18 +584,18 @@ nsresult nsViewManager::UpdateView(nsIView *aView, const nsRect &aRect)
return NS_OK;
}
return UpdateViewNoSuppression(aView, aRect);
return InvalidateViewNoSuppression(aView, aRect);
}
NS_IMETHODIMP nsViewManager::UpdateViewNoSuppression(nsIView *aView,
const nsRect &aRect)
NS_IMETHODIMP nsViewManager::InvalidateViewNoSuppression(nsIView *aView,
const nsRect &aRect)
{
NS_PRECONDITION(nsnull != aView, "null view");
nsView* view = static_cast<nsView*>(aView);
NS_ASSERTION(view->GetViewManager() == this,
"UpdateView called on view we don't own");
"InvalidateViewNoSuppression called on view we don't own");
nsRect damagedRect(aRect);
if (damagedRect.IsEmpty()) {
@ -622,25 +622,25 @@ NS_IMETHODIMP nsViewManager::UpdateViewNoSuppression(nsIView *aView,
return NS_OK;
}
NS_IMETHODIMP nsViewManager::UpdateAllViews()
NS_IMETHODIMP nsViewManager::InvalidateAllViews()
{
if (RootViewManager() != this) {
return RootViewManager()->UpdateAllViews();
return RootViewManager()->InvalidateAllViews();
}
UpdateViews(mRootView);
InvalidateViews(mRootView);
return NS_OK;
}
void nsViewManager::UpdateViews(nsView *aView)
void nsViewManager::InvalidateViews(nsView *aView)
{
// update this view.
UpdateView(aView);
// Invalidate this view.
InvalidateView(aView);
// update all children as well.
// Invalidate all children as well.
nsView* childView = aView->GetFirstChild();
while (nsnull != childView) {
childView->GetViewManager()->UpdateViews(childView);
childView->GetViewManager()->InvalidateViews(childView);
childView = childView->GetNextSibling();
}
}
@ -775,7 +775,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent,
vm->mRootView->IsEffectivelyVisible() &&
mPresShell && mPresShell->IsVisible()) {
vm->FlushDelayedResize(true);
vm->UpdateView(vm->mRootView);
vm->InvalidateView(vm->mRootView);
}
}
@ -1071,7 +1071,7 @@ NS_IMETHODIMP nsViewManager::InsertChild(nsIView *aParent, nsIView *aChild, nsIV
//and mark this area as dirty if the view is visible...
if (nsViewVisibility_kHide != child->GetVisibility())
child->GetViewManager()->UpdateView(child);
child->GetViewManager()->InvalidateView(child);
}
return NS_OK;
}
@ -1094,7 +1094,7 @@ NS_IMETHODIMP nsViewManager::RemoveChild(nsIView *aChild)
if (nsnull != parent) {
NS_ASSERTION(child->GetViewManager() == this ||
parent->GetViewManager() == this, "wrong view manager");
child->GetViewManager()->UpdateView(child);
child->GetViewManager()->InvalidateView(child);
parent->RemoveChild(child);
}
@ -1116,8 +1116,8 @@ NS_IMETHODIMP nsViewManager::MoveViewTo(nsIView *aView, nscoord aX, nscoord aY)
nsView* parentView = view->GetParent();
if (parentView) {
nsViewManager* parentVM = parentView->GetViewManager();
parentVM->UpdateView(parentView, oldBounds);
parentVM->UpdateView(parentView, view->GetBoundsInParentUnits());
parentVM->InvalidateView(parentView, oldBounds);
parentVM->InvalidateView(parentView, view->GetBoundsInParentUnits());
}
}
}
@ -1129,15 +1129,15 @@ void nsViewManager::InvalidateHorizontalBandDifference(nsView *aView, const nsRe
nscoord height = aY2 - aY1;
if (aRect.x < aCutOut.x) {
nsRect r(aRect.x, aY1, aCutOut.x - aRect.x, height);
UpdateView(aView, r);
InvalidateView(aView, r);
}
if (!aInCutOut && aCutOut.x < aCutOut.XMost()) {
nsRect r(aCutOut.x, aY1, aCutOut.width, height);
UpdateView(aView, r);
InvalidateView(aView, r);
}
if (aCutOut.XMost() < aRect.XMost()) {
nsRect r(aCutOut.XMost(), aY1, aRect.XMost() - aCutOut.XMost(), height);
UpdateView(aView, r);
InvalidateView(aView, r);
}
}
@ -1175,9 +1175,9 @@ NS_IMETHODIMP nsViewManager::ResizeView(nsIView *aView, const nsRect &aRect, boo
view->SetDimensions(aRect, true);
nsViewManager* parentVM = parentView->GetViewManager();
if (!aRepaintExposedAreaOnly) {
//Invalidate the union of the old and new size
UpdateView(view, aRect);
parentVM->UpdateView(parentView, oldBounds);
// Invalidate the union of the old and new size
InvalidateView(view, aRect);
parentVM->InvalidateView(parentView, oldBounds);
} else {
InvalidateRectDifference(view, aRect, oldDimensions);
nsRect newBounds = view->GetBoundsInParentUnits();
@ -1220,11 +1220,11 @@ NS_IMETHODIMP nsViewManager::SetViewVisibility(nsIView *aView, nsViewVisibility
nsView* parentView = view->GetParent();
if (parentView) {
parentView->GetViewManager()->
UpdateView(parentView, view->GetBoundsInParentUnits());
InvalidateView(parentView, view->GetBoundsInParentUnits());
}
}
else {
UpdateView(view);
InvalidateView(view);
}
}
}
@ -1275,7 +1275,7 @@ NS_IMETHODIMP nsViewManager::SetViewZIndex(nsIView *aView, bool aAutoZIndex, PRI
if (oldidx != aZIndex || oldTopMost != aTopMost ||
oldIsAuto != aAutoZIndex) {
UpdateView(view);
InvalidateView(view);
}
return rv;

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

@ -102,9 +102,9 @@ public:
NS_IMETHOD SetWindowDimensions(nscoord width, nscoord height);
NS_IMETHOD FlushDelayedResize(bool aDoReflow);
NS_IMETHOD UpdateView(nsIView *aView);
NS_IMETHOD UpdateViewNoSuppression(nsIView *aView, const nsRect &aRect);
NS_IMETHOD UpdateAllViews();
NS_IMETHOD InvalidateView(nsIView *aView);
NS_IMETHOD InvalidateViewNoSuppression(nsIView *aView, const nsRect &aRect);
NS_IMETHOD InvalidateAllViews();
NS_IMETHOD DispatchEvent(nsGUIEvent *aEvent,
nsIView* aTargetView, nsEventStatus* aStatus);
@ -163,9 +163,9 @@ private:
void CallDidPaintOnObservers();
void ReparentChildWidgets(nsIView* aView, nsIWidget *aNewWidget);
void ReparentWidgets(nsIView* aView, nsIView *aParent);
void UpdateWidgetArea(nsView *aWidgetView, const nsRegion &aDamagedRegion);
void InvalidateWidgetArea(nsView *aWidgetView, const nsRegion &aDamagedRegion);
void UpdateViews(nsView *aView);
void InvalidateViews(nsView *aView);
// aView is the view for aWidget and aRegion is relative to aWidget.
void Refresh(nsView *aView, nsIWidget *aWidget, const nsIntRegion& aRegion);
@ -200,7 +200,7 @@ private:
RootViewManager()->mPainting = aPainting;
}
nsresult UpdateView(nsIView *aView, const nsRect &aRect);
nsresult InvalidateView(nsIView *aView, const nsRect &aRect);
public: // NOT in nsIViewManager, so private to the view module
nsView* GetRootViewImpl() const { return mRootView; }

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

@ -116,7 +116,7 @@ nsNativeThemeGTK::RefreshWidgetWindow(nsIFrame* aFrame)
if (!vm)
return;
vm->UpdateAllViews();
vm->InvalidateAllViews();
}
static bool IsFrameContentNodeInNamespace(nsIFrame *aFrame, PRUint32 aNamespace)