Title: [142487] trunk/Tools
Revision
142487
Author
commit-qu...@webkit.org
Date
2013-02-11 10:11:32 -0800 (Mon, 11 Feb 2013)

Log Message

[BlackBerry] Set mouse document position for mouse event in DRT.
https://bugs.webkit.org/show_bug.cgi?id=109094.

Patch by Tiancheng Jiang <tiji...@rim.com> on 2013-02-11
Reviewed by Rob Buis.

RIM PR 246976.
Internally Reviewed by Nima Ghanavatian & Genevieve Mak.

Set mouse document position when we create mouse event in DRT.

* DumpRenderTree/blackberry/EventSender.cpp:
(setMouseEventDocumentPos):
(mouseDownCallback):
(mouseUpCallback):
(mouseMoveToCallback):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (142486 => 142487)


--- trunk/Tools/ChangeLog	2013-02-11 18:05:33 UTC (rev 142486)
+++ trunk/Tools/ChangeLog	2013-02-11 18:11:32 UTC (rev 142487)
@@ -1,3 +1,21 @@
+2013-02-11  Tiancheng Jiang  <tiji...@rim.com>
+
+        [BlackBerry] Set mouse document position for mouse event in DRT.
+        https://bugs.webkit.org/show_bug.cgi?id=109094.
+
+        Reviewed by Rob Buis.
+
+        RIM PR 246976.
+        Internally Reviewed by Nima Ghanavatian & Genevieve Mak.
+
+        Set mouse document position when we create mouse event in DRT.
+
+        * DumpRenderTree/blackberry/EventSender.cpp:
+        (setMouseEventDocumentPos):
+        (mouseDownCallback):
+        (mouseUpCallback):
+        (mouseMoveToCallback):
+
 2013-02-11  Mike Lattanzio  <mlattan...@rim.com>
 
         [BlackBerry] Add graphics subdirectory to include path.

Modified: trunk/Tools/DumpRenderTree/blackberry/EventSender.cpp (142486 => 142487)


--- trunk/Tools/DumpRenderTree/blackberry/EventSender.cpp	2013-02-11 18:05:33 UTC (rev 142486)
+++ trunk/Tools/DumpRenderTree/blackberry/EventSender.cpp	2013-02-11 18:11:32 UTC (rev 142487)
@@ -26,6 +26,7 @@
 #include "DumpRenderTreeSupport.h"
 #include "IntPoint.h"
 #include "NotImplemented.h"
+#include "WebKitThreadViewportAccessor.h"
 #include "WebPage.h"
 
 #include <BlackBerryPlatformKeyboardEvent.h>
@@ -70,17 +71,34 @@
     return JSValueMakeUndefined(context);
 }
 
+void setMouseEventDocumentPos(BlackBerry::Platform::MouseEvent &event, const BlackBerry::WebKit::WebPage* page)
+{
+    // We have added document viewport position and document content position as members of the mouse event, when we create the event, we should initialize them as well.
+    BlackBerry::Platform::ViewportAccessor* viewportAccessor = page->webkitThreadViewportAccessor();
+    IntPoint documentContentPos = viewportAccessor->roundToDocumentFromPixelContents(BlackBerry::Platform::FloatPoint(viewportAccessor->pixelContentsFromViewport(lastMousePosition)));
+    IntPoint documentViewportMousePos = viewportAccessor->roundToDocumentFromPixelContents(BlackBerry::Platform::FloatPoint(lastMousePosition));
+    event.populateDocumentPosition(documentViewportMousePos, documentContentPos);
+}
+
 static JSValueRef mouseDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page();
-    page->mouseEvent(BlackBerry::Platform::MouseEvent(BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, 0, lastMousePosition, IntPoint::zero(), 0, 0, 0));
+    BlackBerry::Platform::MouseEvent event(BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, 0, lastMousePosition, IntPoint::zero(), 0, 0, 0);
+
+    setMouseEventDocumentPos(event, page);
+
+    page->mouseEvent(event);
     return JSValueMakeUndefined(context);
 }
 
 static JSValueRef mouseUpCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page();
-    page->mouseEvent(BlackBerry::Platform::MouseEvent(0, BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, lastMousePosition, IntPoint::zero(), 0, 0, 0));
+    BlackBerry::Platform::MouseEvent event(0, BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, lastMousePosition, IntPoint::zero(), 0, 0, 0);
+
+    setMouseEventDocumentPos(event, page);
+
+    page->mouseEvent(event);
     return JSValueMakeUndefined(context);
 }
 
@@ -96,9 +114,12 @@
 
     lastMousePosition = IntPoint(x, y);
     BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page();
-    page->mouseEvent(BlackBerry::Platform::MouseEvent(BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, lastMousePosition, IntPoint::zero(), 0, 0, 0));
+    BlackBerry::Platform::MouseEvent event(BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, lastMousePosition, IntPoint::zero(), 0, 0, 0);
 
+    setMouseEventDocumentPos(event, page);
 
+    page->mouseEvent(event);
+
     return JSValueMakeUndefined(context);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to