Title: [116720] trunk/Source
Revision
116720
Author
[email protected]
Date
2012-05-10 19:34:11 -0700 (Thu, 10 May 2012)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (116719 => 116720)


--- trunk/Source/WebCore/ChangeLog	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebCore/ChangeLog	2012-05-11 02:34:11 UTC (rev 116720)
@@ -1,3 +1,21 @@
+2012-05-10  Anders Carlsson  <[email protected]>
+
+        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.
+
+        * 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):
+
 2012-05-10  Alexey Proskuryakov  <[email protected]>
 
         Crash in 3rd party WebKit apps that disable cache at a wrong time

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (116719 => 116720)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-05-11 02:34:11 UTC (rev 116720)
@@ -114,13 +114,22 @@
         if (!frameView)
             continue;
 
-        const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas();
-        if (!scrollableAreas)
-            continue;
+        if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
+            for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
+                ScrollableArea* scrollableArea = *it;
+                nonFastScrollableRegion.unite(scrollableArea->scrollableAreaBoundingBox());
+            }
+        }
 
-        for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
-            ScrollableArea* scrollableArea = *it;
-            nonFastScrollableRegion.unite(scrollableArea->scrollableAreaBoundingBox());
+        if (const HashSet<RefPtr<Widget> >* children = frameView->children()) {
+            for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(), end = children->end(); it != end; ++it) {
+                if (!(*it)->isPluginViewBase())
+                    continue;
+                
+                PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>((*it).get());
+                if (pluginViewBase->wantsWheelEvents())
+                    nonFastScrollableRegion.unite(pluginViewBase->frameRect());
+            }
         }
     }
 

Modified: trunk/Source/WebCore/plugins/PluginViewBase.h (116719 => 116720)


--- trunk/Source/WebCore/plugins/PluginViewBase.h	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebCore/plugins/PluginViewBase.h	2012-05-11 02:34:11 UTC (rev 116720)
@@ -57,6 +57,9 @@
     virtual Scrollbar* horizontalScrollbar() { return 0; }
     virtual Scrollbar* verticalScrollbar() { return 0; }
 
+    // FIXME: This is a hack that works around the fact that the WebKit2 PluginView isn't a ScrollableArea.
+    virtual bool wantsWheelEvents() { return false; }
+
 protected:
     PluginViewBase(PlatformWidget widget = 0) : Widget(widget) { }
     

Modified: trunk/Source/WebKit2/ChangeLog (116719 => 116720)


--- trunk/Source/WebKit2/ChangeLog	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-11 02:34:11 UTC (rev 116720)
@@ -1,5 +1,56 @@
 2012-05-10  Anders Carlsson  <[email protected]>
 
+        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.
+
+        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):
+
+2012-05-10  Anders Carlsson  <[email protected]>
+
         WebKit2: Add a way to blacklist specific plug-ins/plug-in versions
         https://bugs.webkit.org/show_bug.cgi?id=86164
         <rdar://problem/9551196>

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp (116719 => 116720)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp	2012-05-11 02:34:11 UTC (rev 116720)
@@ -148,6 +148,11 @@
     m_connection->removePluginControllerProxy(this, plugin);
 }
 
