diff options
author | powei@chromium.org <powei@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-20 22:37:14 +0000 |
---|---|---|
committer | powei@chromium.org <powei@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-20 22:37:14 +0000 |
commit | 1a8376c7e8712830be8c71ed902b2a6431a2fd3f (patch) | |
tree | ecc37a5fd33d55063575108b672b795a5a5b978e /ui/snapshot | |
parent | af86ae7952a5d404b787c3e15a8a2a44c93caf3e (diff) | |
download | chromium_src-1a8376c7e8712830be8c71ed902b2a6431a2fd3f.zip chromium_src-1a8376c7e8712830be8c71ed902b2a6431a2fd3f.tar.gz chromium_src-1a8376c7e8712830be8c71ed902b2a6431a2fd3f.tar.bz2 |
android: Fix snapshot height by including toolbar offset
The Android snapshot was found to be chopping off the bottom content. This is
due to not accounting for the height of the toolbar. This patch enlarges the
snapshot by that offset.
BUG=384551
Review URL: https://codereview.chromium.org/340603002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278843 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/snapshot')
-rw-r--r-- | ui/snapshot/snapshot_android.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ui/snapshot/snapshot_android.cc b/ui/snapshot/snapshot_android.cc index 9713cff..aec7555 100644 --- a/ui/snapshot/snapshot_android.cc +++ b/ui/snapshot/snapshot_android.cc @@ -11,6 +11,7 @@ #include "ui/base/android/window_android.h" #include "ui/base/android/window_android_compositor.h" #include "ui/gfx/display.h" +#include "ui/gfx/geometry/point_conversions.h" #include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/screen.h" #include "ui/snapshot/snapshot_async.h" @@ -44,7 +45,14 @@ static void MakeAsyncCopyRequest( gfx::Rect source_rect_in_pixel = gfx::ToEnclosingRect(gfx::ScaleRect(source_rect, device_scale_factor)); - request->set_area(source_rect_in_pixel); + // Account for the toolbar offset. + gfx::Vector2dF offset = window->content_offset(); + gfx::Rect adjusted_source_rect(gfx::ToRoundedPoint( + gfx::PointF(source_rect_in_pixel.x() + offset.x(), + source_rect_in_pixel.y() + offset.y())), + source_rect_in_pixel.size()); + + request->set_area(adjusted_source_rect); window->GetCompositor()->RequestCopyOfOutputOnRootLayer(request.Pass()); } |