diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/Plugins')
9 files changed, 67 insertions, 11 deletions
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp index b63c73a4e..adc632dd8 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp @@ -676,6 +676,11 @@ bool NetscapePlugin::isTransparent() 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); diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h index 660b68540..7bba977b4 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h @@ -173,6 +173,7 @@ private: 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); diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h index c4d178c6e..6d11c8552 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h +++ b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h @@ -77,6 +77,7 @@ private: 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); @@ -119,6 +120,7 @@ private: // ScrollableArea methods. virtual WebCore::IntRect scrollCornerRect() const; virtual WebCore::ScrollableArea* enclosingScrollableArea() const; + virtual WebCore::IntRect scrollableAreaBoundingBox() const OVERRIDE; virtual void setScrollOffset(const WebCore::IntPoint&); virtual int scrollSize(WebCore::ScrollbarOrientation) const; virtual bool isActive() const; diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm index 7dc0b0e64..c4ee69330 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm +++ b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm @@ -196,6 +196,8 @@ const PluginView* BuiltInPDFView::pluginView() const void BuiltInPDFView::updateScrollbars() { + bool hadScrollbars = m_horizontalScrollbar || m_verticalScrollbar; + if (m_horizontalScrollbar) { if (m_pluginSize.width() >= m_pdfDocumentSize.width()) destroyScrollbar(HorizontalScrollbar); @@ -234,10 +236,15 @@ void BuiltInPDFView::updateScrollbars() if (!frameView) return; - if (m_verticalScrollbar || m_horizontalScrollbar) - frameView->addScrollableArea(this); - else - frameView->removeScrollableArea(this); + bool hasScrollbars = m_horizontalScrollbar || m_verticalScrollbar; + if (hadScrollbars != hasScrollbars) { + if (hasScrollbars) + frameView->addScrollableArea(this); + else + frameView->removeScrollableArea(this); + + frameView->setNeedsLayout(); + } } PassRefPtr<Scrollbar> BuiltInPDFView::createScrollbar(ScrollbarOrientation orientation) @@ -464,6 +471,12 @@ bool BuiltInPDFView::isTransparent() 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) { @@ -688,6 +701,11 @@ ScrollableArea* BuiltInPDFView::enclosingScrollableArea() const return 0; } +IntRect BuiltInPDFView::scrollableAreaBoundingBox() const +{ + return pluginView()->frameRect(); +} + void BuiltInPDFView::setScrollOffset(const IntPoint& offset) { m_scrollOffset = IntSize(offset.x(), offset.y()); diff --git a/Source/WebKit2/WebProcess/Plugins/Plugin.h b/Source/WebKit2/WebProcess/Plugins/Plugin.h index 4f10da9bc..5be84f476 100644 --- a/Source/WebKit2/WebProcess/Plugins/Plugin.h +++ b/Source/WebKit2/WebProcess/Plugins/Plugin.h @@ -121,6 +121,9 @@ public: // 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; diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp index 0771bc3d5..d4a3549f4 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp @@ -66,6 +66,7 @@ PluginProxy::PluginProxy(const String& pluginPath) , m_pluginBackingStoreContainsValidData(false) , m_isStarted(false) , m_waitingForPaintInResponseToUpdate(false) + , m_wantsWheelEvents(false) , m_remoteLayerClientID(0) { } @@ -104,13 +105,15 @@ bool PluginProxy::initialize(const Parameters& parameters) #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 @@ bool PluginProxy::isTransparent() return false; } +bool PluginProxy::wantsWheelEvents() +{ + return m_wantsWheelEvents; +} + void PluginProxy::geometryDidChange() { ASSERT(m_isStarted); diff --git a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h index e4b428669..be07caa85 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginProxy.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginProxy.h @@ -72,6 +72,7 @@ private: 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 @@ private: // 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; diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp index 6799f11b3..03dd60f59 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp @@ -54,7 +54,6 @@ #include <WebCore/ProtectionSpace.h> #include <WebCore/ProxyServer.h> #include <WebCore/RenderEmbeddedObject.h> -#include <WebCore/RenderLayer.h> #include <WebCore/ResourceLoadScheduler.h> #include <WebCore/ScriptValue.h> #include <WebCore/ScrollView.h> @@ -504,6 +503,13 @@ void PluginView::initializePlugin() 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) @@ -578,6 +584,15 @@ Scrollbar* PluginView::verticalScrollbar() 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); @@ -652,7 +667,7 @@ void PluginView::handleEvent(Event* event) 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) { @@ -752,9 +767,8 @@ IntRect PluginView::clipRectInWindowCoordinates() const Frame* frame = this->frame(); - // Get the window clip rect for the enclosing layer (in window coordinates). - RenderLayer* layer = m_pluginElement->renderer()->enclosingLayer(); - IntRect windowClipRect = frame->view()->windowClipRectForLayer(layer, true); + // Get the window clip rect for the plugin element (in window coordinates). + IntRect windowClipRect = frame->view()->windowClipRectForFrameOwner(m_pluginElement.get(), true); // Intersect the two rects to get the view clip rect in window coordinates. frameRectInWindowCoordinates.intersect(windowClipRect); @@ -1111,7 +1125,7 @@ void PluginView::pluginProcessCrashed() return; RenderEmbeddedObject* renderer = toRenderEmbeddedObject(m_pluginElement->renderer()); - renderer->setShowsCrashedPluginIndicator(); + renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginCrashed); Widget::invalidate(); } diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.h b/Source/WebKit2/WebProcess/Plugins/PluginView.h index 1bf76ae71..d5cb2574c 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginView.h +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.h @@ -111,6 +111,7 @@ private: 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&); |