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

Unified Diff: content/browser/renderer_host/input/web_input_event_builders_mac.mm

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm Created 3 years, 8 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/input/web_input_event_builders_mac.mm
diff --git a/content/browser/renderer_host/input/web_input_event_builders_mac.mm b/content/browser/renderer_host/input/web_input_event_builders_mac.mm
index d18a5ceba9e635b9560eb8f370d0a73ea172b107..46b0052eac3def7aa080598bab74a0f2f119ee94 100644
--- a/content/browser/renderer_host/input/web_input_event_builders_mac.mm
+++ b/content/browser/renderer_host/input/web_input_event_builders_mac.mm
@@ -115,20 +115,20 @@ void SetWebEventLocationFromEventInView(blink::WebMouseEvent* result,
NSView* view) {
NSPoint screen_local = ui::ConvertPointFromWindowToScreen(
[view window], [event locationInWindow]);
- result->globalX = screen_local.x;
- // Flip y.
NSScreen* primary_screen = ([[NSScreen screens] count] > 0)
? [[NSScreen screens] firstObject]
: nil;
- if (primary_screen)
- result->globalY = [primary_screen frame].size.height - screen_local.y;
- else
- result->globalY = screen_local.y;
+ // Flip y conditionally.
+ result->setPositionInScreen(
+ screen_local.x, primary_screen
+ ? [primary_screen frame].size.height - screen_local.y
+ : screen_local.y);
NSPoint content_local =
[view convertPoint:[event locationInWindow] fromView:nil];
- result->x = content_local.x;
- result->y = [view frame].size.height - content_local.y; // Flip y.
+ // Flip y.
+ result->setPositionInWidget(content_local.x,
+ [view frame].size.height - content_local.y);
result->movementX = [event deltaX];
result->movementY = [event deltaY];
@@ -507,10 +507,10 @@ blink::WebGestureEvent WebGestureEventBuilder::Build(NSEvent* event,
blink::WebMouseEvent temp;
SetWebEventLocationFromEventInView(&temp, event, view);
- result.x = temp.x;
- result.y = temp.y;
- result.globalX = temp.globalX;
- result.globalY = temp.globalY;
+ result.x = temp.positionInWidget().x;
+ result.y = temp.positionInWidget().y;
+ result.globalX = temp.positionInScreen().x;
+ result.globalY = temp.positionInScreen().y;
result.setModifiers(ModifiersFromEvent(event));
result.setTimeStampSeconds([event timestamp]);

Powered by Google App Engine
This is Rietveld 408576698