Force any mouse grabs pointing into the old page to be dropped when we cache the page in session history. Bug 304288, r+sr=roc.

This commit is contained in:
bryner%brianryner.com 2005-08-23 21:52:59 +00:00
Родитель 32dfdd4827
Коммит a13ee2622a
2 изменённых файлов: 18 добавлений и 6 удалений

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

@ -491,13 +491,22 @@ NS_IMETHODIMP nsView::SetFloating(PRBool aFloatingView)
return NS_OK;
}
void nsView::InvalidateHierarchy()
void nsView::InvalidateHierarchy(nsViewManager *aViewManagerParent)
{
if (aViewManagerParent) {
// We're removed from the view hierarchy of aRemovalPoint, so make sure
// we're not still grabbing mouse events.
if (aViewManagerParent->GetMouseEventGrabber() == this) {
PRBool res;
aViewManagerParent->GrabMouseEvents(nsnull, res);
}
}
if (mViewManager->GetRootView() == this)
mViewManager->InvalidateHierarchy();
for (nsView *child = mFirstChild; child; child = child->GetNextSibling())
child->InvalidateHierarchy();
child->InvalidateHierarchy(aViewManagerParent);
}
void nsView::InsertChild(nsView *aChild, nsView *aSibling)
@ -528,7 +537,7 @@ void nsView::InsertChild(nsView *aChild, nsView *aSibling)
nsViewManager *vm = aChild->GetViewManager();
if (vm->GetRootView() == aChild)
{
aChild->InvalidateHierarchy();
aChild->InvalidateHierarchy(nsnull); // don't care about releasing grabs
}
}
}
@ -565,7 +574,7 @@ void nsView::RemoveChild(nsView *child)
nsViewManager *vm = child->GetViewManager();
if (vm->GetRootView() == child)
{
child->InvalidateHierarchy();
child->InvalidateHierarchy(GetViewManager());
}
}
}

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

@ -293,8 +293,11 @@ public:
void SetPositionIgnoringChildWidgets(nscoord aX, nscoord aY);
nsresult LoadWidget(const nsCID &aClassIID);
// Update the cached RootViewManager for all view manager descendents.
void InvalidateHierarchy();
// Update the cached RootViewManager for all view manager descendents,
// If the hierarchy is being removed, aViewManagerParent points to the view
// manager for the hierarchy's old parent, and will have its mouse grab
// released if it points to any view in this view hierarchy.
void InvalidateHierarchy(nsViewManager *aViewManagerParent);
virtual ~nsView();