Chromium Code Reviews| Index: components/plugins/renderer/webview_plugin.cc |
| diff --git a/components/plugins/renderer/webview_plugin.cc b/components/plugins/renderer/webview_plugin.cc |
| index d14e4f7235af237575e186fd9f3bf07dfcedc347..ce65a0b87c0447e481d8645e7ad43b22cfe7679c 100644 |
| --- a/components/plugins/renderer/webview_plugin.cc |
| +++ b/components/plugins/renderer/webview_plugin.cc |
| @@ -109,8 +109,13 @@ WebPluginContainer* WebViewPlugin::container() const { return container_; } |
| bool WebViewPlugin::initialize(WebPluginContainer* container) { |
| container_ = container; |
| - if (container_) |
| + if (container_) { |
| old_title_ = container_->element().getAttribute("title"); |
| + |
| + // Propagate device scale to inner webview to load the correct resource |
| + // when images have a "srcset" attribute. |
| + web_view_->setDeviceScaleFactor(container_->deviceScaleFactor()); |
| + } |
| return true; |
| } |
| @@ -139,9 +144,17 @@ void WebViewPlugin::paint(WebCanvas* canvas, const WebRect& rect) { |
| canvas->translate(SkIntToScalar(rect_.x()), SkIntToScalar(rect_.y())); |
| canvas->save(); |
| + // Before actually painting, remove device scaling, as it would otherwise |
| + // be applied twice. |
| + web_view_->setDeviceScaleFactor(1); |
|
jbroman
2015/03/06 20:25:49
Changing the device scale factor of the page like
tommycli
2015/03/06 21:30:55
Done. Okay cool. That's the same thing as bauerb s
|
| + |
| web_view_->layout(); |
| web_view_->paint(canvas, paint_rect); |
| + // Reapply the container's device scale factor for resource loading. |
|
tommycli
2015/03/06 00:19:23
Not sure if this is actually needed. It doesn't se
jbroman
2015/03/06 20:25:49
See above.
tommycli
2015/03/06 21:30:55
Done.
|
| + if (container_) |
| + web_view_->setDeviceScaleFactor(container_->deviceScaleFactor()); |
| + |
| canvas->restore(); |
| } |