Changeset 116720 in webkit


Ignore:
Timestamp:
May 10, 2012 7:34:11 PM (12 years ago)
Author:
andersca@apple.com
Message:

PDF files won't scroll in Safari when using Adobe plug-in
https://bugs.webkit.org/show_bug.cgi?id=86167
<rdar://problem/11389719>

Reviewed by Sam Weinig.

Source/WebCore:

  • page/scrolling/ScrollingCoordinator.cpp:

(WebCore::computeNonFastScrollableRegion):
Loop over the frame view children looking for plug-in views that want wheel events
and add them to the non-fast scrollable region. Ideally, the plug-ins should be added
to the set of scrollable areas, but PluginView in WebKit2 is not a ScrollableArea yet.

  • plugins/PluginViewBase.h:

(PluginViewBase):
(WebCore::PluginViewBase::wantsWheelEvents):

Source/WebKit2:

Add a way to whitelist plug-ins that we know will process wheel events correctly. Add the new
Adobe Reader plug-in to this whitelist. Only send wheel events to plug-ins that are in the whitelist.

  • PluginProcess/PluginControllerProxy.cpp:

(WebKit::PluginControllerProxy::wantsWheelEvents):
(WebKit):

  • PluginProcess/PluginControllerProxy.h:

(PluginControllerProxy):

  • PluginProcess/WebProcessConnection.cpp:

(WebKit::WebProcessConnection::createPlugin):

  • PluginProcess/WebProcessConnection.h:

(WebProcessConnection):

  • PluginProcess/WebProcessConnection.messages.in:
  • Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:

(WebKit::NetscapePluginModule::determineQuirks):

  • Shared/Plugins/PluginQuirks.h:
  • WebProcess/Plugins/Netscape/NetscapePlugin.cpp:

(WebKit::NetscapePlugin::wantsWheelEvents):
(WebKit):

  • WebProcess/Plugins/Netscape/NetscapePlugin.h:

(NetscapePlugin):

  • WebProcess/Plugins/PDF/BuiltInPDFView.h:

(BuiltInPDFView):

  • WebProcess/Plugins/PDF/BuiltInPDFView.mm:

(WebKit::BuiltInPDFView::wantsWheelEvents):
(WebKit):

  • WebProcess/Plugins/Plugin.h:

(Plugin):

  • WebProcess/Plugins/PluginProxy.cpp:

(WebKit::PluginProxy::PluginProxy):
(WebKit::PluginProxy::initialize):
(WebKit::PluginProxy::wantsWheelEvents):
(WebKit):

  • WebProcess/Plugins/PluginProxy.h:

(PluginProxy):

  • WebProcess/Plugins/PluginView.cpp:

(WebKit::PluginView::initializePlugin):
(WebKit::PluginView::wantsWheelEvents):
(WebKit):
(WebKit::PluginView::handleEvent):

  • WebProcess/Plugins/PluginView.h:

(PluginView):

