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

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: offset in RWH Created 3 years, 12 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 8860791b51b005f240538873bcf57ad775c73536..4fa250f92cbe6e869074e94d8d686872be11060f 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"
@@ -2351,8 +2355,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(

Powered by Google App Engine
This is Rietveld 408576698