Bug 598482 part 2 - Remove synchronous painting APIs from nsIViewManager. r=roc

This commit is contained in:
Markus Stange 2011-12-23 22:52:21 -05:00
parent 7e54807ba1
commit 1a8fc22417
6 changed files with 1 additions and 139 deletions

View File

@ -654,12 +654,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRegion(NPRegion invalidRegion)
NS_IMETHODIMP nsPluginInstanceOwner::ForceRedraw()
{
NS_ENSURE_TRUE(mObjectFrame, NS_ERROR_NULL_POINTER);
nsIView* view = mObjectFrame->GetView();
if (view) {
return view->GetViewManager()->Composite();
}
return NS_OK;
}

View File

@ -2468,17 +2468,6 @@ PresShell::ScrollLine(bool aForward)
scrollFrame->ScrollBy(nsIntPoint(0, aForward ? lineCount : -lineCount),
nsIScrollableFrame::LINES,
nsIScrollableFrame::SMOOTH);
//NEW FOR LINES
// force the update to happen now, otherwise multiple scrolls can
// occur before the update is processed. (bug #7354)
// I'd use Composite here, but it doesn't always work.
// vm->Composite();
nsIViewManager* viewManager = GetViewManager();
if (viewManager) {
viewManager->ForceUpdate();
}
}
return NS_OK;
}
@ -2492,16 +2481,6 @@ PresShell::ScrollCharacter(bool aRight)
scrollFrame->ScrollBy(nsIntPoint(aRight ? 1 : -1, 0),
nsIScrollableFrame::LINES,
nsIScrollableFrame::SMOOTH);
//NEW FOR LINES
// force the update to happen now, otherwise multiple scrolls can
// occur before the update is processed. (bug #7354)
// I'd use Composite here, but it doesn't always work.
// vm->Composite();
nsIViewManager* viewManager = GetViewManager();
if (viewManager) {
viewManager->ForceUpdate();
}
}
return NS_OK;
}

View File

@ -559,15 +559,6 @@ nsListBoxBodyFrame::ScrollByLines(PRInt32 aNumLines)
ScrollToIndex(scrollIndex);
// we have to do a sync update for mac because if we scroll too quickly
// w/out going back to the main event loop we can easily scroll the wrong
// bits and it looks like garbage (bug 63465).
// XXXbz is this seriously still needed?
// I'd use Composite here, but it doesn't always work.
// vm->Composite();
PresContext()->GetPresShell()->GetViewManager()->ForceUpdate();
return NS_OK;
}

View File

