Changeset 108919 in webkit


Ignore:
Timestamp:
Feb 25, 2012 5:59:49 PM (12 years ago)
Author:
andersca@apple.com
Message:

Mouse tracking incorrect in Silverlight when using multi monitor with offset arrangement
https://bugs.webkit.org/show_bug.cgi?id=79589
<rdar://problem/9719592>

Reviewed by Sam Weinig.

In the Carbon event model, mouse event coordinates are flipped relative to the first screen,
whereas the coordinates we get from the WebMouseEvent are flipped relative to the screen where
the containing WKView is on.

Instead of passing the global coordinates to NPP_HandleEvent, convert them to the flipped screen coordinate
system that the plug-in expects.

  • WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:

(WebKit::NetscapePlugin::platformHandleMouseEvent):

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r108915 r108919  
     12012-02-25  Anders Carlsson  <andersca@apple.com>
     2
     3        Mouse tracking incorrect in Silverlight when using multi monitor with offset arrangement
     4        https://bugs.webkit.org/show_bug.cgi?id=79589
     5        <rdar://problem/9719592>
     6
     7        Reviewed by Sam Weinig.
     8
     9        In the Carbon event model, mouse event coordinates are flipped relative to the first screen,
     10        whereas the coordinates we get from the WebMouseEvent are flipped relative to the screen where
     11        the containing WKView is on.
     12
     13        Instead of passing the global coordinates to NPP_HandleEvent, convert them to the flipped screen coordinate
     14        system that the plug-in expects.
     15
     16        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
     17        (WebKit::NetscapePlugin::platformHandleMouseEvent):
     18
    1192012-02-25  Sheriff Bot  <webkit.review.bot@gmail.com>
    220
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm

    r99449 r108919  
    533533bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& mouseEvent)
    534534{
     535    IntPoint eventPositionInPluginCoordinates;
     536    if (!convertFromRootView(mouseEvent.position(), eventPositionInPluginCoordinates))
     537        return true;
     538
    535539    switch (m_eventModel) {
    536540        case NPEventModelCocoa: {
    537             IntPoint eventPositionInPluginCoordinates;
    538             if (!convertFromRootView(mouseEvent.position(), eventPositionInPluginCoordinates))
    539                 return true;
    540 
    541541            NPCocoaEvent event = initializeMouseEvent(mouseEvent, eventPositionInPluginCoordinates);
    542542
     
    580580            EventRecord event = initializeEventRecord(eventKind);
    581581            event.modifiers = modifiersForEvent(mouseEvent);
    582             event.where.h = mouseEvent.globalPosition().x();
    583             event.where.v = mouseEvent.globalPosition().y();
     582
     583            double globalX, globalY;
     584            if (!convertPoint(eventPositionInPluginCoordinates.x(), eventPositionInPluginCoordinates.y(), NPCoordinateSpacePlugin, globalX, globalY, NPCoordinateSpaceFlippedScreen))
     585                ASSERT_NOT_REACHED();
     586
     587            event.where.h = globalX;
     588            event.where.v = globalY;
    584589
    585590            NPP_HandleEvent(&event);
Note: See TracChangeset for help on using the changeset viewer.