Bug 829886. Implement GetClientBounds for nsChildViews on Mac so that it returns correct values. r=smichaud

This has the side effect of making clicks on transformed select dropdowns to work.
This commit is contained in:
Timothy Nikkel 2013-01-15 14:47:42 -06:00
parent b48fe04ebd
commit f2649622e7
2 changed files with 13 additions and 0 deletions

View File

@ -388,6 +388,7 @@ public:
virtual bool IsEnabled() const;
NS_IMETHOD SetFocus(bool aRaise);
NS_IMETHOD GetBounds(nsIntRect &aRect);
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
// Returns the "backing scale factor" of the view's window, which is the
// ratio of pixels in the window's backing store to Cocoa points. Prior to

View File

@ -742,6 +742,18 @@ NS_IMETHODIMP nsChildView::GetBounds(nsIntRect &aRect)
return NS_OK;
}
NS_IMETHODIMP nsChildView::GetClientBounds(nsIntRect &aRect)
{
GetBounds(aRect);
if (!mParentWidget) {
// For top level widgets we want the position on screen, not the position
// of this view inside the window.
MOZ_ASSERT(mWindowType != eWindowType_plugin, "plugin widgets should have parents");
aRect.MoveTo(WidgetToScreenOffset());
}
return NS_OK;
}
double
nsChildView::GetDefaultScaleInternal()
{