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

Unified Diff: content/browser/media/capture/cursor_renderer_aura.cc

Issue 2654413002: Stretching NativeViewHost, and misc tab capture fixes.
Patch Set: Gettin' it all working on ui/cocoa and MacViews too. Created 3 years, 10 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/media/capture/cursor_renderer_aura.cc
diff --git a/content/browser/media/capture/cursor_renderer_aura.cc b/content/browser/media/capture/cursor_renderer_aura.cc
index f09ae565dbf062225e3a4a020276cb494a4c1e0b..1873cb0e409cda01f782f50a594a00bb967c6a12 100644
--- a/content/browser/media/capture/cursor_renderer_aura.cc
+++ b/content/browser/media/capture/cursor_renderer_aura.cc
@@ -5,7 +5,9 @@
#include "content/browser/media/capture/cursor_renderer_aura.h"
#include "base/memory/ptr_util.h"
+#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/env.h"
+#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/cursor/cursors_aura.h"
#include "ui/events/event_utils.h"
@@ -82,9 +84,16 @@ gfx::Point CursorRendererAura::GetCursorPositionInView() {
return gfx::Point();
}
- const gfx::Rect window_bounds = window_->GetBoundsInScreen();
+ // Convert from screen coordinates to view coordinates.
+ aura::Window* const root_window = window_->GetRootWindow();
+ if (!root_window)
+ return gfx::Point();
+ aura::client::ScreenPositionClient* const client =
+ aura::client::GetScreenPositionClient(root_window);
+ if (!client)
+ return gfx::Point();
gfx::Point cursor_position = aura::Env::GetInstance()->last_mouse_location();
- cursor_position.Offset(-window_bounds.x(), -window_bounds.y());
+ client->ConvertPointFromScreen(window_, &cursor_position);
return cursor_position;
}

Powered by Google App Engine
This is Rietveld 408576698