Bug 501295. pluginGetEdge should return coordinates relative to the window frame in the Win32 test plugin. Then we can enable test_plugin_position on Windows. r=jmathies

This commit is contained in:
Robert O'Callahan 2009-07-10 14:03:00 +12:00
parent 89f34af9f3
commit 8ce8b649b2
2 changed files with 16 additions and 17 deletions

View File

@ -51,12 +51,6 @@ function runTests() {
return;
}
if (navigator.platform.indexOf("Win") >= 0) {
todo(false, "Windows does not support windowed plugins (yet)");
SimpleTest.finish();
return;
}
var bounds = h1.getBoundingClientRect();
windowFrameX = h1.boxObject.screenX - bounds.left - window.screenX;
windowFrameY = h1.boxObject.screenY - bounds.top - window.screenY;

View File

@ -211,24 +211,29 @@ pluginGetEdge(InstanceData* instanceData, RectEdge edge)
if (!instanceData || !instanceData->hasWidget)
return NPTEST_INT32_ERROR;
HWND hWnd = GetAncestor((HWND)instanceData->window.window, GA_ROOT);
if (!hWnd)
return NPTEST_INT32_ERROR;
// Get the plugin client rect in screen coordinates
RECT rect = {0};
GetClientRect((HWND)instanceData->window.window, &rect);
MapWindowPoints((HWND)instanceData->window.window, hWnd, (LPPOINT)&rect, 2);
if (!::GetClientRect((HWND)instanceData->window.window, &rect))
return NPTEST_INT32_ERROR;
::MapWindowPoints((HWND)instanceData->window.window, NULL, (LPPOINT)&rect, 2);
// Get the toplevel window frame rect in screen coordinates
HWND rootWnd = ::GetAncestor((HWND)instanceData->window.window, GA_ROOT);
if (!rootWnd)
return NPTEST_INT32_ERROR;
RECT rootRect;
if (!::GetWindowRect(rootWnd, &rootRect))
return NPTEST_INT32_ERROR;
switch (edge) {
case EDGE_LEFT:
return rect.left;
return rect.left - rootRect.left;
case EDGE_TOP:
return rect.top;
return rect.top - rootRect.top;
case EDGE_RIGHT:
return rect.right;
return rect.right - rootRect.left;
case EDGE_BOTTOM:
return rect.bottom;
return rect.bottom - rootRect.top;
}
return NPTEST_INT32_ERROR;