Changeset 102540 in webkit


Ignore:
Timestamp:
Dec 11, 2011 11:38:49 AM (12 years ago)
Author:
kling@webkit.org
Message:

WK2/NetscapePlugin: Incorrect mouse event coordinates when frameScaleFactor != 1.
<http://webkit.org/b/74209> and <rdar://problem/10438197>

Reviewed by Anders Carlsson.

Source/WebCore:

  • WebCore.exp.in: Export AffineTransform::scale(double).

Source/WebKit2:

  • Shared/WebEvent.h:
  • Shared/WebMouseEvent.cpp:

Remove the WebMouseEvent "copy" constructor that applied a scale factor
to the coordinates of an existing event.

  • WebProcess/Plugins/PluginView.cpp:

(WebKit::PluginView::handleEvent):

Pass the WebMouseEvent through to the plugin unmodified.

(WebKit::PluginView::viewGeometryDidChange):

Plumb a complex translate+scale transform through to the plugin, so coordinate
space transformations in will behave correctly with scale factors other than 1.

LayoutTests:

Add a test verifying that NetscapePlugins receive correctly transformed
mouse events with a page scale factor applied.

  • platform/mac-wk2/plugins/mouse-events-scaled-expected.txt: Added.
  • platform/mac-wk2/plugins/mouse-events-scaled.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r102538 r102540  
     12011-12-11  Andreas Kling  <kling@webkit.org>
     2
     3        WK2/NetscapePlugin: Incorrect mouse event coordinates when frameScaleFactor != 1.
     4        <http://webkit.org/b/74209> and <rdar://problem/10438197>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Add a test verifying that NetscapePlugins receive correctly transformed
     9        mouse events with a page scale factor applied.
     10
     11        * platform/mac-wk2/plugins/mouse-events-scaled-expected.txt: Added.
     12        * platform/mac-wk2/plugins/mouse-events-scaled.html: Added.
     13
    1142011-12-11  Dan Bernstein  <mitz@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r102539 r102540  
     12011-12-11  Andreas Kling  <kling@webkit.org>
     2
     3        WK2/NetscapePlugin: Incorrect mouse event coordinates when frameScaleFactor != 1.
     4        <http://webkit.org/b/74209> and <rdar://problem/10438197>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * WebCore.exp.in: Export AffineTransform::scale(double).
     9
    1102011-12-10  Andreas Kling  <kling@webkit.org>
    211
  • trunk/Source/WebCore/WebCore.exp.in

    r102517 r102540  
    408408__ZN7WebCore14endOfParagraphERKNS_15VisiblePositionENS_27EditingBoundaryCrossingRuleE
    409409__ZN7WebCore15AffineTransform5flipYEv
     410__ZN7WebCore15AffineTransform5scaleEd
    410411__ZN7WebCore15AffineTransform8multiplyERKS0_
    411412__ZN7WebCore15AffineTransform9translateEdd
  • trunk/Source/WebKit2/ChangeLog

    r102533 r102540  
     12011-12-11  Andreas Kling  <kling@webkit.org>
     2
     3        WK2/NetscapePlugin: Incorrect mouse event coordinates when frameScaleFactor != 1.
     4        <http://webkit.org/b/74209> and <rdar://problem/10438197>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * Shared/WebEvent.h:
     9        * Shared/WebMouseEvent.cpp:
     10
     11            Remove the WebMouseEvent "copy" constructor that applied a scale factor
     12            to the coordinates of an existing event.
     13
     14        * WebProcess/Plugins/PluginView.cpp:
     15        (WebKit::PluginView::handleEvent):
     16
     17            Pass the WebMouseEvent through to the plugin unmodified.
     18
     19        (WebKit::PluginView::viewGeometryDidChange):
     20
     21            Plumb a complex translate+scale transform through to the plugin, so coordinate
     22            space transformations in will behave correctly with scale factors other than 1.
     23
    1242011-12-10  Sam Weinig  <sam@webkit.org>
    225
  • trunk/Source/WebKit2/Shared/WebEvent.h

    r99837 r102540  
    126126    WebMouseEvent(Type, Button, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers, double timestamp, bool didActivateWebView);
    127127#endif
    128    
    129     WebMouseEvent(const WebMouseEvent&, float pageScaleFactor);
    130128
    131129    Button button() const { return static_cast<Button>(m_button); }
  • trunk/Source/WebKit2/Shared/WebMouseEvent.cpp

    r95901 r102540  
    7979#endif
    8080
    81 WebMouseEvent::WebMouseEvent(const WebMouseEvent& event, float pageScaleFactor)
    82     : WebEvent(event.type(), event.modifiers(), event.timestamp())
    83     , m_button(event.button())
    84     , m_position(WebCore::IntPoint(event.position().x() / pageScaleFactor, event.position().y() / pageScaleFactor))
    85     , m_globalPosition(m_position + (event.globalPosition() - event.position()))
    86     , m_deltaX(event.deltaX())
    87     , m_deltaY(event.deltaY())
    88     , m_deltaZ(event.deltaZ())
    89     , m_clickCount(event.clickCount())
    90 #if PLATFORM(WIN)
    91     , m_didActivateWebView(false)
    92 #endif
    93 {
    94 }
    95 
    9681void WebMouseEvent::encode(CoreIPC::ArgumentEncoder* encoder) const
    9782{
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r100895 r102540  
    634634        if (currentEvent->type() == WebEvent::MouseDown)
    635635            focusPluginElement();
    636        
    637         // Adjust mouse coordinates to account for frameScaleFactor
    638         WebMouseEvent eventWithScaledCoordinates(*static_cast<const WebMouseEvent*>(currentEvent), frame()->frameScaleFactor());
    639         didHandleEvent = m_plugin->handleMouseEvent(eventWithScaledCoordinates);
     636
     637        didHandleEvent = m_plugin->handleMouseEvent(static_cast<const WebMouseEvent&>(*currentEvent));
    640638    } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel) {
    641639        // We have a wheel event.
     
    707705        return;
    708706
    709     // FIXME: Just passing a translation matrix isn't good enough.
    710     IntPoint locationInWindowCoordinates = parent()->contentsToRootView(frameRect().location());
    711     AffineTransform transform = AffineTransform::translation(locationInWindowCoordinates.x(), locationInWindowCoordinates.y());
     707    ASSERT(frame());
     708    float frameScaleFactor = frame()->frameScaleFactor();
     709
     710    IntPoint scaledFrameRectLocation(frameRect().location().x() * frameScaleFactor, frameRect().location().y() * frameScaleFactor);
     711    IntPoint scaledLocationInRootViewCoordinates(parent()->contentsToRootView(scaledFrameRectLocation));
     712
     713    // FIXME: We still don't get the right coordinates for transformed plugins.
     714    AffineTransform transform;
     715    transform.translate(scaledLocationInRootViewCoordinates.x(), scaledLocationInRootViewCoordinates.y());
     716    transform.scale(frameScaleFactor);
    712717
    713718    // FIXME: The clip rect isn't correct.
Note: See TracChangeset for help on using the changeset viewer.