+bool PluginControllerProxy::wantsWheelEvents() const
+{
+    return m_plugin->wantsWheelEvents();
+}
+
 void PluginControllerProxy::paint()
 {
     ASSERT(!m_dirtyRect.isEmpty());

Modified: trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h (116719 => 116720)


--- trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h	2012-05-11 02:34:11 UTC (rev 116720)
@@ -62,6 +62,8 @@
     void didReceivePluginControllerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     void didReceiveSyncPluginControllerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
 
+    bool wantsWheelEvents() const;
+
 #if PLATFORM(MAC)
     uint32_t remoteLayerClientID() const;
 #endif

Modified: trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp (116719 => 116720)


--- trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2012-05-11 02:34:11 UTC (rev 116720)
@@ -225,7 +225,7 @@
 {
 }
 
-void WebProcessConnection::createPlugin(const PluginCreationParameters& creationParameters, bool& result, uint32_t& remoteLayerClientID)
+void WebProcessConnection::createPlugin(const PluginCreationParameters& creationParameters, bool& result, bool& wantsWheelEvents, uint32_t& remoteLayerClientID)
 {
     OwnPtr<PluginControllerProxy> pluginControllerProxy = PluginControllerProxy::create(this, creationParameters);
 
@@ -241,6 +241,7 @@
     if (!result)
         return;
 
+    wantsWheelEvents = pluginControllerProxyPtr->wantsWheelEvents();
 #if PLATFORM(MAC)
     remoteLayerClientID = pluginControllerProxyPtr->remoteLayerClientID();
 #endif

Modified: trunk/Source/WebKit2/PluginProcess/WebProcessConnection.h (116719 => 116720)


--- trunk/Source/WebKit2/PluginProcess/WebProcessConnection.h	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/PluginProcess/WebProcessConnection.h	2012-05-11 02:34:11 UTC (rev 116720)
@@ -68,7 +68,7 @@
 
     // Message handlers.
     void didReceiveSyncWebProcessConnectionMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
-    void createPlugin(const PluginCreationParameters&, bool& result, uint32_t& remoteLayerClientID);
+    void createPlugin(const PluginCreationParameters&, bool& result, bool& wantsWheelEvents, uint32_t& remoteLayerClientID);
     void destroyPlugin(uint64_t pluginInstanceID);
 
     RefPtr<CoreIPC::Connection> m_connection;

Modified: trunk/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in (116719 => 116720)


--- trunk/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/PluginProcess/WebProcessConnection.messages.in	2012-05-11 02:34:11 UTC (rev 116720)
@@ -24,7 +24,7 @@
 
 messages -> WebProcessConnection {
     # Creates a plug-in instance using the given creation parameters.
-    CreatePlugin(WebKit::PluginCreationParameters pluginCreationParameters) -> (bool result, uint32_t remoteLayerClientID)
+    CreatePlugin(WebKit::PluginCreationParameters pluginCreationParameters) -> (bool result, bool wantsWheelEvents, uint32_t remoteLayerClientID)
 
     # Destroys the plug-in instance with the given instance ID.
     DestroyPlugin(uint64_t pluginInstanceID) -> ()

Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm (116719 => 116720)


--- trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm	2012-05-11 02:34:11 UTC (rev 116720)
@@ -518,6 +518,11 @@
         m_pluginQuirks.add(PluginQuirks::AllowHalfBakedQuickDrawSupport);
     }
 #endif
+
+    if (plugin.bundleIdentifier == "com.adobe.acrobat.pdfviewerNPAPI") {
+        // The Adobe Reader plug-in wants wheel events.
+        m_pluginQuirks.add(PluginQuirks::WantsWheelEvents);
+    }
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h (116719 => 116720)


--- trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/Shared/Plugins/PluginQuirks.h	2012-05-11 02:34:11 UTC (rev 116720)
@@ -93,6 +93,10 @@
         WantsMozillaUserAgent,
 #endif
 
+        // This isn't really a quirk as much as the opposite of a quirk. By default, we don't send wheel events
+        // to plug-ins unless we know that they handle them correctly. Adobe Reader on Mac handles wheel events correctly.
+        WantsWheelEvents,
+
         NumPluginQuirks
     };
     

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp (116719 => 116720)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp	2012-05-11 02:34:11 UTC (rev 116720)
@@ -676,6 +676,11 @@
     return m_isTransparent;
 }
 
+bool NetscapePlugin::wantsWheelEvents()
+{
+    return m_pluginModule->pluginQuirks().contains(PluginQuirks::WantsWheelEvents);
+}
+
 void NetscapePlugin::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
 {
     ASSERT(m_isStarted);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h (116719 => 116720)


--- trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h	2012-05-11 02:34:11 UTC (rev 116720)
@@ -173,6 +173,7 @@
     virtual PlatformLayer* pluginLayer();
 #endif
     virtual bool isTransparent();
+    virtual bool wantsWheelEvents() OVERRIDE;
     virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
     virtual void visibilityDidChange();
     virtual void frameDidFinishLoading(uint64_t requestID);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h (116719 => 116720)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h	2012-05-11 02:34:11 UTC (rev 116720)
@@ -77,6 +77,7 @@
     virtual PlatformLayer* pluginLayer();
 #endif
     virtual bool isTransparent();
+    virtual bool wantsWheelEvents() OVERRIDE;
     virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
     virtual void visibilityDidChange();
     virtual void frameDidFinishLoading(uint64_t requestID);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm (116719 => 116720)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm	2012-05-11 02:34:11 UTC (rev 116720)
@@ -471,6 +471,12 @@
     return false;
 }
 
