Bug 258175. Always capture the mouse at the root of the document if we haven't captured it in any child. r+sr=bzbarsky

This commit is contained in:
roc+%cs.cmu.edu 2004-09-21 13:58:22 +00:00
Родитель ca479a7c10
Коммит ed606a4d5d
2 изменённых файлов: 12 добавлений и 10 удалений

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

@ -1667,14 +1667,15 @@ nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack,
// Figure out which view we should point capturing at, given that drag started // Figure out which view we should point capturing at, given that drag started
// in this frame. // in this frame.
static nsIView* GetNearestCapturingView(nsIFrame* aFrame) { static nsIView* GetNearestCapturingView(nsIFrame* aFrame) {
nsIView* view; nsIView* view = nsnull;
while (aFrame && !(view = aFrame->GetMouseCapturer())) { while (!(view = aFrame->GetMouseCapturer()) && aFrame->GetParent()) {
aFrame = aFrame->GetParent(); aFrame = aFrame->GetParent();
} }
if (!aFrame) { if (!view) {
return nsnull; // Use the root view. The root frame always has the root view.
view = aFrame->GetView();
} }
NS_ASSERTION(view, "No capturing view found");
return view; return view;
} }

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

@ -1667,14 +1667,15 @@ nsFrame::PeekBackwardAndForward(nsSelectionAmount aAmountBack,
// Figure out which view we should point capturing at, given that drag started // Figure out which view we should point capturing at, given that drag started
// in this frame. // in this frame.
static nsIView* GetNearestCapturingView(nsIFrame* aFrame) { static nsIView* GetNearestCapturingView(nsIFrame* aFrame) {
nsIView* view; nsIView* view = nsnull;
while (aFrame && !(view = aFrame->GetMouseCapturer())) { while (!(view = aFrame->GetMouseCapturer()) && aFrame->GetParent()) {
aFrame = aFrame->GetParent(); aFrame = aFrame->GetParent();
} }
if (!aFrame) { if (!view) {
return nsnull; // Use the root view. The root frame always has the root view.
view = aFrame->GetView();
} }
NS_ASSERTION(view, "No capturing view found");
return view; return view;
} }