@ -116,16 +116,6 @@ public:
*/
NS_IMETHOD FlushDelayedResize(bool aDoReflow) = 0;
/**
* Called to force a redrawing of any dirty areas.
*/
// XXXbz why is this exposed? Shouldn't update view batches handle this?
// It's not like Composite() does what's expected inside a view update batch
// anyway, since dirty areas may not have been invalidated on the widget yet
// and widget changes may not have been propagated yet. Maybe this should
// call FlushPendingInvalidates()?
NS_IMETHOD Composite(void) = 0;
/**
* Called to inform the view manager that the entire area of a view
* is dirty and needs to be redrawn.
@ -351,16 +341,6 @@ public:
*/
NS_IMETHOD GetRootWidget(nsIWidget **aWidget) = 0;
/**
* Force update of view manager widget
* Callers should use UpdateView(view, NS_VMREFRESH_IMMEDIATE) in most cases instead
* @result error status
*/
// XXXbz Callers seem to be confused about this one... and it doesn't play
// right with view update batching at all (will miss updates). Maybe this
// should call FlushPendingInvalidates()?
NS_IMETHOD ForceUpdate() = 0;
/**
* Indicate whether the viewmanager is currently painting
*

View File

@ -461,17 +461,6 @@ void nsViewManager::ProcessPendingUpdates(nsView* aView, bool aDoInvalidate)
}
}
NS_IMETHODIMP nsViewManager::Composite()
{
if (!IsRootVM()) {
return RootViewManager()->Composite();
}
ForceUpdate();
ClearUpdateCount();
return NS_OK;
}
NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, PRUint32 aUpdateFlags)
{
// Mark the entire view as damaged
@ -657,15 +646,6 @@ NS_IMETHODIMP nsViewManager::UpdateViewNoSuppression(nsIView *aView,
RootViewManager()->IncrementUpdateCount();
if (!IsRefreshEnabled()) {
return NS_OK;
}
// See if we should do an immediate refresh or wait
if (aUpdateFlags & NS_VMREFRESH_IMMEDIATE) {
Composite();
}
return NS_OK;
}
@ -1341,37 +1321,6 @@ NS_IMETHODIMP nsViewManager::SetViewVisibility(nsIView *aView, nsViewVisibility
return NS_OK;
}
void nsViewManager::UpdateWidgetsForView(nsView* aView)
{
NS_PRECONDITION(aView, "Must have view!");
// No point forcing an update if invalidations have been suppressed.
if (!IsRefreshEnabled())
return;
nsWeakView parentWeakView = aView;
if (aView->HasWidget()) {
aView->GetWidget()->Update(); // Flushes Layout!
if (!parentWeakView.IsAlive()) {
return;
}
}
nsView* childView = aView->GetFirstChild();
while (childView) {
nsWeakView childWeakView = childView;
UpdateWidgetsForView(childView);
if (NS_LIKELY(childWeakView.IsAlive())) {
childView = childView->GetNextSibling();
}
else {
// The current view was destroyed - restart at the first child if the
// parent is still alive.
childView = parentWeakView.IsAlive() ? aView->GetFirstChild() : nsnull;
}
}
}
bool nsViewManager::IsViewInserted(nsView *aView)
{
if (mRootView == aView) {
@ -1438,15 +1387,7 @@ void nsViewManager::TriggerRefresh(PRUint32 aUpdateFlags)
if (mUpdateBatchCnt > 0)
return;
// nested batching can combine IMMEDIATE with DEFERRED. Favour
// IMMEDIATE over DEFERRED and DEFERRED over NO_SYNC. We need to
// check for IMMEDIATE before checking mHasPendingUpdates, because
// the latter might be false as far as gecko is concerned but the OS
// might still have queued up expose events that it hasn't sent yet.
if (aUpdateFlags & NS_VMREFRESH_IMMEDIATE) {
FlushPendingInvalidates();
Composite();
} else if (!mHasPendingUpdates) {
if (!mHasPendingUpdates) {
// Nothing to do
} else if (aUpdateFlags & NS_VMREFRESH_DEFERRED) {
PostInvalidateEvent();
@ -1509,20 +1450,6 @@ NS_IMETHODIMP nsViewManager::GetRootWidget(nsIWidget **aWidget)
return NS_OK;
}
NS_IMETHODIMP nsViewManager::ForceUpdate()
{
if (!IsRootVM()) {
return RootViewManager()->ForceUpdate();
}
// Walk the view tree looking for widgets, and call Update() on each one
if (mRootView) {
UpdateWidgetsForView(mRootView);
}
return NS_OK;
}
nsIntRect nsViewManager::ViewToWidget(nsView *aView, const nsRect &aRect) const
{
NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");

View File

@ -104,8 +104,6 @@ public:
NS_IMETHOD SetWindowDimensions(nscoord width, nscoord height);
NS_IMETHOD FlushDelayedResize(bool aDoReflow);
NS_IMETHOD Composite(void);
NS_IMETHOD UpdateView(nsIView *aView, PRUint32 aUpdateFlags);
NS_IMETHOD UpdateViewNoSuppression(nsIView *aView, const nsRect &aRect,
PRUint32 aUpdateFlags);
@ -141,7 +139,6 @@ public:
NS_IMETHOD EndUpdateViewBatch(PRUint32 aUpdateFlags);
NS_IMETHOD GetRootWidget(nsIWidget **aWidget);
NS_IMETHOD ForceUpdate();
NS_IMETHOD IsPainting(bool& aIsPainting);
NS_IMETHOD GetLastUserEventTime(PRUint32& aTime);
@ -189,12 +186,6 @@ private:
bool IsViewInserted(nsView *aView);
/**
* Function to recursively call Update() on all widgets belonging to
* a view or its kids.
*/
void UpdateWidgetsForView(nsView* aView);
/**
* Intersects aRect with aView's bounds and then transforms it from aView's
* coordinate system to the coordinate system of the widget attached to