diff options
author | tengs@chromium.org <tengs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-20 18:45:57 +0000 |
---|---|---|
committer | tengs@chromium.org <tengs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-20 18:45:57 +0000 |
commit | 24449a1e8e02ccb481f1ee29b4e104b63d2e9e4a (patch) | |
tree | 266448fb3fb32778bd48d0929619a274b9a81a14 /ui/snapshot | |
parent | b613bb0f5034ec734c6eb646ef0c4a78c2b07ce5 (diff) | |
download | chromium_src-24449a1e8e02ccb481f1ee29b4e104b63d2e9e4a.zip chromium_src-24449a1e8e02ccb481f1ee29b4e104b63d2e9e4a.tar.gz chromium_src-24449a1e8e02ccb481f1ee29b4e104b63d2e9e4a.tar.bz2 |
Fix GrabWindowSnapshot not taking into account parents when
calculating window offset.
BUG=235585
TEST=GpuTabTest.testScreenshot telemetry unittest pass
Review URL: https://chromiumcodereview.appspot.com/15358002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/snapshot')
-rw-r--r-- | ui/snapshot/snapshot_aura.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ui/snapshot/snapshot_aura.cc b/ui/snapshot/snapshot_aura.cc index 1eca6d5..144ce2d 100644 --- a/ui/snapshot/snapshot_aura.cc +++ b/ui/snapshot/snapshot_aura.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/compositor/compositor.h" #include "ui/compositor/dip_util.h" @@ -28,9 +29,13 @@ bool GrabWindowSnapshot(gfx::NativeWindow window, gfx::Rect read_pixels_bounds = snapshot_bounds; - // When not in compact mode we must take into account the window's position on - // the desktop. - read_pixels_bounds.Offset(window->bounds().OffsetFromOrigin()); + // We must take into account the window's position on the desktop. + gfx::Point origin = window->bounds().origin(); + const aura::Window* root_window = window->GetRootWindow(); + if (root_window) + aura::Window::ConvertPointToTarget(window, root_window, &origin); + + read_pixels_bounds.Offset(origin.OffsetFromOrigin()); gfx::Rect read_pixels_bounds_in_pixel = ui::ConvertRectToPixel(window->layer(), read_pixels_bounds); |