Skip to content
Permalink
Browse files
2010-03-04 Garret Kelly <gdk@chromium.org>
        Reviewed by Darin Fisher.

        Changing private members from PlatformTouchEvent and PlatformTouchPoint
        to be protected, so that Chromium's PlatformTouchEventBuilder and
        PlatformTouchPointBuilder can access them. Exercised by the
        fast/events/touch tests.
        https://bugs.webkit.org/show_bug.cgi?id=35760

        * platform/PlatformTouchEvent.h:
        (WebCore::PlatformTouchEvent::~PlatformTouchEvent):
        * platform/PlatformTouchPoint.h:
        (WebCore::PlatformTouchPoint::~PlatformTouchPoint):
2010-03-04  Garret Kelly  <gdk@chromium.org>

        Reviewed by Darin Fisher.

        Adding PlatformTouchEventBuilder and PlatformTouchPointBuilder for
        converting Chromium WebTouchEvent and WebTouchPoint types to
        corresponding WebCore types.
        https://bugs.webkit.org/show_bug.cgi?id=35760

        * src/WebInputEventConversion.cpp:
        (WebKit::toPlatformTouchEventType):
        (WebKit::toPlatformTouchPointState):
        (WebKit::PlatformTouchPointBuilder::PlatformTouchPointBuilder):
        (WebKit::PlatformTouchEventBuilder::PlatformTouchEventBuilder):
        * src/WebInputEventConversion.h:

Canonical link: https://commits.webkit.org/46869@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55572 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
eseidel committed Mar 5, 2010
1 parent 1ecfa4d commit 15191f46e3bc19c991a566e12186fb1cf9b47f84
Showing 6 changed files with 103 additions and 2 deletions.
@@ -1,3 +1,18 @@
2010-03-04 Garret Kelly <gdk@chromium.org>

Reviewed by Darin Fisher.

Changing private members from PlatformTouchEvent and PlatformTouchPoint
to be protected, so that Chromium's PlatformTouchEventBuilder and
PlatformTouchPointBuilder can access them. Exercised by the
fast/events/touch tests.
https://bugs.webkit.org/show_bug.cgi?id=35760

* platform/PlatformTouchEvent.h:
(WebCore::PlatformTouchEvent::~PlatformTouchEvent):
* platform/PlatformTouchPoint.h:
(WebCore::PlatformTouchPoint::~PlatformTouchPoint):

2010-03-04 Fumitoshi Ukai <ukai@chromium.org>

Reviewed by Alexey Proskuryakov.
@@ -67,7 +67,7 @@ class PlatformTouchEvent {
bool shiftKey() const { return m_shiftKey; }
bool metaKey() const { return m_metaKey; }

private:
protected:
TouchEventType m_type;
Vector<PlatformTouchPoint> m_touchPoints;
bool m_ctrlKey;
@@ -55,7 +55,7 @@ class PlatformTouchPoint {
IntPoint screenPos() const { return m_screenPos; }
IntPoint pos() const { return m_pos; }

private:
protected:
unsigned m_id;
State m_state;
IntPoint m_screenPos;
@@ -1,3 +1,19 @@
2010-03-04 Garret Kelly <gdk@chromium.org>

Reviewed by Darin Fisher.

Adding PlatformTouchEventBuilder and PlatformTouchPointBuilder for
converting Chromium WebTouchEvent and WebTouchPoint types to
corresponding WebCore types.
https://bugs.webkit.org/show_bug.cgi?id=35760

* src/WebInputEventConversion.cpp:
(WebKit::toPlatformTouchEventType):
(WebKit::toPlatformTouchPointState):
(WebKit::PlatformTouchPointBuilder::PlatformTouchPointBuilder):
(WebKit::PlatformTouchEventBuilder::PlatformTouchEventBuilder):
* src/WebInputEventConversion.h:

2010-03-04 John Gregg <johnnyg@google.com>

Reviewed by Darin Fisher.
@@ -168,6 +168,63 @@ bool PlatformKeyboardEventBuilder::isCharacterKey() const
return true;
}

#if ENABLE(TOUCH_EVENTS)
static inline TouchEventType toPlatformTouchEventType(const WebInputEvent::Type type)
{
switch (type) {
case WebInputEvent::TouchStart:
return TouchStart;
case WebInputEvent::TouchMove:
return TouchMove;
case WebInputEvent::TouchEnd:
return TouchEnd;
case WebInputEvent::TouchCancel:
return TouchCancel;
default:
ASSERT_NOT_REACHED();
}
}

static inline PlatformTouchPoint::State toPlatformTouchPointState(const WebTouchPoint::State state)
{
switch (state) {
case WebTouchPoint::StateReleased:
return PlatformTouchPoint::TouchReleased;
case WebTouchPoint::StatePressed:
return PlatformTouchPoint::TouchPressed;
case WebTouchPoint::StateMoved:
return PlatformTouchPoint::TouchMoved;
case WebTouchPoint::StateStationary:
return PlatformTouchPoint::TouchStationary;
case WebTouchPoint::StateCancelled:
return PlatformTouchPoint::TouchCancelled;
case WebTouchPoint::StateUndefined:
ASSERT_NOT_REACHED();
}
}

PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTouchPoint& point)
{
m_id = point.id;
m_state = toPlatformTouchPointState(point.state);
m_pos = widget->convertFromContainingWindow(point.position);
m_screenPos = point.screenPosition;
}

PlatformTouchEventBuilder::PlatformTouchEventBuilder(Widget* widget, const WebTouchEvent& event)
{
m_type = toPlatformTouchEventType(event.type);
m_ctrlKey = event.modifiers & WebInputEvent::ControlKey;
m_altKey = event.modifiers & WebInputEvent::AltKey;
m_shiftKey = event.modifiers & WebInputEvent::ShiftKey;
m_metaKey = event.modifiers & WebInputEvent::MetaKey;

m_touchPoints.resize(event.touchPointsLength);
for (int i = 0; i < event.touchPointsLength; ++i)
m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touchPoints[i]));
}
#endif

static int getWebInputModifiers(const UIEventWithKeyState& event)
{
int modifiers = 0;
@@ -37,6 +37,7 @@

#include "PlatformKeyboardEvent.h"
#include "PlatformMouseEvent.h"
#include "PlatformTouchEvent.h"
#include "PlatformWheelEvent.h"

namespace WebCore {
@@ -72,6 +73,18 @@ class PlatformKeyboardEventBuilder : public WebCore::PlatformKeyboardEvent {
bool isCharacterKey() const;
};

#if ENABLE(TOUCH_EVENTS)
class PlatformTouchPointBuilder : public WebCore::PlatformTouchPoint {
public:
PlatformTouchPointBuilder(WebCore::Widget*, const WebTouchPoint&);
};

class PlatformTouchEventBuilder : public WebCore::PlatformTouchEvent {
public:
PlatformTouchEventBuilder(WebCore::Widget*, const WebTouchEvent&);
};
#endif

// Converts a WebCore::MouseEvent to a corresponding WebMouseEvent. view is
// the ScrollView corresponding to the event. Returns true if successful.
// NOTE: This is only implemented for mousemove, mouseover, mouseout,

0 comments on commit 15191f4

Please sign in to comment.