How To Create A TouchEvent In Chrome?
The W3C specification declares initTouchEvent as following: void initTouchEvent (in DOMString type, in boolean canBubble, in boole
Solution 1:
By looking at the Chromium source and Qiita (in Japanese), this seems like how its parameters are arranged:
initTouchEvent (TouchList touches,
TouchList targetTouches,
TouchList changedTouches,
String type,
Window view,
number screenX,
number screenY,
number clientX,
number clientY,
boolean ctrlKey,
boolean altKey,
boolean shiftKey,
boolean metaKey);
Notice Chrome does not follow the W3C spec.
Relevant part in the Chromium source:
TouchEvent.cpp
Line 63:
void TouchEvent::initTouchEvent(ScriptState* scriptState, TouchList* touches, TouchList* targetTouches,
TouchList* changedTouches, const AtomicString& type,
PassRefPtrWillBeRawPtr<AbstractView> view,
int, int, int, int,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
{
if (dispatched())
return;
if (scriptState->world().isIsolatedWorld())
UIEventWithKeyState::didCreateEventInIsolatedWorld(ctrlKey, altKey, shiftKey, metaKey);
bool cancelable = true;
if (type == EventTypeNames::touchcancel)
cancelable = false;
initUIEvent(type, true, cancelable, view, 0);
m_touches = touches;
m_targetTouches = targetTouches;
m_changedTouches = changedTouches;
m_ctrlKey = ctrlKey;
m_altKey = altKey;
m_shiftKey = shiftKey;
m_metaKey = metaKey;
}
Post a Comment for "How To Create A TouchEvent In Chrome?"