NPP_SetWindow()'s window->clipRect.top off by 22 pixels in CoreGraphics mode. b=474491 r=josh sr=roc

This commit is contained in:
Steven Michaud 2009-01-23 11:24:27 -06:00
Родитель 0bff11e674
Коммит 0c56a952c0
1 изменённых файлов: 13 добавлений и 2 удалений

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

@ -1316,6 +1316,11 @@ PRBool nsChildView::ShowsResizeIndicator(nsIntRect* aResizerRect)
}
// In QuickDraw mode the coordinate system used here is that of the browser
// window's content region (defined as everything but the 22-pixel high
// titlebar). But in CoreGraphics mode the coordinate system is that of the
// browser window as a whole (including its titlebar). Both coordinate
// systems have a top-left origin. See bmo bug 474491.
NS_IMETHODIMP nsChildView::GetPluginClipRect(nsIntRect& outClipRect, nsIntPoint& outOrigin, PRBool& outWidgetVisible)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -1327,14 +1332,20 @@ NS_IMETHODIMP nsChildView::GetPluginClipRect(nsIntRect& outClipRect, nsIntPoint&
if (!window) return NS_ERROR_FAILURE;
NSPoint viewOrigin = [mView convertPoint:NSZeroPoint toView:nil];
NSRect frame = [[window contentView] frame];
NSRect frame;
if (mPluginIsCG) {
frame = [window frame];
frame.origin.x = frame.origin.y = 0;
} else {
frame = [[window contentView] frame];
}
viewOrigin.y = frame.size.height - viewOrigin.y;
// set up the clipping region for plugins.
NSRect visibleBounds = [mView visibleRect];
NSPoint clipOrigin = [mView convertPoint:visibleBounds.origin toView:nil];
// Convert from cocoa to QuickDraw coordinates
// Convert from cocoa to QuickDraw/CoreGraphics coordinates
clipOrigin.y = frame.size.height - clipOrigin.y;
outClipRect.x = NSToIntRound(clipOrigin.x);