Bug 539955 - [OOPP] unit test failure in test_plugin_mouse_coords.html. r=bsmedberg.

--HG--
extra : transplant_source : o%008%29%A0%96%60%E1W%7D%1A%C7e%BDJ%B2D%EE%1D%E2
This commit is contained in:
Jim Mathies 2010-01-15 16:02:01 -06:00
parent 52e35965a3
commit c816891a55
3 changed files with 16 additions and 3 deletions

View File

@ -68,7 +68,7 @@ function doTest() {
}
// Need to run 'doTest' after painting is unsuppressed, or we'll set clip
// regions to empty.
addLoadEvent(function() { setTimeout(doTest, 0); } );
addLoadEvent(function() { setTimeout(doTest, 1000); } );
SimpleTest.waitForExplicitFinish();
</script>

View File

@ -94,6 +94,8 @@ typedef struct InstanceData {
bool throwOnNextInvoke;
uint32_t timerID1;
uint32_t timerID2;
int32_t winX;
int32_t winY;
int32_t lastMouseX;
int32_t lastMouseY;
int32_t widthAtLastPaint;

View File

@ -413,6 +413,17 @@ handleEventInternal(InstanceData* instanceData, NPEvent* pe, LRESULT* result)
case WM_MOUSEWHEEL:
return true;
case WM_WINDOWPOSCHANGED: {
WINDOWPOS* pPos = (WINDOWPOS*)pe->lParam;
instanceData->winX = instanceData->winY = 0;
if (pPos) {
instanceData->winX = pPos->x;
instanceData->winY = pPos->y;
return true;
}
return false;
}
case WM_MOUSEMOVE:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
@ -420,8 +431,8 @@ handleEventInternal(InstanceData* instanceData, NPEvent* pe, LRESULT* result)
case WM_MBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP: {
int x = instanceData->hasWidget ? 0 : instanceData->window.x;
int y = instanceData->hasWidget ? 0 : instanceData->window.y;
int x = instanceData->hasWidget ? 0 : instanceData->winX;
int y = instanceData->hasWidget ? 0 : instanceData->winY;
instanceData->lastMouseX = GET_X_LPARAM(pe->lParam) - x;
instanceData->lastMouseY = GET_Y_LPARAM(pe->lParam) - y;
return true;