[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
eric at webkit.org
eric at webkit.org
Wed Mar 17 18:35:07 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 213f0c8e4f3decea969a4ebb4fe695bae8b42479
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Mar 12 03:04:40 2010 +0000
2010-03-11 Stuart Morgan <stuartmorgan at chromium.org>
Reviewed by Darin Fisher.
Fix the screen coordinate conversion of Chromium Mac mouse events for
multiple-moniter setups. Also changes the global coordinate values
to be computed from the event, rather than the instantaneous mouse
location, and reduces code duplication for location conversion.
Dual-sided patch with http://codereview.chromium.org/751002
https://bugs.webkit.org/show_bug.cgi?id=35950
* src/mac/WebInputEventFactory.mm:
(WebKit::setWebEventLocationFromEventInView):
(WebKit::WebInputEventFactory::mouseEvent):
(WebKit::WebInputEventFactory::mouseWheelEvent):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 31be92e..8f9e909 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,21 @@
+2010-03-11 Stuart Morgan <stuartmorgan at chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Fix the screen coordinate conversion of Chromium Mac mouse events for
+ multiple-moniter setups. Also changes the global coordinate values
+ to be computed from the event, rather than the instantaneous mouse
+ location, and reduces code duplication for location conversion.
+
+ Dual-sided patch with http://codereview.chromium.org/751002
+
+ https://bugs.webkit.org/show_bug.cgi?id=35950
+
+ * src/mac/WebInputEventFactory.mm:
+ (WebKit::setWebEventLocationFromEventInView):
+ (WebKit::WebInputEventFactory::mouseEvent):
+ (WebKit::WebInputEventFactory::mouseWheelEvent):
+
2010-03-11 Anders Carlsson <andersca at apple.com>
Reviewed by David Hyatt.
diff --git a/WebKit/chromium/src/mac/WebInputEventFactory.mm b/WebKit/chromium/src/mac/WebInputEventFactory.mm
index 46b0afe..694155f 100644
--- a/WebKit/chromium/src/mac/WebInputEventFactory.mm
+++ b/WebKit/chromium/src/mac/WebInputEventFactory.mm
@@ -861,6 +861,29 @@ static inline int modifiersFromEvent(NSEvent* event) {
return modifiers;
}
+static inline void setWebEventLocationFromEventInView(WebMouseEvent* result,
+ NSEvent* event,
+ NSView* view) {
+ NSPoint windowLocal = [event locationInWindow];
+
+ NSPoint screenLocal = [[view window] convertBaseToScreen:windowLocal];
+ result->globalX = screenLocal.x;
+ // Flip y.
+ NSScreen* primaryScreen = ([[NSScreen screens] count] > 0) ?
+ [[NSScreen screens] objectAtIndex:0] : nil;
+ if (primaryScreen)
+ result->globalY = [primaryScreen frame].size.height - screenLocal.y;
+ else
+ result->globalY = screenLocal.y;
+
+ NSPoint contentLocal = [view convertPoint:windowLocal fromView:nil];
+ result->x = contentLocal.x;
+ result->y = [view frame].size.height - contentLocal.y; // Flip y.
+
+ result->windowX = result->x;
+ result->windowY = result->y;
+}
+
WebKeyboardEvent WebInputEventFactory::keyboardEvent(NSEvent* event)
{
WebKeyboardEvent result;
@@ -1021,16 +1044,7 @@ WebMouseEvent WebInputEventFactory::mouseEvent(NSEvent* event, NSView* view)
ASSERT_NOT_REACHED();
}
- NSPoint location = [NSEvent mouseLocation]; // global coordinates
- result.globalX = location.x;
- result.globalY = [[[view window] screen] frame].size.height - location.y;
-
- NSPoint windowLocal = [event locationInWindow];
- location = [view convertPoint:windowLocal fromView:nil];
- result.y = [view frame].size.height - location.y; // flip y
- result.x = location.x;
- result.windowX = result.x;
- result.windowY = result.y;
+ setWebEventLocationFromEventInView(&result, event, view);
result.modifiers = modifiersFromEvent(event);
@@ -1050,16 +1064,7 @@ WebMouseWheelEvent WebInputEventFactory::mouseWheelEvent(NSEvent* event, NSView*
result.modifiers = modifiersFromEvent(event);
- // Set coordinates by translating event coordinates from screen to client.
- NSPoint location = [NSEvent mouseLocation]; // global coordinates
- result.globalX = location.x;
- result.globalY = location.y;
- NSPoint windowLocal = [event locationInWindow];
- location = [view convertPoint:windowLocal fromView:nil];
- result.x = location.x;
- result.y = [view frame].size.height - location.y; // flip y
- result.windowX = result.x;
- result.windowY = result.y;
+ setWebEventLocationFromEventInView(&result, event, view);
// Of Mice and Men
// ---------------
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list