Title: [134334] trunk/Source/WebKit/chromium
- Revision
- 134334
- Author
- [email protected]
- Date
- 2012-11-12 18:09:35 -0800 (Mon, 12 Nov 2012)
Log Message
Fix windowRect calculation for webplugin due to page scale factors
https://bugs.webkit.org/show_bug.cgi?id=100182
Patch by Min Qin <[email protected]> on 2012-11-12
Reviewed by Adam Barth.
The current calculaton of windowRect in WebPluginContainerImpl is wrong. Even after some of our latest changes.
The problem is caused by page scale factor.
For example, windowToContents(IntPoint) will return an unscaled offset for an iframe, but will return a scaled offset for the main frame. So in order to obtain the correct window coordinate, we need to use contentsToWindow().
Since webview_plugin.cc is expecting window coordinates, we need to use contentsToWindow(IntRect) to calculate the windowRect so that the rect size can get correctly scaled.
It is difficult to write a test for this because it's pixel-based, and plugin placeholder is managed on the Chromium side (webview_plugin.cc).
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::paint):
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (134333 => 134334)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-11-13 02:01:05 UTC (rev 134333)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-11-13 02:09:35 UTC (rev 134334)
@@ -1,3 +1,19 @@
+2012-11-12 Min Qin <[email protected]>
+
+ Fix windowRect calculation for webplugin due to page scale factors
+ https://bugs.webkit.org/show_bug.cgi?id=100182
+
+ Reviewed by Adam Barth.
+
+ The current calculaton of windowRect in WebPluginContainerImpl is wrong. Even after some of our latest changes.
+ The problem is caused by page scale factor.
+ For example, windowToContents(IntPoint) will return an unscaled offset for an iframe, but will return a scaled offset for the main frame. So in order to obtain the correct window coordinate, we need to use contentsToWindow().
+ Since webview_plugin.cc is expecting window coordinates, we need to use contentsToWindow(IntRect) to calculate the windowRect so that the rect size can get correctly scaled.
+ It is difficult to write a test for this because it's pixel-based, and plugin placeholder is managed on the Chromium side (webview_plugin.cc).
+
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::paint):
+
2012-11-12 Adam Barth <[email protected]>
Unreviewed. Roll Chromium DEPS.
Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp (134333 => 134334)
--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp 2012-11-13 02:01:05 UTC (rev 134333)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp 2012-11-13 02:09:35 UTC (rev 134334)
@@ -133,13 +133,12 @@
// 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<float>(origin.x()), static_cast<float>(origin.y()));
+ IntPoint origin = view->contentsToWindow(IntPoint(0, 0));
+ gc->translate(static_cast<float>(-origin.x()), static_cast<float>(-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();
@@ -818,8 +817,7 @@
IntRect& clipRect,
Vector<IntRect>& 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();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes