diff options
Diffstat (limited to 'WebCore/dom/Event.cpp')
-rw-r--r-- | WebCore/dom/Event.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/WebCore/dom/Event.cpp b/WebCore/dom/Event.cpp index be2b37b..b6abb2a 100644 --- a/WebCore/dom/Event.cpp +++ b/WebCore/dom/Event.cpp @@ -194,6 +194,30 @@ bool Event::isTouchEvent() const } #endif +bool Event::fromUserGesture() +{ + if (createdByDOM()) + return false; + + const AtomicString& type = this->type(); + return + // mouse events + type == eventNames().clickEvent || type == eventNames().mousedownEvent + || type == eventNames().mouseupEvent || type == eventNames().dblclickEvent + // keyboard events + || type == eventNames().keydownEvent || type == eventNames().keypressEvent + || type == eventNames().keyupEvent +#if ENABLE(TOUCH_EVENTS) + // touch events + || type == eventNames().touchstartEvent || type == eventNames().touchmoveEvent + || type == eventNames().touchendEvent || type == eventNames().touchcancelEvent +#endif + // other accepted events + || type == eventNames().selectEvent || type == eventNames().changeEvent + || type == eventNames().focusEvent || type == eventNames().blurEvent + || type == eventNames().submitEvent; +} + bool Event::storesResultAsString() const { return false; |