Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Unified Diff: webkit/plugins/webview_plugin.cc

Issue 11359200: Upstream the pagescalefactor fix for plugin placeholder on android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/webview_plugin.cc
diff --git a/webkit/plugins/webview_plugin.cc b/webkit/plugins/webview_plugin.cc
index 4e5c8c40157c849f341e6cdbd931a02ca8d61ea4..987b74a02e82e4b8d5ae865e06d005fffcda41c7 100644
--- a/webkit/plugins/webview_plugin.cc
+++ b/webkit/plugins/webview_plugin.cc
@@ -9,6 +9,7 @@
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
@@ -126,6 +127,18 @@ void WebViewPlugin::paint(WebCanvas* canvas, const WebRect& rect) {
paintRect.Offset(-rect_.x(), -rect_.y());
+ float pageScaleFactor = 1.0f;
jam 2012/11/14 20:59:55 nit: google style is page_scale_factor. if you can
qinmin 2012/11/14 22:16:59 Done.
+ if (container_) {
+ pageScaleFactor = container_->element().document().frame()->top()->view()
+ ->pageScaleFactor();
Bernhard Bauer 2012/11/14 21:12:00 Urgh. Could you extract something in here to a loc
qinmin 2012/11/14 22:16:59 Done.
+ }
+ float content_scale = 1.0f / pageScaleFactor;
+ paintRect.SetRect(
+ ceil(static_cast<float>(content_scale * paintRect.x())),
Bernhard Bauer 2012/11/14 21:12:00 Why do we need the static_cast here? Shouldn't flo
qinmin 2012/11/14 22:16:59 removed.
+ ceil(static_cast<float>(content_scale * paintRect.y())),
+ ceil(static_cast<float>(content_scale * paintRect.width())),
+ ceil(static_cast<float>(content_scale * paintRect.height())));
+
canvas->translate(SkIntToScalar(rect_.x()), SkIntToScalar(rect_.y()));
canvas->save();
@@ -141,7 +154,16 @@ void WebViewPlugin::updateGeometry(
const WebVector<WebRect>& cut_out_rects, bool is_visible) {
if (static_cast<gfx::Rect>(frame_rect) != rect_) {
rect_ = frame_rect;
- web_view_->resize(WebSize(frame_rect.width, frame_rect.height));
+
+ float pageScaleFactor = 1.0f;
+ if (container_) {
+ pageScaleFactor = container_->element().document().frame()->top()->
+ view()->pageScaleFactor();
Bernhard Bauer 2012/11/14 21:12:00 Same "urgh" here. Maybe you could (also) pull it o
qinmin 2012/11/14 22:16:59 Done. added a GetPageScaleFactor() method
+ }
+ float content_scale = 1.0f / pageScaleFactor;
+
+ web_view_->resize(WebSize(content_scale * frame_rect.width,
+ content_scale * frame_rect.height));
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698