Location:
trunk/Source
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116719 r116720  
     12012-05-10  Anders Carlsson  <andersca@apple.com>
     2
     3        PDF files won't scroll in Safari when using Adobe plug-in
     4        https://bugs.webkit.org/show_bug.cgi?id=86167
     5        <rdar://problem/11389719>
     6
     7        Reviewed by Sam Weinig.
     8
     9        * page/scrolling/ScrollingCoordinator.cpp:
     10        (WebCore::computeNonFastScrollableRegion):
     11        Loop over the frame view children looking for plug-in views that want wheel events
     12        and add them to the non-fast scrollable region. Ideally, the plug-ins should be added
     13        to the set of scrollable areas, but PluginView in WebKit2 is not a ScrollableArea yet.
     14
     15        * plugins/PluginViewBase.h:
     16        (PluginViewBase):
     17        (WebCore::PluginViewBase::wantsWheelEvents):
     18
    1192012-05-10  Alexey Proskuryakov  <ap@apple.com>
    220
  • trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

    r116570 r116720  
    115115            continue;
    116116
    117         const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas();
    118         if (!scrollableAreas)
    119             continue;
    120 
    121         for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
    122             ScrollableArea* scrollableArea = *it;
    123             nonFastScrollableRegion.unite(scrollableArea->scrollableAreaBoundingBox());
     117        if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
     118            for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
     119                ScrollableArea* scrollableArea = *it;
     120                nonFastScrollableRegion.unite(scrollableArea->scrollableAreaBoundingBox());
     121            }
     122        }
     123
     124        if (const HashSet<RefPtr<Widget> >* children = frameView->children()) {
     125            for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(), end = children->end(); it != end; ++it) {
     126                if (!(*it)->isPluginViewBase())
     127                    continue;
     128               
     129                PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>((*it).get());
     130                if (pluginViewBase->wantsWheelEvents())
     131                    nonFastScrollableRegion.unite(pluginViewBase->frameRect());
     132            }
    124133        }
    125134    }
  • trunk/Source/WebCore/plugins/PluginViewBase.h

    r112325 r116720  
    5858    virtual Scrollbar* verticalScrollbar() { return 0; }
    5959
     60    // FIXME: This is a hack that works around the fact that the WebKit2 PluginView isn't a ScrollableArea.
     61    virtual bool wantsWheelEvents() { return false; }
     62
    6063protected:
    6164    PluginViewBase(PlatformWidget widget = 0) : Widget(widget) { }
  • trunk/Source/WebKit2/ChangeLog

    r116716 r116720  
     12012-05-10  Anders Carlsson  <andersca@apple.com>
     2
     3        PDF files won't scroll in Safari when using Adobe plug-in
     4        https://bugs.webkit.org/show_bug.cgi?id=86167
     5        <rdar://problem/11389719>
     6
     7        Reviewed by Sam Weinig.
     8
     9        Add a way to whitelist plug-ins that we know will process wheel events correctly. Add the new
     10        Adobe Reader plug-in to this whitelist. Only send wheel events to plug-ins that are in the whitelist.
     11
     12        * PluginProcess/PluginControllerProxy.cpp:
     13        (WebKit::PluginControllerProxy::wantsWheelEvents):
     14        (WebKit):
     15        * PluginProcess/PluginControllerProxy.h:
     16        (PluginControllerProxy):
     17        * PluginProcess/WebProcessConnection.cpp:
     18        (WebKit::WebProcessConnection::createPlugin):
     19        * PluginProcess/WebProcessConnection.h:
     20        (WebProcessConnection):
     21        * PluginProcess/WebProcessConnection.messages.in:
     22        * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
     23        (WebKit::NetscapePluginModule::determineQuirks):
     24        * Shared/Plugins/PluginQuirks.h:
     25        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
     26        (WebKit::NetscapePlugin::wantsWheelEvents):
     27        (WebKit):
     28        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
     29        (NetscapePlugin):
     30        * WebProcess/Plugins/PDF/BuiltInPDFView.h:
     31        (BuiltInPDFView):
     32        * WebProcess/Plugins/PDF/BuiltInPDFView.mm:
     33        (WebKit::BuiltInPDFView::wantsWheelEvents):
     34        (WebKit):
     35        * WebProcess/Plugins/Plugin.h:
     36        (Plugin):
     37        * WebProcess/Plugins/PluginProxy.cpp:
     38        (WebKit::PluginProxy::PluginProxy):
     39        (WebKit::PluginProxy::initialize):
     40        (WebKit::PluginProxy::wantsWheelEvents):
     41        (WebKit):
     42        * WebProcess/Plugins/PluginProxy.h:
     43        (PluginProxy):
     44        * WebProcess/Plugins/PluginView.cpp:
     45        (WebKit::PluginView::initializePlugin):
     46        (WebKit::PluginView::wantsWheelEvents):
     47        (WebKit):
     48        (WebKit::PluginView::handleEvent):
     49        * WebProcess/Plugins/PluginView.h:
     50        (PluginView):
     51
    1522012-05-10  Anders Carlsson  <andersca@apple.com>
    253
  • trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp

    r115300 r116720  
    149149}
    150150
     151bool PluginControllerProxy::wantsWheelEvents() const
     152{
     153    return m_plugin->wantsWheelEvents();
     154}
     155
    151156void PluginControllerProxy::paint()
    152157{
  • trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h

    r115300 r116720  
    6363    void didReceiveSyncPluginControllerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
    6464
     65    bool wantsWheelEvents() const;
     66
    6567#if PLATFORM(MAC)
    6668    uint32_t remoteLayerClientID() const;
  • trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp

    r105475 r116720  
    226226}
    227227
    228 void WebProcessConnection::createPlugin(const PluginCreationParameters& creationParameters, bool& result, uint32_t& remoteLayerClientID)
     228void WebProcessConnection::createPlugin(const PluginCreationParameters& creationParameters, bool& result, bool& wantsWheelEvents, uint32_t& remoteLayerClientID)
    229229{
    230230    OwnPtr<PluginControllerProxy> pluginControllerProxy = PluginControllerProxy::create(this, creationParameters);
     
    242242        return;
    243243
     244    wantsWheelEvents = pluginControllerProxyPtr->wantsWheelEvents();
    244245#if PLATFORM(MAC)
    245246    remoteLayerClientID = pluginControllerProxyPtr->remoteLayerClientID();
  • trunk/Source/WebKit2/PluginProcess/WebProcessConnection.h

    r95901 r116720  
    6969    // Message handlers.
    7070    void didReceiveSyncWebProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
    71     void createPlugin(const PluginCreationParameters&, bool& result, uint32_t& remoteLayerClientID);
     71    void createPlugin(const PluginCreationParameters&, bool& result, bool& wantsWheelEvents, uint32_t& remoteLayerClientID);
    7272    void destroyPlugin(uint64_t pluginInstanceID);
    7373
  • trunk/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in

    r86489 r116720  
    2525messages -> WebProcessConnection {
    2626    # Creates a plug-in instance using the given creation parameters.
    27     CreatePlugin(WebKit::PluginCreationParameters pluginCreationParameters) -> (bool result, uint32_t remoteLayerClientID)
     27    CreatePlugin(WebKit::PluginCreationParameters pluginCreationParameters) -> (bool result, bool wantsWheelEvents, uint32_t remoteLayerClientID)
    2828
    2929    # Destroys the plug-in instance with the given instance ID.
  • trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm

    r111822 r116720  
    519519    }
    520520#endif
     521
     522    if (plugin.bundleIdentifier == "com.adobe.acrobat.pdfviewerNPAPI") {
     523        // The Adobe Reader plug-in wants wheel events.
     524        m_pluginQuirks.add(PluginQuirks::WantsWheelEvents);
     525    }
    521526}
    522527
  • trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h

    r111822 r116720  
    9494#endif
    9595
     96        // This isn't really a quirk as much as the opposite of a quirk. By default, we don't send wheel events
     97        // to plug-ins unless we know that they handle them correctly. Adobe Reader on Mac handles wheel events correctly.
     98        WantsWheelEvents,
     99
    96100        NumPluginQuirks
    97101    };
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp

    r115300 r116720  
    677677}
    678678
     679bool NetscapePlugin::wantsWheelEvents()
     680{
     681    return m_pluginModule->pluginQuirks().contains(PluginQuirks::WantsWheelEvents);
     682}
     683
    679684void NetscapePlugin::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
    680685{
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h

    r115300 r116720  
    174174#endif
    175175    virtual bool isTransparent();
     176    virtual bool wantsWheelEvents() OVERRIDE;
    176177    virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
    177178    virtual void visibilityDidChange();
  • trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h

    r116469 r116720  
    7878#endif
    7979    virtual bool isTransparent();
     80    virtual bool wantsWheelEvents() OVERRIDE;
    8081    virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
    8182    virtual void visibilityDidChange();
  • trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm

    r116469 r116720  
    472472}
    473473
     474bool BuiltInPDFView::wantsWheelEvents()
     475{
     476    // We return false here even though we do want wheel events, because we add ourselves to the scrollable area set in updateScrollbars().
     477    return false;
     478}
     479
    474480void BuiltInPDFView::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
    475481{
  • trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h

    r114476 r116720  
    122122    virtual bool isTransparent() = 0;
    123123
     124    // Returns whether we should send wheel events to this plug-in.
     125    virtual bool wantsWheelEvents() = 0;
     126
    124127    // Tells the plug-in that its geometry has changed. The clip rect is in plug-in coordinates, and the affine transform can be used
    125128    // to convert from root view coordinates to plug-in coordinates.
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp

    r115300 r116720  
    6767    , m_isStarted(false)
    6868    , m_waitingForPaintInResponseToUpdate(false)
     69    , m_wantsWheelEvents(false)
    6970    , m_remoteLayerClientID(0)
    7071{
     
    105106
    106107    bool result = false;
     108    bool wantsWheelEvents = false;
    107109    uint32_t remoteLayerClientID = 0;
    108110
    109     if (!m_connection->connection()->sendSync(Messages::WebProcessConnection::CreatePlugin(creationParameters), Messages::WebProcessConnection::CreatePlugin::Reply(result, remoteLayerClientID), 0) || !result) {
     111    if (!m_connection->connection()->sendSync(Messages::WebProcessConnection::CreatePlugin(creationParameters), Messages::WebProcessConnection::CreatePlugin::Reply(result, wantsWheelEvents, remoteLayerClientID), 0) || !result) {
    110112        m_connection->removePluginProxy(this);
    111113        return false;
    112114    }
    113115
     116    m_wantsWheelEvents = wantsWheelEvents;
    114117    m_remoteLayerClientID = remoteLayerClientID;
    115118    m_isStarted = true;
     
    170173    ASSERT_NOT_REACHED();
    171174    return false;
     175}
     176
     177bool PluginProxy::wantsWheelEvents()
     178{
     179    return m_wantsWheelEvents;
    172180}
    173181
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h

    r115300 r116720  
    7373#endif
    7474    virtual bool isTransparent();
     75    virtual bool wantsWheelEvents() OVERRIDE;
    7576    virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
    7677    virtual void visibilityDidChange();
     
    169170    bool m_waitingForPaintInResponseToUpdate;
    170171
     172    // Whether we should send wheel events to this plug-in or not.
     173    bool m_wantsWheelEvents;
     174
    171175    // The client ID for the CA layer in the plug-in process. Will be 0 if the plug-in is not a CA plug-in.
    172176    uint32_t m_remoteLayerClientID;
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r116687 r116720  
    504504    setWindowIsFocused(m_webPage->windowIsFocused());
    505505#endif
     506
     507    if (wantsWheelEvents()) {
     508        if (Frame* frame = m_pluginElement->document()->frame()) {
     509            if (FrameView* frameView = frame->view())
     510                frameView->setNeedsLayout();
     511        }
     512    }
    506513}
    507514
     
    576583
    577584    return m_plugin->verticalScrollbar();
     585}
     586
     587bool PluginView::wantsWheelEvents()
     588{
     589    // The plug-in can be null here if it failed to initialize.
     590    if (!m_isInitialized || !m_plugin)
     591        return 0;
     592   
     593    return m_plugin->wantsWheelEvents();
    578594}
    579595
     
    652668
    653669        didHandleEvent = m_plugin->handleMouseEvent(static_cast<const WebMouseEvent&>(*currentEvent));
    654     } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel) {
     670    } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel && m_plugin->wantsWheelEvents()) {
    655671        // We have a wheel event.
    656672        didHandleEvent = m_plugin->handleWheelEvent(static_cast<const WebWheelEvent&>(*currentEvent));
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h

    r115300 r116720  
    112112    virtual WebCore::Scrollbar* horizontalScrollbar();
    113113    virtual WebCore::Scrollbar* verticalScrollbar();
     114    virtual bool wantsWheelEvents();
    114115
    115116    // WebCore::Widget
Note: See TracChangeset for help on using the changeset viewer.