+bool BuiltInPDFView::wantsWheelEvents()
+{
+    // We return false here even though we do want wheel events, because we add ourselves to the scrollable area set in updateScrollbars().
+    return false;
+}
+
 void BuiltInPDFView::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform)
 {
     if (m_pluginSize == pluginSize) {

Modified: trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h (116719 => 116720)


--- trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h	2012-05-11 02:34:11 UTC (rev 116720)
@@ -121,6 +121,9 @@
     // Returns whether the plug-in is transparent or not.
     virtual bool isTransparent() = 0;
 
+    // Returns whether we should send wheel events to this plug-in.
+    virtual bool wantsWheelEvents() = 0;
+
     // Tells the plug-in that its geometry has changed. The clip rect is in plug-in coordinates, and the affine transform can be used
     // to convert from root view coordinates to plug-in coordinates.
     virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform) = 0;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp (116719 => 116720)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp	2012-05-11 02:34:11 UTC (rev 116720)
@@ -66,6 +66,7 @@
     , m_pluginBackingStoreContainsValidData(false)
     , m_isStarted(false)
     , m_waitingForPaintInResponseToUpdate(false)
+    , m_wantsWheelEvents(false)
     , m_remoteLayerClientID(0)
 {
 }
@@ -104,13 +105,15 @@
 #endif
 
     bool result = false;
+    bool wantsWheelEvents = false;
     uint32_t remoteLayerClientID = 0;
 
-    if (!m_connection->connection()->sendSync(Messages::WebProcessConnection::CreatePlugin(creationParameters), Messages::WebProcessConnection::CreatePlugin::Reply(result, remoteLayerClientID), 0) || !result) {
+    if (!m_connection->connection()->sendSync(Messages::WebProcessConnection::CreatePlugin(creationParameters), Messages::WebProcessConnection::CreatePlugin::Reply(result, wantsWheelEvents, remoteLayerClientID), 0) || !result) {
         m_connection->removePluginProxy(this);
         return false;
     }
 
+    m_wantsWheelEvents = wantsWheelEvents;
     m_remoteLayerClientID = remoteLayerClientID;
     m_isStarted = true;
 
@@ -171,6 +174,11 @@
     return false;
 }
 
+bool PluginProxy::wantsWheelEvents()
+{
+    return m_wantsWheelEvents;
+}
+
 void PluginProxy::geometryDidChange()
 {
     ASSERT(m_isStarted);

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h (116719 => 116720)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h	2012-05-11 02:34:11 UTC (rev 116720)
@@ -72,6 +72,7 @@
     virtual PlatformLayer* pluginLayer();
 #endif
     virtual bool isTransparent();
+    virtual bool wantsWheelEvents() OVERRIDE;
     virtual void geometryDidChange(const WebCore::IntSize& pluginSize, const WebCore::IntRect& clipRect, const WebCore::AffineTransform& pluginToRootViewTransform);
     virtual void visibilityDidChange();
     virtual void frameDidFinishLoading(uint64_t requestID);
@@ -168,6 +169,9 @@
     // Whether we're called invalidate in response to an update call, and are now waiting for a paint call.
     bool m_waitingForPaintInResponseToUpdate;
 
+    // Whether we should send wheel events to this plug-in or not.
+    bool m_wantsWheelEvents;
+
     // 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.
     uint32_t m_remoteLayerClientID;
 

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (116719 => 116720)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-05-11 02:34:11 UTC (rev 116720)
@@ -503,6 +503,13 @@
     setWindowIsVisible(m_webPage->windowIsVisible());
     setWindowIsFocused(m_webPage->windowIsFocused());
 #endif
+
+    if (wantsWheelEvents()) {
+        if (Frame* frame = m_pluginElement->document()->frame()) {
+            if (FrameView* frameView = frame->view())
+                frameView->setNeedsLayout();
+        }
+    }
 }
 
 #if PLATFORM(MAC)
@@ -577,6 +584,15 @@
     return m_plugin->verticalScrollbar();
 }
 
+bool PluginView::wantsWheelEvents()
+{
+    // The plug-in can be null here if it failed to initialize.
+    if (!m_isInitialized || !m_plugin)
+        return 0;
+    
+    return m_plugin->wantsWheelEvents();
+}
+
 void PluginView::setFrameRect(const WebCore::IntRect& rect)
 {
     Widget::setFrameRect(rect);
@@ -651,7 +667,7 @@
             frame()->eventHandler()->setCapturingMouseEventsNode(0);
 
         didHandleEvent = m_plugin->handleMouseEvent(static_cast<const WebMouseEvent&>(*currentEvent));
-    } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel) {
+    } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel && m_plugin->wantsWheelEvents()) {
         // We have a wheel event.
         didHandleEvent = m_plugin->handleWheelEvent(static_cast<const WebWheelEvent&>(*currentEvent));
     } else if (event->type() == eventNames().mouseoverEvent && currentEvent->type() == WebEvent::MouseMove) {

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h (116719 => 116720)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h	2012-05-11 02:31:26 UTC (rev 116719)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h	2012-05-11 02:34:11 UTC (rev 116720)
@@ -111,6 +111,7 @@
     virtual bool scroll(WebCore::ScrollDirection, WebCore::ScrollGranularity);
     virtual WebCore::Scrollbar* horizontalScrollbar();
     virtual WebCore::Scrollbar* verticalScrollbar();
+    virtual bool wantsWheelEvents();
 
     // WebCore::Widget
     virtual void setFrameRect(const WebCore::IntRect&);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to