コード例 #1
0
void NetscapePlugin::callSetWindow()
{
    if (wantsPluginRelativeNPWindowCoordinates()) {
        m_npWindow.x = 0;
        m_npWindow.y = 0;
        m_npWindow.clipRect.top = m_clipRect.y();
        m_npWindow.clipRect.left = m_clipRect.x();
    } else {
        IntPoint pluginLocationInRootViewCoordinates = convertToRootView(IntPoint());
        IntPoint clipRectInRootViewCoordinates = convertToRootView(m_clipRect.location());

        m_npWindow.x = pluginLocationInRootViewCoordinates.x();
        m_npWindow.y = pluginLocationInRootViewCoordinates.y();
        m_npWindow.clipRect.top = clipRectInRootViewCoordinates.y();
        m_npWindow.clipRect.left = clipRectInRootViewCoordinates.x();
    }

    m_npWindow.width = m_pluginSize.width();
    m_npWindow.height = m_pluginSize.height();
    m_npWindow.clipRect.right = m_npWindow.clipRect.left + m_clipRect.width();
    m_npWindow.clipRect.bottom = m_npWindow.clipRect.top + m_clipRect.height();

    NPP_SetWindow(&m_npWindow);
    m_hasCalledSetWindow = true;
}
コード例 #2
0
bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent& event)
{
    if (m_isWindowed)
        return false;

    if ((event.type() == WebEvent::MouseDown || event.type() == WebEvent::MouseUp)
         && event.button() == WebMouseEvent::RightButton
         && quirks().contains(PluginQuirks::IgnoreRightClickInWindowlessMode))
        return false;

    XEvent xEvent;
    initializeXEvent(xEvent);

    switch (event.type()) {
    case WebEvent::MouseDown:
    case WebEvent::MouseUp:
        setXButtonEventFields(xEvent, event, convertToRootView(IntPoint()));
        break;
    case WebEvent::MouseMove:
        setXMotionEventFields(xEvent, event, convertToRootView(IntPoint()));
        break;
    case WebEvent::NoType:
    case WebEvent::Wheel:
    case WebEvent::KeyDown:
    case WebEvent::KeyUp:
    case WebEvent::RawKeyDown:
    case WebEvent::Char:
#if ENABLE(GESTURE_EVENTS)
    case WebEvent::GestureScrollBegin:
    case WebEvent::GestureScrollEnd:
#endif
#if ENABLE(TOUCH_EVENTS)
    case WebEvent::TouchStart:
    case WebEvent::TouchMove:
    case WebEvent::TouchEnd:
    case WebEvent::TouchCancel:
#endif
        return false;
    }

    return !NPP_HandleEvent(&xEvent);
}
コード例 #3
0
bool NetscapePlugin::platformHandleMouseLeaveEvent(const WebMouseEvent& event)
{
    if (m_isWindowed)
        return false;

    XEvent xEvent;
    initializeXEvent(xEvent);
    setXCrossingEventFields(xEvent, event, convertToRootView(IntPoint()), LeaveNotify);

    return !NPP_HandleEvent(&xEvent);
}
コード例 #4
0
bool NetscapePlugin::platformHandleWheelEvent(const WebWheelEvent& event)
{
    if (m_isWindowed)
        return false;

    XEvent xEvent;
    initializeXEvent(xEvent);
    setXButtonEventFieldsByWebWheelEvent(xEvent, event, convertToRootView(IntPoint()));

    return !NPP_HandleEvent(&xEvent);
}
コード例 #5
0
ファイル: NetscapePluginWin.cpp プロジェクト: dzhshf/WebKit
void NetscapePlugin::scheduleWindowedGeometryUpdate()
{
    // We only update the size here and let the UI process update our position and clip rect so
    // that we can keep our position in sync when scrolling, etc. See <http://webkit.org/b/60210>.
    ::SetWindowPos(m_window, 0, 0, 0, m_pluginSize.width(), m_pluginSize.height(), SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER);

    WindowGeometry geometry;
    geometry.window = m_window;
    geometry.visible = controller()->isPluginVisible();
    geometry.frame = IntRect(convertToRootView(IntPoint()), m_pluginSize);
    geometry.clipRect = m_clipRect;

    controller()->scheduleWindowedPluginGeometryUpdate(geometry);
}
コード例 #6
0
ファイル: NetscapePluginWin.cpp プロジェクト: dzhshf/WebKit
void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirtyRect, bool)
{
    CurrentPluginSetter setCurrentPlugin(this);

    // FIXME: Call SetWindow here if we haven't called it yet (see r59904).

    if (m_isWindowed) {
        // FIXME: Paint windowed plugins into context if context->shouldIncludeChildWindows() is true.
        return;
    }

    controller()->willSendEventToPlugin();
    
    LocalWindowsContext windowsContext(context, dirtyRect, m_isTransparent);

    m_npWindow.type = NPWindowTypeDrawable;
    m_npWindow.window = windowsContext.hdc();

    WINDOWPOS windowpos = { 0, 0, 0, 0, 0, 0, 0 };

    IntPoint pluginLocationInRootViewCoordinates = convertToRootView(IntPoint());

    windowpos.x = pluginLocationInRootViewCoordinates.x();
    windowpos.y = pluginLocationInRootViewCoordinates.y();
    windowpos.cx = m_pluginSize.width();
    windowpos.cy = m_pluginSize.height();

    NPEvent npEvent;
    npEvent.event = WM_WINDOWPOSCHANGED;
    npEvent.wParam = 0;
    npEvent.lParam = reinterpret_cast<uintptr_t>(&windowpos);

    NPP_HandleEvent(&npEvent);

    callSetWindow();

    RECT dirtyWinRect = dirtyRect;

    npEvent.event = WM_PAINT;
    npEvent.wParam = reinterpret_cast<uintptr_t>(windowsContext.hdc());
    npEvent.lParam = reinterpret_cast<uintptr_t>(&dirtyWinRect);

    NPP_HandleEvent(&npEvent);
}