Diff
Modified: trunk/LayoutTests/ChangeLog (130764 => 130765)
--- trunk/LayoutTests/ChangeLog 2012-10-09 15:03:43 UTC (rev 130764)
+++ trunk/LayoutTests/ChangeLog 2012-10-09 15:13:30 UTC (rev 130765)
@@ -1,3 +1,18 @@
+2012-10-09 Sadrul Habib Chowdhury <[email protected]>
+
+ [chromium] Make sure events are transformed correctly for plugins.
+ https://bugs.webkit.org/show_bug.cgi?id=89250
+
+ Reviewed by Tony Chang.
+
+ Added tests to make sure that events are transformed properly. Note that
+ for touch-events, each point in the three touch-point lists in the
+ touch-event is printed, so the same touch-point is printed out three
+ times.
+
+ * platform/chromium/plugins/transformed-events-expected.txt: Added.
+ * platform/chromium/plugins/transformed-events.html: Added.
+
2012-10-09 Raphael Kubo da Costa <[email protected]>
[EFL] Rebaseline some svg/text tests.
Added: trunk/LayoutTests/platform/chromium/plugins/transformed-events-expected.txt (0 => 130765)
--- trunk/LayoutTests/platform/chromium/plugins/transformed-events-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium/plugins/transformed-events-expected.txt 2012-10-09 15:13:30 UTC (rev 130765)
@@ -0,0 +1,35 @@
+Plugin received event: TouchStart
+* 10, 10: Pressed
+* 10, 10: Pressed
+* 10, 10: Pressed
+Plugin received event: TouchMove
+* 20, 15: Moved
+* 20, 15: Moved
+* 20, 15: Moved
+Plugin received event: TouchEnd
+* 20, 15: Released
+Plugin received event: MouseEnter
+* 10, 10
+Plugin received event: MouseMove
+* 10, 10
+Plugin received event: MouseDown
+* 10, 10
+Plugin received event: MouseMove
+* 20, 15
+Plugin received event: MouseUp
+* 20, 15
+Plugin received event: MouseMove
+* 10, 10
+Plugin received event: MouseWheel
+* 10, 10
+Plugin received event: GestureTapDown
+* 10, 10
+Plugin received event: GestureTap
+* 10, 10
+Plugin received event: MouseMove
+* 10, 10
+Plugin received event: MouseDown
+* 10, 10
+Plugin received event: MouseUp
+* 10, 10
+
Added: trunk/LayoutTests/platform/chromium/plugins/transformed-events.html (0 => 130765)
--- trunk/LayoutTests/platform/chromium/plugins/transformed-events.html (rev 0)
+++ trunk/LayoutTests/platform/chromium/plugins/transformed-events.html 2012-10-09 15:13:30 UTC (rev 130765)
@@ -0,0 +1,48 @@
+<html>
+<head>
+<style>
+ #plugin {
+ width: 150px;
+ height: 150px;
+ -webkit-transform: rotate(90deg);
+ }
+</style>
+</head>
+
+<body>
+<embed id="plugin" type="application/x-webkit-test-webplugin" accepts-touch="true" print-event-details="true"></embed>
+<script>
+
+ if (!window.testRunner || !window.eventSender) {
+ document.write("This test requires DumpRenderTree.");
+ } else {
+ testRunner.dumpAsText();
+
+ // Test touch events.
+ var positionX = plugin.offsetLeft + plugin.offsetWidth - 10;
+ var positionY = plugin.offsetTop + 10;
+ eventSender.addTouchPoint(positionX, positionY);
+ eventSender.touchStart();
+ eventSender.updateTouchPoint(0, positionX - 5, positionY + 10);
+ eventSender.touchMove();
+ eventSender.releaseTouchPoint(0);
+ eventSender.touchEnd();
+
+ // Test mouse events.
+ eventSender.mouseMoveTo(positionX, positionY);
+ eventSender.mouseDown();
+ eventSender.leapForward(10);
+ eventSender.mouseMoveTo(positionX - 5, positionY + 10);
+ eventSender.mouseUp();
+ eventSender.mouseMoveTo(positionX, positionY);
+ eventSender.mouseScrollBy(10, 0);
+
+ // Test gesture events.
+ eventSender.gestureTapDown(positionX, positionY);
+ eventSender.gestureTap(positionX, positionY);
+ }
+
+</script>
+</body>
+</html>
+
Modified: trunk/Source/WebKit/chromium/ChangeLog (130764 => 130765)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-10-09 15:03:43 UTC (rev 130764)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-10-09 15:13:30 UTC (rev 130765)
@@ -1,3 +1,35 @@
+2012-10-09 Sadrul Habib Chowdhury <[email protected]>
+
+ [chromium] Make sure events are transformed correctly for plugins.
+ https://bugs.webkit.org/show_bug.cgi?id=89250
+
+ Reviewed by Tony Chang.
+
+ The events arriving in WebPluginContainerImpl are in the coordinate
+ space of the page containing the plugin. Before the events are
+ dispatched to the plugin, it is necessary to convert them into the
+ plugin's own coordinate system.
+
+ * src/WebInputEventConversion.cpp:
+ (WebKit::convertLocationForRenderObject): Transforms an event location for the specified RenderObject.
+ (WebKit):
+ (WebKit::updateWebMouseEventFromWebCoreMouseEvent): Refactored code to reduce code-duplication for mouse and wheel events.
+ (WebKit::WebMouseEventBuilder::WebMouseEventBuilder):
+ (WebKit::WebMouseWheelEventBuilder::WebMouseWheelEventBuilder):
+ (WebKit::addTouchPoints):
+ (WebKit::WebTouchEventBuilder::WebTouchEventBuilder):
+ (WebKit::WebGestureEventBuilder::WebGestureEventBuilder):
+ * src/WebInputEventConversion.h:
+ (WebCore):
+ (WebKit):
+ (WebMouseEventBuilder):
+ (WebMouseWheelEventBuilder):
+ (WebTouchEventBuilder):
+ (WebGestureEventBuilder):
+ * src/WebPluginContainerImpl.cpp:
+ (WebKit::WebPluginContainerImpl::handleMouseEvent):
+ (WebKit::WebPluginContainerImpl::handleWheelEvent):
+
2012-10-09 Garrett Casto <[email protected]>
Allow users to specify a different hover image for TextFieldDecorationElement
Modified: trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp (130764 => 130765)
--- trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp 2012-10-09 15:03:43 UTC (rev 130764)
+++ trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp 2012-10-09 15:13:30 UTC (rev 130765)
@@ -39,6 +39,7 @@
#include "PlatformKeyboardEvent.h"
#include "PlatformMouseEvent.h"
#include "PlatformWheelEvent.h"
+#include "RenderObject.h"
#include "ScrollView.h"
#include "Touch.h"
#include "TouchEvent.h"
@@ -396,8 +397,29 @@
return modifiers;
}
-WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const MouseEvent& event)
+static IntPoint convertLocationForRenderObject(const LayoutPoint& location, const WebCore::RenderObject& renderObject)
{
+ return roundedIntPoint(renderObject.absoluteToLocal(location, false, true));
+}
+
+static void updateWebMouseEventFromWebCoreMouseEvent(const MouseEvent& event, const Widget& widget, const WebCore::RenderObject& renderObject, WebMouseEvent& webEvent)
+{
+ webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond;
+ webEvent.modifiers = getWebInputModifiers(event);
+
+ ScrollView* view = widget.parent();
+ IntPoint windowPoint = view->contentsToWindow(IntPoint(event.absoluteLocation().x(), event.absoluteLocation().y()));
+ webEvent.globalX = event.screenX();
+ webEvent.globalY = event.screenY();
+ webEvent.windowX = windowPoint.x();
+ webEvent.windowY = windowPoint.y();
+ IntPoint localPoint = convertLocationForRenderObject(event.absoluteLocation(), renderObject);
+ webEvent.x = localPoint.x();
+ webEvent.y = localPoint.y();
+}
+
+WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const WebCore::RenderObject* renderObject, const MouseEvent& event)
+{
if (event.type() == eventNames().mousemoveEvent)
type = WebInputEvent::MouseMove;
else if (event.type() == eventNames().mouseoutEvent)
@@ -412,7 +434,9 @@
type = WebInputEvent::ContextMenu;
else
return; // Skip all other mouse events.
- timeStampSeconds = event.timeStamp() / millisPerSecond;
+
+ updateWebMouseEventFromWebCoreMouseEvent(event, *widget, *renderObject, *this);
+
switch (event.button()) {
case LeftButton:
button = WebMouseEvent::ButtonLeft;
@@ -424,7 +448,6 @@
button = WebMouseEvent::ButtonRight;
break;
}
- modifiers = getWebInputModifiers(event);
if (event.buttonDown()) {
switch (event.button()) {
case LeftButton:
@@ -438,15 +461,6 @@
break;
}
}
- ScrollView* view = widget->parent();
- IntPoint p = view->contentsToWindow(
- IntPoint(event.absoluteLocation().x(), event.absoluteLocation().y()));
- globalX = event.screenX();
- globalY = event.screenY();
- windowX = p.x();
- windowY = p.y();
- x = event.absoluteLocation().x() - widget->location().x();
- y = event.absoluteLocation().y() - widget->location().y();
#if ENABLE(POINTER_LOCK)
movementX = event.webkitMovementX();
movementY = event.webkitMovementY();
@@ -454,22 +468,12 @@
clickCount = event.detail();
}
-WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const WheelEvent& event)
+WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const WebCore::RenderObject* renderObject, const WheelEvent& event)
{
if (event.type() != eventNames().mousewheelEvent)
return;
type = WebInputEvent::MouseWheel;
- timeStampSeconds = event.timeStamp() / millisPerSecond;
- modifiers = getWebInputModifiers(event);
- ScrollView* view = widget->parent();
- IntPoint p = view->contentsToWindow(
- IntPoint(event.absoluteLocation().x(), event.absoluteLocation().y()));
- globalX = event.screenX();
- globalY = event.screenY();
- windowX = p.x();
- windowY = p.y();
- x = event.absoluteLocation().x() - widget->location().x();
- y = event.absoluteLocation().y() - widget->location().y();
+ updateWebMouseEventFromWebCoreMouseEvent(event, *widget, *renderObject, *this);
deltaX = static_cast<float>(event.rawDeltaX());
deltaY = static_cast<float>(event.rawDeltaY());
// The 120 is from WheelEvent::initWheelEvent().
@@ -515,7 +519,7 @@
#if ENABLE(TOUCH_EVENTS)
-static void addTouchPoints(const AtomicString& touchType, TouchList* touches, const IntPoint& offset, WebTouchPoint* touchPoints, unsigned* touchPointsLength)
+static void addTouchPoints(const AtomicString& touchType, TouchList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, const WebCore::RenderObject* renderObject)
{
unsigned numberOfTouches = std::min(touches->length(), static_cast<unsigned>(WebTouchEvent::touchesLengthCap));
for (unsigned i = 0; i < numberOfTouches; ++i) {
@@ -524,7 +528,7 @@
WebTouchPoint point;
point.id = touch->identifier();
point.screenPosition = WebPoint(touch->screenX(), touch->screenY());
- point.position = WebPoint(touch->pageX() - offset.x(), touch->pageY() - offset.y());
+ point.position = convertLocationForRenderObject(LayoutPoint(IntPoint(touch->pageX(), touch->pageY())), *renderObject);
point.radiusX = touch->webkitRadiusX();
point.radiusY = touch->webkitRadiusY();
point.rotationAngle = touch->webkitRotationAngle();
@@ -536,7 +540,7 @@
*touchPointsLength = numberOfTouches;
}
-WebTouchEventBuilder::WebTouchEventBuilder(const Widget* widget, const TouchEvent& event)
+WebTouchEventBuilder::WebTouchEventBuilder(const Widget* widget, const WebCore::RenderObject* renderObject, const TouchEvent& event)
{
if (event.type() == eventNames().touchstartEvent)
type = TouchStart;
@@ -555,15 +559,15 @@
modifiers = getWebInputModifiers(event);
timeStampSeconds = event.timeStamp() / millisPerSecond;
- addTouchPoints(event.type(), event.touches(), widget->location(), touches, &touchesLength);
- addTouchPoints(event.type(), event.changedTouches(), widget->location(), changedTouches, &changedTouchesLength);
- addTouchPoints(event.type(), event.targetTouches(), widget->location(), targetTouches, &targetTouchesLength);
+ addTouchPoints(event.type(), event.touches(), touches, &touchesLength, renderObject);
+ addTouchPoints(event.type(), event.changedTouches(), changedTouches, &changedTouchesLength, renderObject);
+ addTouchPoints(event.type(), event.targetTouches(), targetTouches, &targetTouchesLength, renderObject);
}
#endif // ENABLE(TOUCH_EVENTS)
#if ENABLE(GESTURE_EVENTS)
-WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const GestureEvent& event)
+WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const WebCore::RenderObject* renderObject, const GestureEvent& event)
{
if (event.type() == eventNames().gesturetapEvent)
type = GestureTap;
@@ -584,8 +588,9 @@
globalX = event.screenX();
globalY = event.screenY();
- x = event.absoluteLocation().x() - widget->location().x();
- y = event.absoluteLocation().y() - widget->location().y();
+ IntPoint localPoint = convertLocationForRenderObject(event.absoluteLocation(), *renderObject);
+ x = localPoint.x();
+ y = localPoint.y();
}
#endif // ENABLE(GESTURE_EVENTS)
Modified: trunk/Source/WebKit/chromium/src/WebInputEventConversion.h (130764 => 130765)
--- trunk/Source/WebKit/chromium/src/WebInputEventConversion.h 2012-10-09 15:03:43 UTC (rev 130764)
+++ trunk/Source/WebKit/chromium/src/WebInputEventConversion.h 2012-10-09 15:13:30 UTC (rev 130765)
@@ -42,9 +42,10 @@
class GestureEvent;
class KeyboardEvent;
class MouseEvent;
+class RenderObject;
class ScrollView;
+class TouchEvent;
class WheelEvent;
-class TouchEvent;
class Widget;
}
@@ -97,21 +98,20 @@
};
#endif
-// Converts a WebCore::MouseEvent to a corresponding WebMouseEvent. view is
-// the ScrollView corresponding to the event.
+// Converts a WebCore::MouseEvent to a corresponding WebMouseEvent.
// NOTE: This is only implemented for mousemove, mouseover, mouseout,
// mousedown and mouseup. If the event mapping fails, the event type will
// be set to Undefined.
class WebMouseEventBuilder : public WebMouseEvent {
public:
- WebMouseEventBuilder(const WebCore::Widget*, const WebCore::MouseEvent&);
+ WebMouseEventBuilder(const WebCore::Widget*, const WebCore::RenderObject*, const WebCore::MouseEvent&);
};
// Converts a WebCore::WheelEvent to a corresponding WebMouseWheelEvent.
// If the event mapping fails, the event type will be set to Undefined.
class WebMouseWheelEventBuilder : public WebMouseWheelEvent {
public:
- WebMouseWheelEventBuilder(const WebCore::Widget*, const WebCore::WheelEvent&);
+ WebMouseWheelEventBuilder(const WebCore::Widget*, const WebCore::RenderObject*, const WebCore::WheelEvent&);
};
// Converts a WebCore::KeyboardEvent to a corresponding WebKeyboardEvent.
@@ -128,7 +128,7 @@
// exceeding that cap will be dropped.
class WebTouchEventBuilder : public WebTouchEvent {
public:
- WebTouchEventBuilder(const WebCore::Widget*, const WebCore::TouchEvent&);
+ WebTouchEventBuilder(const WebCore::Widget*, const WebCore::RenderObject*, const WebCore::TouchEvent&);
};
#endif // ENABLE(TOUCH_EVENTS)
@@ -137,7 +137,7 @@
// NOTE: If event mapping fails, the type will be set to Undefined.
class WebGestureEventBuilder : public WebGestureEvent {
public:
- WebGestureEventBuilder(const WebCore::Widget*, const WebCore::GestureEvent&);
+ WebGestureEventBuilder(const WebCore::Widget*, const WebCore::RenderObject*, const WebCore::GestureEvent&);
};
#endif // ENABLE(GESTURE_EVENTS)
Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp (130764 => 130765)
--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp 2012-10-09 15:03:43 UTC (rev 130764)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp 2012-10-09 15:13:30 UTC (rev 130765)
@@ -669,7 +669,7 @@
// in the call to HandleEvent. See http://b/issue?id=1362948
FrameView* parentView = static_cast<FrameView*>(parent());
- WebMouseEventBuilder webEvent(this, *event);
+ WebMouseEventBuilder webEvent(this, m_element->renderer(), *event);
if (webEvent.type == WebInputEvent::Undefined)
return;
@@ -734,7 +734,7 @@
void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event)
{
- WebMouseWheelEventBuilder webEvent(this, *event);
+ WebMouseWheelEventBuilder webEvent(this, m_element->renderer(), *event);
if (webEvent.type == WebInputEvent::Undefined)
return;
@@ -785,7 +785,7 @@
{
if (!m_isAcceptingTouchEvents)
return;
- WebTouchEventBuilder webEvent(this, *event);
+ WebTouchEventBuilder webEvent(this, m_element->renderer(), *event);
if (webEvent.type == WebInputEvent::Undefined)
return;
WebCursorInfo cursorInfo;
@@ -796,7 +796,7 @@
void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event)
{
- WebGestureEventBuilder webEvent(this, *event);
+ WebGestureEventBuilder webEvent(this, m_element->renderer(), *event);
if (webEvent.type == WebInputEvent::Undefined)
return;
WebCursorInfo cursorInfo;
Modified: trunk/Tools/ChangeLog (130764 => 130765)
--- trunk/Tools/ChangeLog 2012-10-09 15:03:43 UTC (rev 130764)
+++ trunk/Tools/ChangeLog 2012-10-09 15:13:30 UTC (rev 130765)
@@ -1,3 +1,15 @@
+2012-10-09 Sadrul Habib Chowdhury <[email protected]>
+
+ [chromium] Make sure events are transformed correctly for plugins.
+ https://bugs.webkit.org/show_bug.cgi?id=89250
+
+ Reviewed by Tony Chang.
+
+ Update the test plugin to print event details for mouse and gesture events.
+
+ * DumpRenderTree/chromium/TestWebPlugin.cpp:
+ (printEventDetails):
+
2012-10-09 Simon Hausmann <[email protected]>
Unreviewed trivial Qt build fix: Remove stray closing braces from r130758.
Modified: trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp (130764 => 130765)
--- trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp 2012-10-09 15:03:43 UTC (rev 130764)
+++ trunk/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp 2012-10-09 15:13:30 UTC (rev 130765)
@@ -109,6 +109,12 @@
printTouchList(touch.touches, touch.touchesLength);
printTouchList(touch.changedTouches, touch.changedTouchesLength);
printTouchList(touch.targetTouches, touch.targetTouchesLength);
+ } else if (WebKit::WebInputEvent::isMouseEventType(event.type) || event.type == WebKit::WebInputEvent::MouseWheel) {
+ const WebKit::WebMouseEvent& mouse = static_cast<const WebKit::WebMouseEvent&>(event);
+ printf("* %d, %d\n", mouse.x, mouse.y);
+ } else if (WebKit::WebInputEvent::isGestureEventType(event.type)) {
+ const WebKit::WebGestureEvent& gesture = static_cast<const WebKit::WebGestureEvent&>(event);
+ printf("* %d, %d\n", gesture.x, gesture.y);
}
}