Flash player buttons do not work when page is zoomed in
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2012 01:55:25 +0000 (01:55 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2012 01:55:25 +0000 (01:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=87056
<rdar://problem/11491501>

Reviewed by Oliver Hunt.

Source/WebKit2:

Use the page scale factor when computing the plug-in to root view transform, otherwise we'll compute an
incorrect transform for plug-ins inside subframes. Also, make sure that viewGeometryDidChange is called for all plug-ins
when scaling the page since otherwise it won't be called unless the scroll position changes.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::pageScaleFactorDidChange):
(WebKit):
(WebKit::PluginView::viewGeometryDidChange):
* WebProcess/Plugins/PluginView.h:
(PluginView):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scalePage):

LayoutTests:

* platform/mac-wk2/plugins/mouse-events-scaled-iframe-expected.txt: Added.
* platform/mac-wk2/plugins/mouse-events-scaled-iframe.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@117869 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/plugins/mouse-events-scaled-iframe-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/plugins/mouse-events-scaled-iframe.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/PluginView.cpp
Source/WebKit2/WebProcess/Plugins/PluginView.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 5d526b0..d26c9a1 100644 (file)
@@ -1,3 +1,14 @@
+2012-05-21  Anders Carlsson  <andersca@apple.com>
+
+        Flash player buttons do not work when page is zoomed in
+        https://bugs.webkit.org/show_bug.cgi?id=87056
+        <rdar://problem/11491501>
+
+        Reviewed by Oliver Hunt.
+
+        * platform/mac-wk2/plugins/mouse-events-scaled-iframe-expected.txt: Added.
+        * platform/mac-wk2/plugins/mouse-events-scaled-iframe.html: Added.
+
 2012-05-21  Abhishek Arya  <inferno@chromium.org>
 
         Regression(r117482): Run-in crashes relating to generated content and inline line box clearing.
diff --git a/LayoutTests/platform/mac-wk2/plugins/mouse-events-scaled-iframe-expected.txt b/LayoutTests/platform/mac-wk2/plugins/mouse-events-scaled-iframe-expected.txt
new file mode 100644 (file)
index 0000000..9ef34c6
--- /dev/null
@@ -0,0 +1,7 @@
+CONSOLE MESSAGE: PLUGIN: mouseDown at (400, 400)
+CONSOLE MESSAGE: PLUGIN: mouseUp at (400, 400)
+CONSOLE MESSAGE: PLUGIN: mouseDown at (200, 200)
+CONSOLE MESSAGE: PLUGIN: mouseUp at (200, 200)
+CONSOLE MESSAGE: PLUGIN: mouseDown at (133, 133)
+CONSOLE MESSAGE: PLUGIN: mouseUp at (133, 133)
+
diff --git a/LayoutTests/platform/mac-wk2/plugins/mouse-events-scaled-iframe.html b/LayoutTests/platform/mac-wk2/plugins/mouse-events-scaled-iframe.html
new file mode 100644 (file)
index 0000000..fd33da1
--- /dev/null
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<html>
+<iframe id="iframe" src="mouse-events-scaled.html" style="position: absolute; left: 0; top: 0; border:0" width="1000" height="1000"></iframe>
index 9e2db1e..d13e90f 100644 (file)
@@ -1,3 +1,24 @@
+2012-05-21  Anders Carlsson  <andersca@apple.com>
+
+        Flash player buttons do not work when page is zoomed in
+        https://bugs.webkit.org/show_bug.cgi?id=87056
+        <rdar://problem/11491501>
+
+        Reviewed by Oliver Hunt.
+
+        Use the page scale factor when computing the plug-in to root view transform, otherwise we'll compute an
+        incorrect transform for plug-ins inside subframes. Also, make sure that viewGeometryDidChange is called for all plug-ins
+        when scaling the page since otherwise it won't be called unless the scroll position changes.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::pageScaleFactorDidChange):
+        (WebKit):
+        (WebKit::PluginView::viewGeometryDidChange):
+        * WebProcess/Plugins/PluginView.h:
+        (PluginView):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::scalePage):
+
 2012-05-15  Gavin Barraclough  <barraclough@apple.com>
 
         Add support for private names
index de17915..436adf5 100644 (file)
@@ -395,6 +395,11 @@ RenderBoxModelObject* PluginView::renderer() const
     return toRenderBoxModelObject(m_pluginElement->renderer());
 }
 
+void PluginView::pageScaleFactorDidChange()
+{
+    viewGeometryDidChange();
+}
+
 #if PLATFORM(MAC)    
 void PluginView::setWindowIsVisible(bool windowIsVisible)
 {
@@ -748,15 +753,15 @@ void PluginView::viewGeometryDidChange()
         return;
 
     ASSERT(frame());
-    float frameScaleFactor = frame()->frameScaleFactor();
+    float pageScaleFactor = frame()->page() ? frame()->page()->pageScaleFactor() : 1;
 
-    IntPoint scaledFrameRectLocation(frameRect().location().x() * frameScaleFactor, frameRect().location().y() * frameScaleFactor);
+    IntPoint scaledFrameRectLocation(frameRect().location().x() * pageScaleFactor, frameRect().location().y() * pageScaleFactor);
     IntPoint scaledLocationInRootViewCoordinates(parent()->contentsToRootView(scaledFrameRectLocation));
 
     // FIXME: We still don't get the right coordinates for transformed plugins.
     AffineTransform transform;
     transform.translate(scaledLocationInRootViewCoordinates.x(), scaledLocationInRootViewCoordinates.y());
-    transform.scale(frameScaleFactor);
+    transform.scale(pageScaleFactor);
 
     // FIXME: The clip rect isn't correct.
     IntRect clipRect = boundsRect();
index 547109b..c729112 100644 (file)
@@ -72,6 +72,8 @@ public:
     // FIXME: Remove this; nobody should have to know about the plug-in view's renderer except the plug-in view itself.
     WebCore::RenderBoxModelObject* renderer() const;
 
+    void pageScaleFactorDidChange();
+
 private:
     PluginView(PassRefPtr<WebCore::HTMLPlugInElement>, PassRefPtr<Plugin>, const Plugin::Parameters& parameters);
     virtual ~PluginView();
index e831a16..243c263 100644 (file)
@@ -1014,6 +1014,11 @@ void WebPage::scalePage(double scale, const IntPoint& origin)
 {
     m_page->setPageScaleFactor(scale, origin);
 
+#if PLATFORM(MAC)
+    for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
+        (*it)->pageScaleFactorDidChange();
+#endif
+
     send(Messages::WebPageProxy::PageScaleFactorDidChange(scale));
 }