From 470286ecfe79d59df14944e5b5d34630fc739391 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 22 Nov 2012 09:09:45 +0100 Subject: Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485) Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66 Reviewed-by: Simon Hausmann --- .../WebKit/chromium/src/WebPluginContainerImpl.cpp | 39 ++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'Source/WebKit/chromium/src/WebPluginContainerImpl.cpp') diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 87a660156..075fc0548 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -67,6 +67,7 @@ #include "ScrollAnimator.h" #include "ScrollView.h" #include "ScrollbarTheme.h" +#include "ScrollingCoordinator.h" #include "TouchEvent.h" #include "UserGestureIndicator.h" #include "WebPrintParams.h" @@ -133,13 +134,12 @@ void WebPluginContainerImpl::paint(GraphicsContext* gc, const IntRect& damageRec // The plugin is positioned in window coordinates, so it needs to be painted // in window coordinates. - IntPoint origin = view->windowToContents(IntPoint(0, 0)); - gc->translate(static_cast(origin.x()), static_cast(origin.y())); + IntPoint origin = view->contentsToWindow(IntPoint(0, 0)); + gc->translate(static_cast(-origin.x()), static_cast(-origin.y())); WebCanvas* canvas = gc->platformContext()->canvas(); - IntRect windowRect = - IntRect(view->contentsToWindow(enclosingIntRect(scaledDamageRect).location()), enclosingIntRect(scaledDamageRect).size()); + IntRect windowRect = view->contentsToWindow(enclosingIntRect(scaledDamageRect)); m_webPlugin->paint(canvas, windowRect); gc->restore(); @@ -532,6 +532,28 @@ void WebPluginContainerImpl::setIsAcceptingTouchEvents(bool acceptingTouchEvents m_element->document()->didRemoveTouchEventHandler(); } +void WebPluginContainerImpl::setWantsWheelEvents(bool wantsWheelEvents) +{ + if (m_wantsWheelEvents == wantsWheelEvents) + return; + m_wantsWheelEvents = wantsWheelEvents; + if (Page* page = m_element->document()->page()) { + if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) { + if (parent() && parent()->isFrameView()) + scrollingCoordinator->frameViewLayoutUpdated(static_cast(parent())); + } + } +} + +WebPoint WebPluginContainerImpl::windowToLocalPoint(const WebPoint& point) +{ + ScrollView* view = parent(); + if (!view) + return point; + WebPoint windowPoint = view->windowToContents(point); + return roundedIntPoint(m_element->renderer()->absoluteToLocal(LayoutPoint(windowPoint), UseTransforms | SnapOffsetForTransforms)); +} + void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response) { // Make sure that the plugin receives window geometry before data, or else @@ -582,6 +604,11 @@ bool WebPluginContainerImpl::canProcessDrag() const return m_webPlugin->canProcessDrag(); } +bool WebPluginContainerImpl::wantsWheelEvents() +{ + return m_wantsWheelEvents; +} + void WebPluginContainerImpl::willDestroyPluginLoadObserver(WebPluginLoadObserver* observer) { size_t pos = m_pluginLoadObservers.find(observer); @@ -641,6 +668,7 @@ WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* eleme , m_ioSurfaceId(0) #endif , m_isAcceptingTouchEvents(false) + , m_wantsWheelEvents(false) { } @@ -818,8 +846,7 @@ void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect, IntRect& clipRect, Vector& cutOutRects) { - windowRect = IntRect( - parent()->contentsToWindow(frameRect.location()), frameRect.size()); + windowRect = parent()->contentsToWindow(frameRect); // Calculate a clip-rect so that we don't overlap the scrollbars, etc. clipRect = windowClipRect(); -- cgit v1.2.1