Bug 454959. When a document is in a floating view, floating-ness doesn't propagate across view manager boundaries. So use the display-root view as the place to invalidate from. r+sr=bzbarsky

This commit is contained in:
Robert O'Callahan 2008-11-26 11:09:37 +13:00
Родитель 94d689d854
Коммит 7a907f23ca
2 изменённых файлов: 6 добавлений и 50 удалений

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

@ -894,28 +894,12 @@ NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, const nsRect &aRect, PRU
return NS_OK;
}
// if this is a floating view, it isn't covered by any widgets other than
// its children. In that case we walk up to its parent widget and use
// that as the root to update from. This also means we update areas that
// may be outside the parent view(s), which is necessary for floats.
if (view->GetFloating()) {
nsView* widgetParent = view;
while (!widgetParent->HasWidget()) {
widgetParent->ConvertToParentCoords(&damagedRect.x, &damagedRect.y);
widgetParent = widgetParent->GetParent();
}
UpdateWidgetArea(widgetParent, nsRegion(damagedRect), nsnull);
} else {
// Propagate the update to the root widget of the root view manager, since
// iframes, for example, can overlap each other and be translucent. So we
// have to possibly invalidate our rect in each of the widgets we have
// lying about.
damagedRect.MoveBy(ComputeViewOffset(view));
UpdateWidgetArea(RootViewManager()->GetRootView(), nsRegion(damagedRect), nsnull);
}
nsView* displayRoot = GetDisplayRootFor(view);
// Propagate the update to the displayRoot, since iframes, for example,
// can overlap each other and be translucent. So we have to possibly
// invalidate our rect in each of the widgets we have lying about.
damagedRect.MoveBy(view->GetOffsetTo(displayRoot));
UpdateWidgetArea(displayRoot, nsRegion(damagedRect), nsnull);
RootViewManager()->IncrementUpdateCount();
@ -2029,29 +2013,6 @@ NS_IMETHODIMP nsViewManager::ForceUpdate()
return NS_OK;
}
nsPoint nsViewManager::ComputeViewOffset(const nsView *aView)
{
NS_PRECONDITION(aView, "Null view in ComputeViewOffset?");
nsPoint origin(0, 0);
#ifdef DEBUG
const nsView* rootView;
const nsView* origView = aView;
#endif
while (aView) {
#ifdef DEBUG
rootView = aView;
#endif
origin += aView->GetPosition();
aView = aView->GetParent();
}
NS_ASSERTION(rootView ==
origView->GetViewManager()->RootViewManager()->GetRootView(),
"Unexpected root view");
return origin;
}
void nsViewManager::ViewToWidget(nsView *aView, nsView* aWidgetView, nsRect &aRect) const
{
while (aView != aWidgetView) {

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

@ -416,11 +416,6 @@ public: // NOT in nsIViewManager, so private to the view module
nsresult CreateRegion(nsIRegion* *result);
// return the sum of all view offsets from aView right up to the
// root of this view hierarchy (the view with no parent, which might
// not be in this view manager).
static nsPoint ComputeViewOffset(const nsView *aView);
PRBool IsRefreshEnabled() { return RootViewManager()->mRefreshEnabled; }
nsIViewObserver* GetViewObserver() { return mObserver; }