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

Unified Diff: content/browser/media/capture/cursor_renderer_mac.mm

Issue 2166953002: Bug Fix: Tab Capture Mouse Pointer Off On Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/capture/cursor_renderer_mac.mm
diff --git a/content/browser/media/capture/cursor_renderer_mac.mm b/content/browser/media/capture/cursor_renderer_mac.mm
index b00394e592dbec772864169bd75a429874de9be3..c7c85f6ea087b229f33fcb3aea86dde3febeafb7 100644
--- a/content/browser/media/capture/cursor_renderer_mac.mm
+++ b/content/browser/media/capture/cursor_renderer_mac.mm
@@ -61,12 +61,15 @@ bool CursorRendererMac::SnapshotCursorState(const gfx::Rect& region_in_frame) {
// Mouse location in window co-ordinates.
NSPoint mouse_window_location =
[view_ window].mouseLocationOutsideOfEventStream;
+ // Mouse location with respect to the web contents.
+ NSPoint mouse_tab_location =
+ [view_ convertPoint:mouse_window_location fromView:nil];
// Mouse co-ordinates directly comparable against frame co-ordinates
// after translation.
- if (mouse_window_location.x < 0 || mouse_window_location.y < 0 ||
- mouse_window_location.x > region_in_frame.width() ||
- mouse_window_location.y > region_in_frame.height()) {
+ if (mouse_tab_location.x < 0 || mouse_tab_location.y < 0 ||
+ mouse_tab_location.x > region_in_frame.width() ||
+ mouse_tab_location.y > region_in_frame.height()) {
VLOG(2) << "Mouse outside content region";
return false;
}
@@ -78,9 +81,9 @@ bool CursorRendererMac::SnapshotCursorState(const gfx::Rect& region_in_frame) {
if ((base::TimeTicks::Now() - last_mouse_movement_timestamp_).InSeconds() >
MAX_IDLE_TIME_SECONDS &&
- std::abs(mouse_window_location.x - last_mouse_location_x_) <
+ std::abs(mouse_tab_location.x - last_mouse_location_x_) <
MIN_MOVEMENT_PIXELS &&
- std::abs(mouse_window_location.y - last_mouse_location_y_) <
+ std::abs(mouse_tab_location.y - last_mouse_location_y_) <
MIN_MOVEMENT_PIXELS) {
VLOG(2) << "No mouse movement in a while";
return false;
@@ -88,8 +91,8 @@ bool CursorRendererMac::SnapshotCursorState(const gfx::Rect& region_in_frame) {
// Mouse cursor position within the frame.
cursor_position_in_frame_ =
- gfx::Point(region_in_frame.x() + mouse_window_location.x,
- region_in_frame.y() + mouse_window_location.y);
+ gfx::Point(region_in_frame.x() + mouse_tab_location.x,
+ region_in_frame.y() + mouse_tab_location.y);
// Grab system cursor.
NSCursor* nscursor = [NSCursor currentSystemCursor];
@@ -123,13 +126,13 @@ bool CursorRendererMac::SnapshotCursorState(const gfx::Rect& region_in_frame) {
return false;
last_cursor_data_.reset(image_data_ref, base::scoped_policy::ASSUME);
- if (std::abs(mouse_window_location.x - last_mouse_location_x_) >
+ if (std::abs(mouse_tab_location.x - last_mouse_location_x_) >
MIN_MOVEMENT_PIXELS ||
- std::abs(mouse_window_location.y - last_mouse_location_y_) >
+ std::abs(mouse_tab_location.y - last_mouse_location_y_) >
MIN_MOVEMENT_PIXELS) {
last_mouse_movement_timestamp_ = base::TimeTicks::Now();
- last_mouse_location_x_ = mouse_window_location.x;
- last_mouse_location_y_ = mouse_window_location.y;
+ last_mouse_location_x_ = mouse_tab_location.x;
+ last_mouse_location_y_ = mouse_tab_location.y;
}
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698