diff options
author | Ben Murdoch <benm@google.com> | 2010-10-15 17:12:52 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-10-15 17:33:53 +0100 |
commit | 9dfa8dc622519374a57a0b24ab9d7f73afe160ed (patch) | |
tree | cf85774d399aa30c22eee8eff8e50c3a6de2a621 /WebCore/dom | |
parent | 09fce604f7e67802272bf991cb667509521c36b3 (diff) | |
download | external_webkit-9dfa8dc622519374a57a0b24ab9d7f73afe160ed.zip external_webkit-9dfa8dc622519374a57a0b24ab9d7f73afe160ed.tar.gz external_webkit-9dfa8dc622519374a57a0b24ab9d7f73afe160ed.tar.bz2 |
Implement the document.createTouch and document.createTouchList APIs
These are Apple extensions to the document object present on iOS
and are used by several sites to detect touch event support.
See
http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
for Apple's documentation.
Upstreaming to webkit being tracked in
https://bugs.webkit.org/show_bug.cgi?id=47676
Bug: 2996106
Change-Id: I761b1494af60b5095ad9c47d54eb7240d47ae985
Diffstat (limited to 'WebCore/dom')
-rw-r--r-- | WebCore/dom/Document.cpp | 13 | ||||
-rw-r--r-- | WebCore/dom/Document.h | 10 | ||||
-rw-r--r-- | WebCore/dom/Document.idl | 12 |
3 files changed, 35 insertions, 0 deletions
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index 333b8db..bffc07c 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -4826,4 +4826,17 @@ void Document::decrementLoadEventDelayCount() frame()->loader()->checkCompleted(); } +#if ENABLE(TOUCH_EVENTS) +PassRefPtr<Touch> Document::createTouch(DOMWindow* window, Node* target, int identifier, int pageX, int pageY, int screenX, int screenY, ExceptionCode&) const +{ + Frame* frame = window ? window->frame() : this->frame(); + return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY); +} + +PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const +{ + return TouchList::create(); +} +#endif + } // namespace WebCore diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index fa3d9fb..41a486a 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -136,6 +136,11 @@ class XPathResult; struct DashboardRegionValue; #endif +#if ENABLE(TOUCH_EVENTS) +class Touch; +class TouchList; +#endif + typedef int ExceptionCode; class FormElementKey { @@ -1041,6 +1046,11 @@ public: void decrementLoadEventDelayCount(); bool isDelayingLoadEvent() const { return m_loadEventDelayCount; } +#if ENABLE(TOUCH_EVENTS) + PassRefPtr<Touch> createTouch(DOMWindow*, Node*, int identifier, int pageX, int pageY, int screenX, int screenY, ExceptionCode&) const; + PassRefPtr<TouchList> createTouchList(ExceptionCode&) const; +#endif + protected: Document(Frame*, const KURL& url, bool isXHTML, bool isHTML, const KURL& baseURL = KURL()); diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl index e551f88..02eb30d 100644 --- a/WebCore/dom/Document.idl +++ b/WebCore/dom/Document.idl @@ -321,6 +321,18 @@ module core { attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove; attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend; attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel; +#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS + [ReturnsNew] Touch createTouch(in DOMWindow window, + in Node target, + in long identifier, + in long pageX, + in long pageY, + in long ScreenX, + in long screenY) + raises (DOMException); + [ReturnsNew] TouchList createTouchList() + raises (DOMException); +#endif attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange; #endif |