Bug 506304. Walk all the way up to the nearest widget when computing event coordinates for windowless plugins. r=bz
This commit is contained in:
@@ -1045,23 +1045,9 @@ nsIntPoint nsObjectFrame::GetWindowOriginInPixels(PRBool aWindowless)
|
|||||||
// if it's windowless, let's make sure we have our origin set right
|
// if it's windowless, let's make sure we have our origin set right
|
||||||
// it may need to be corrected, like after scrolling
|
// it may need to be corrected, like after scrolling
|
||||||
if (aWindowless && parentWithView) {
|
if (aWindowless && parentWithView) {
|
||||||
// XXX Should this be replaced by nsIView::GetNearestWidget?
|
nsPoint offsetToWidget;
|
||||||
// The implementation below doesn't handle cases where the widget's origin
|
parentWithView->GetNearestWidget(&offsetToWidget);
|
||||||
// doesn't coincide with its view's origin.
|
origin += offsetToWidget;
|
||||||
|
|
||||||
nsIViewManager* parentVM = parentWithView->GetViewManager();
|
|
||||||
|
|
||||||
// Walk up all the views and add up their positions until we
|
|
||||||
// reach the first view with a window (non-null widget). This will give us our
|
|
||||||
// position relative to the containing window which is what we want to give the plugin
|
|
||||||
nsIView* theView = parentWithView;
|
|
||||||
while (theView && !theView->GetWidget()) {
|
|
||||||
if (theView->GetViewManager() != parentVM)
|
|
||||||
break;
|
|
||||||
|
|
||||||
origin += theView->GetPosition();
|
|
||||||
theView = theView->GetParent();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nsIntPoint(PresContext()->AppUnitsToDevPixels(origin.x),
|
return nsIntPoint(PresContext()->AppUnitsToDevPixels(origin.x),
|
||||||
|
|||||||
Reference in New Issue
Block a user