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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2219823002: Move content offset to ViewAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated comments Created 3 years, 11 months 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
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index fe6f9fe2078c6b1423990ecb29fad6f85635298c..09357b1b067ef661ec73a093d98db6402a101705 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -91,6 +91,10 @@
#include "ui/gfx/skbitmap_operations.h"
#include "ui/snapshot/snapshot.h"
+#if defined(OS_ANDROID)
+#include "ui/android/view_android.h"
+#endif
+
#if defined(OS_MACOSX)
#include "device/power_save_blocker/power_save_blocker.h"
#include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
@@ -2353,8 +2357,14 @@ void RenderWidgetHostImpl::DidReceiveRendererFrame() {
void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) {
DCHECK(base::MessageLoopForUI::IsCurrent());
- gfx::Rect view_bounds = GetView()->GetViewBounds();
- gfx::Rect snapshot_bounds(view_bounds.size());
+#if defined(OS_ANDROID)
+ // On Android, call sites should pass in the bounds with correct offset
+ // to capture the intended content area.
+ gfx::Rect snapshot_bounds(GetView()->GetViewBounds());
+ snapshot_bounds.Offset(0, GetView()->GetNativeView()->content_offset().y());
+#else
+ gfx::Rect snapshot_bounds(GetView()->GetViewBounds().size());
+#endif
std::vector<unsigned char> png;
if (ui::GrabViewSnapshot(
« no previous file with comments | « content/browser/android/content_view_core_impl.cc ('k') | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698