Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (94634 => 94635)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-09-07 04:34:07 UTC (rev 94634)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-09-07 04:35:49 UTC (rev 94635)
@@ -1,3 +1,19 @@
+2011-09-06 Eric Boren <[email protected]>
+
+ [Chromium] Modify WebTouchEvent structure to match WebCore::TouchEvent
+ https://bugs.webkit.org/show_bug.cgi?id=66800
+
+ Reviewed by Darin Fisher.
+
+ * public/WebInputEvent.h:
+ (WebKit::WebTouchEvent::WebTouchEvent):
+ * public/WebTouchPoint.h:
+ (WebKit::WebTouchPoint::WebTouchPoint):
+ * src/WebInputEventConversion.cpp:
+ (WebKit::PlatformTouchEventBuilder::PlatformTouchEventBuilder):
+ (WebKit::WebTouchEventBuilder::WebTouchEventBuilder):
+ * src/WebInputEventConversion.h:
+
2011-09-06 Ben Smith <[email protected]>
[chromium] Fix WebFrameClient receiving isRedirect when reloading
Modified: trunk/Source/WebKit/chromium/public/WebInputEvent.h (94634 => 94635)
--- trunk/Source/WebKit/chromium/public/WebInputEvent.h 2011-09-07 04:34:07 UTC (rev 94634)
+++ trunk/Source/WebKit/chromium/public/WebInputEvent.h 2011-09-07 04:35:49 UTC (rev 94635)
@@ -344,14 +344,25 @@
class WebTouchEvent : public WebInputEvent {
public:
- static const int touchPointsLengthCap = 4;
+ enum { touchesLengthCap = 8 };
- int touchPointsLength;
- WebTouchPoint touchPoints[touchPointsLengthCap];
+ unsigned touchesLength;
+ // List of all touches which are currently down.
+ WebTouchPoint touches[touchesLengthCap];
+ unsigned changedTouchesLength;
+ // List of all touches whose state has changed since the last WebTouchEvent
+ WebTouchPoint changedTouches[touchesLengthCap];
+
+ unsigned targetTouchesLength;
+ // List of all touches which are currently down and are targeting the event recipient.
+ WebTouchPoint targetTouches[touchesLengthCap];
+
WebTouchEvent(unsigned sizeParam = sizeof(WebTouchEvent))
: WebInputEvent(sizeParam)
- , touchPointsLength(0)
+ , touchesLength(0)
+ , changedTouchesLength(0)
+ , targetTouchesLength(0)
{
}
};
Modified: trunk/Source/WebKit/chromium/public/WebTouchPoint.h (94634 => 94635)
--- trunk/Source/WebKit/chromium/public/WebTouchPoint.h 2011-09-07 04:34:07 UTC (rev 94634)
+++ trunk/Source/WebKit/chromium/public/WebTouchPoint.h 2011-09-07 04:35:49 UTC (rev 94635)
@@ -38,14 +38,8 @@
class WebTouchPoint {
public:
- enum Finger {
- FingerFirst,
- FingerSecond,
- FingerThird
- };
-
WebTouchPoint()
- : id(FingerFirst)
+ : id(0)
, state(StateUndefined)
, radiusX(0)
, radiusY(0)
Modified: trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp (94634 => 94635)
--- trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp 2011-09-07 04:34:07 UTC (rev 94634)
+++ trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp 2011-09-07 04:35:49 UTC (rev 94635)
@@ -39,6 +39,9 @@
#include "PlatformMouseEvent.h"
#include "PlatformWheelEvent.h"
#include "ScrollView.h"
+#include "Touch.h"
+#include "TouchEvent.h"
+#include "TouchList.h"
#include "WebInputEvent.h"
#include "WheelEvent.h"
#include "Widget.h"
@@ -47,6 +50,8 @@
namespace WebKit {
+static const double millisPerSecond = 1000.0;
+
// MakePlatformMouseEvent -----------------------------------------------------
PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMouseEvent& e)
@@ -261,8 +266,8 @@
m_metaKey = event.modifiers & WebInputEvent::MetaKey;
m_timestamp = event.timeStampSeconds;
- for (int i = 0; i < event.touchPointsLength; ++i)
- m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touchPoints[i]));
+ for (unsigned i = 0; i < event.touchesLength; ++i)
+ m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touches[i]));
}
#endif
@@ -296,7 +301,7 @@
type = WebInputEvent::ContextMenu;
else
return; // Skip all other mouse events.
- timeStampSeconds = event.timeStamp() * 1.0e-3;
+ timeStampSeconds = event.timeStamp() / millisPerSecond;
switch (event.button()) {
case LeftButton:
button = WebMouseEvent::ButtonLeft;
@@ -339,7 +344,7 @@
if (event.type() != eventNames().mousewheelEvent)
return;
type = WebInputEvent::MouseWheel;
- timeStampSeconds = event.timeStamp() * 1.0e-3;
+ timeStampSeconds = event.timeStamp() / millisPerSecond;
modifiers = getWebInputModifiers(event);
ScrollView* view = widget->parent();
IntPoint p = view->contentsToWindow(
@@ -369,7 +374,7 @@
else
return; // Skip all other keyboard events.
modifiers = getWebInputModifiers(event);
- timeStampSeconds = event.timeStamp() * 1.0e-3;
+ timeStampSeconds = event.timeStamp() / millisPerSecond;
windowsKeyCode = event.keyCode();
// The platform keyevent does not exist if the event was created using
@@ -377,12 +382,59 @@
if (!event.keyEvent())
return;
nativeKeyCode = event.keyEvent()->nativeVirtualKeyCode();
- unsigned int numChars = std::min(event.keyEvent()->text().length(),
- static_cast<unsigned int>(WebKeyboardEvent::textLengthCap));
- for (unsigned int i = 0; i < numChars; i++) {
+ unsigned numberOfCharacters = std::min(event.keyEvent()->text().length(), static_cast<unsigned>(textLengthCap));
+ for (unsigned i = 0; i < numberOfCharacters; ++i) {
text[i] = event.keyEvent()->text()[i];
unmodifiedText[i] = event.keyEvent()->unmodifiedText()[i];
}
}
+#if ENABLE(TOUCH_EVENTS)
+
+static void addTouchPoints(TouchList* touches, const IntPoint& offset, WebTouchPoint* touchPoints, unsigned* touchPointsLength)
+{
+ unsigned numberOfTouches = std::min(touches->length(), static_cast<unsigned>(WebTouchEvent::touchesLengthCap));
+ for (unsigned i = 0; i < numberOfTouches; ++i) {
+ const Touch* touch = touches->item(i);
+
+ 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.radiusX = touch->webkitRadiusX();
+ point.radiusY = touch->webkitRadiusY();
+ point.rotationAngle = touch->webkitRotationAngle();
+ point.force = touch->webkitForce();
+
+ touchPoints[i] = point;
+ }
+ *touchPointsLength = numberOfTouches;
+}
+
+WebTouchEventBuilder::WebTouchEventBuilder(const Widget* widget, const TouchEvent& event)
+{
+ if (event.type() == eventNames().touchstartEvent)
+ type = TouchStart;
+ else if (event.type() == eventNames().touchmoveEvent)
+ type = TouchMove;
+ else if (event.type() == eventNames().touchendEvent)
+ type = TouchEnd;
+ else if (event.type() == eventNames().touchcancelEvent)
+ type = TouchCancel;
+ else {
+ ASSERT_NOT_REACHED();
+ type = Undefined;
+ return;
+ }
+
+ modifiers = getWebInputModifiers(event);
+ timeStampSeconds = event.timeStamp() / millisPerSecond;
+
+ addTouchPoints(event.touches(), widget->location(), touches, &touchesLength);
+ addTouchPoints(event.changedTouches(), widget->location(), changedTouches, &changedTouchesLength);
+ addTouchPoints(event.targetTouches(), widget->location(), targetTouches, &targetTouchesLength);
+}
+
+#endif // ENABLE(TOUCH_EVENTS)
+
} // namespace WebKit
Modified: trunk/Source/WebKit/chromium/src/WebInputEventConversion.h (94634 => 94635)
--- trunk/Source/WebKit/chromium/src/WebInputEventConversion.h 2011-09-07 04:34:07 UTC (rev 94634)
+++ trunk/Source/WebKit/chromium/src/WebInputEventConversion.h 2011-09-07 04:35:49 UTC (rev 94635)
@@ -43,6 +43,7 @@
class MouseEvent;
class ScrollView;
class WheelEvent;
+class TouchEvent;
class Widget;
}
@@ -51,6 +52,7 @@
class WebMouseEvent;
class WebMouseWheelEvent;
class WebKeyboardEvent;
+class WebTouchEvent;
class WebGestureEvent;
// These classes are used to convert from WebInputEvent subclasses to
@@ -81,11 +83,13 @@
};
#if ENABLE(TOUCH_EVENTS)
+// Converts a WebTouchPoint to a WebCore::PlatformTouchPoint.
class PlatformTouchPointBuilder : public WebCore::PlatformTouchPoint {
public:
PlatformTouchPointBuilder(WebCore::Widget*, const WebTouchPoint&);
};
+// Converts a WebTouchEvent to a WebCore::PlatformTouchEvent.
class PlatformTouchEventBuilder : public WebCore::PlatformTouchEvent {
public:
PlatformTouchEventBuilder(WebCore::Widget*, const WebTouchEvent&);
@@ -117,6 +121,16 @@
WebKeyboardEventBuilder(const WebCore::KeyboardEvent&);
};
+#if ENABLE(TOUCH_EVENTS)
+// Converts a WebCore::TouchEvent to a corresponding WebTouchEvent.
+// NOTE: WebTouchEvents have a cap on the number of WebTouchPoints. Any points
+// exceeding that cap will be dropped.
+class WebTouchEventBuilder : public WebTouchEvent {
+public:
+ WebTouchEventBuilder(const WebCore::Widget*, const WebCore::TouchEvent&);
+};
+#endif // ENABLE(TOUCH_EVENTS)
+
} // namespace WebKit
#endif
Modified: trunk/Tools/ChangeLog (94634 => 94635)
--- trunk/Tools/ChangeLog 2011-09-07 04:34:07 UTC (rev 94634)
+++ trunk/Tools/ChangeLog 2011-09-07 04:35:49 UTC (rev 94635)
@@ -1,3 +1,13 @@
+2011-09-06 Eric Boren <[email protected]>
+
+ [Chromium] Modify WebTouchEvent structure to match WebCore::TouchEvent
+ https://bugs.webkit.org/show_bug.cgi?id=66800
+
+ Reviewed by Darin Fisher.
+
+ * DumpRenderTree/chromium/EventSender.cpp:
+ (EventSender::sendCurrentTouchEvent):
+
2011-09-06 Adam Barth <[email protected]>
garden-o-matic details view should having working rebaseline and next/previous buttons
Modified: trunk/Tools/DumpRenderTree/chromium/EventSender.cpp (94634 => 94635)
--- trunk/Tools/DumpRenderTree/chromium/EventSender.cpp 2011-09-07 04:34:07 UTC (rev 94634)
+++ trunk/Tools/DumpRenderTree/chromium/EventSender.cpp 2011-09-07 04:35:49 UTC (rev 94635)
@@ -948,16 +948,16 @@
void EventSender::sendCurrentTouchEvent(const WebInputEvent::Type type)
{
- ASSERT(static_cast<unsigned>(WebTouchEvent::touchPointsLengthCap) > touchPoints.size());
+ ASSERT(static_cast<unsigned>(WebTouchEvent::touchesLengthCap) > touchPoints.size());
webview()->layout();
WebTouchEvent touchEvent;
touchEvent.type = type;
touchEvent.modifiers = touchModifiers;
touchEvent.timeStampSeconds = getCurrentEventTimeSec();
- touchEvent.touchPointsLength = touchPoints.size();
+ touchEvent.touchesLength = touchPoints.size();
for (unsigned i = 0; i < touchPoints.size(); ++i)
- touchEvent.touchPoints[i] = touchPoints[i];
+ touchEvent.touches[i] = touchPoints[i];
webview()->handleInputEvent(touchEvent);
for (unsigned i = 0; i < touchPoints.size(); ++i) {