Changeset 51412 in webkit


Ignore:
Timestamp:
Nov 26, 2009 5:04:06 AM (14 years ago)
Author:
Girish Ramakrishnan
Message:

[Qt] Mac Plugins : Pass mouse position relative to the fake window

Reviewed by Holger Freyther.

When using off-screen rendering, we need to pass mouse events relative
to the fake window instead of the global position.

https://bugs.webkit.org/show_bug.cgi?id=31794

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r51411 r51412  
     12009-11-26  Girish Ramakrishnan  <girish@forwardbias.in>
     2
     3        Reviewed by Holger Freyther.
     4
     5        [Qt] Mac Plugins : Pass mouse position relative to the fake window
     6       
     7        When using off-screen rendering, we need to pass mouse events relative
     8        to the fake window instead of the global position.
     9       
     10        https://bugs.webkit.org/show_bug.cgi?id=31794
     11
     12        * plugins/mac/PluginViewMac.cpp:
     13        (WebCore::PluginView::platformStart):
     14        (WebCore::PluginView::handleMouseEvent):
     15
    1162009-11-24  Holger Hans Peter Freyther  <zecke@selfish.org>
    217
  • trunk/WebCore/plugins/mac/PluginViewMac.cpp

    r51234 r51412  
    176176
    177177#if PLATFORM(QT)
    178     // Set the platformPluginWidget only in the case of QWebView until we get mouse events working.
     178    // Set the platformPluginWidget only in the case of QWebView so that the context menu appears in the right place.
    179179    // In all other cases, we use off-screen rendering
    180180    if (QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient()) {
     
    186186    // Create a fake window relative to which all events will be sent when using offscreen rendering
    187187    if (!platformPluginWidget()) {
    188         ::Rect windowBounds = { 0, 0, 100, 100 };
     188        // Make the default size really big. It is unclear why this is required but with a smaller size, mouse move
     189        // events don't get processed. Resizing the fake window to flash's size doesn't help.
     190        ::Rect windowBounds = { 0, 0, 1000, 1000 };
    189191        CreateNewWindow(kDocumentWindowClass, kWindowStandardDocumentAttributes, &windowBounds, &m_fakeWindow);
     192        // Flash requires the window to be hilited to process mouse move events.
     193        HiliteWindow(m_fakeWindow, true);
    190194    }
    191195
     
    560564    }
    561565
    562     record.where = globalMousePosForPlugin();
     566    if (platformPluginWidget()) {
     567        record.where = globalMousePosForPlugin();
     568    } else {
     569        IntPoint postZoomPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(event->absoluteLocation()));
     570        record.where.h = postZoomPos.x() + m_windowRect.x();
     571        // The number 22 is the height of the title bar. As to why it figures in the calculation below
     572        // is left as an exercise to the reader :-)
     573        record.where.v = postZoomPos.y() + m_windowRect.y() - 22;
     574    }
    563575    record.modifiers = modifiersForEvent(event);
    564576
Note: See TracChangeset for help on using the changeset viewer.