Changeset 51981 in webkit
- Timestamp:
- Dec 11, 2009 6:07:49 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 13 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r51980 r51981 1 2009-12-11 Simon Hausmann <hausmann@webkit.org>, Kim Grönholm <kim.gronholm@nomovok.com> 2 3 Reviewed by Antti Koivisto. 4 5 Added interfaces for touch event support in JavaScript. 6 7 https://bugs.webkit.org/show_bug.cgi?id=32114 8 9 The Touch, TouchEvent and TouchList interfaces come straight from 10 Android's copy of WebKit (eclaire branch). 11 12 The PlatformTouchEvent and PlatformTouchPoint code was written by 13 us. 14 15 No new tests added, we are just adding interfaces 16 with this patch. 17 18 * WebCore.pro: 19 * bindings/js/JSEventCustom.cpp: 20 (WebCore::toJS): 21 * dom/Document.cpp: 22 (WebCore::Document::addListenerTypeIfNeeded): 23 * dom/Document.h: 24 (WebCore::Document::): 25 * dom/Document.idl: 26 * dom/Element.h: 27 * dom/Element.idl: 28 * dom/Event.cpp: 29 (WebCore::Event::isTouchEvent): 30 * dom/Event.h: 31 * dom/EventNames.h: 32 * dom/Touch.cpp: Added. 33 (WebCore::contentsX): 34 (WebCore::contentsY): 35 (WebCore::Touch::Touch): 36 (WebCore::Touch::updateLocation): 37 * dom/Touch.h: Added. 38 (WebCore::Touch::create): 39 (WebCore::Touch::frame): 40 (WebCore::Touch::target): 41 (WebCore::Touch::identifier): 42 (WebCore::Touch::clientX): 43 (WebCore::Touch::clientY): 44 (WebCore::Touch::screenX): 45 (WebCore::Touch::screenY): 46 (WebCore::Touch::pageX): 47 (WebCore::Touch::pageY): 48 * dom/Touch.idl: Added. 49 * dom/TouchEvent.cpp: Added. 50 (WebCore::TouchEvent::TouchEvent): 51 (WebCore::TouchEvent::initTouchEvent): 52 * dom/TouchEvent.h: Added. 53 (WebCore::TouchEvent::create): 54 (WebCore::TouchEvent::touches): 55 (WebCore::TouchEvent::targetTouches): 56 (WebCore::TouchEvent::changedTouches): 57 (WebCore::TouchEvent::TouchEvent): 58 (WebCore::TouchEvent::isTouchEvent): 59 * dom/TouchEvent.idl: Added. 60 * dom/TouchList.cpp: Added. 61 (WebCore::TouchList::item): 62 * dom/TouchList.h: Added. 63 (WebCore::TouchList::create): 64 (WebCore::TouchList::length): 65 (WebCore::TouchList::append): 66 (WebCore::TouchList::TouchList): 67 * dom/TouchList.idl: Added. 68 * html/HTMLAttributeNames.in: 69 * html/HTMLElement.cpp: 70 (WebCore::HTMLElement::parseMappedAttribute): 71 * page/DOMWindow.h: 72 * page/DOMWindow.idl: 73 * platform/PlatformTouchEvent.h: Added. 74 (WebCore::PlatformTouchEvent::PlatformTouchEvent): 75 (WebCore::PlatformTouchEvent::touchPoints): 76 * platform/PlatformTouchPoint.h: Added. 77 (WebCore::PlatformTouchPoint::): 78 (WebCore::PlatformTouchPoint::id): 79 (WebCore::PlatformTouchPoint::state): 80 (WebCore::PlatformTouchPoint::screenPos): 81 (WebCore::PlatformTouchPoint::pos): 82 * platform/qt/PlatformTouchEventQt.cpp: Added. 83 (WebCore::PlatformTouchEvent::PlatformTouchEvent): 84 * platform/qt/PlatformTouchPointQt.cpp: Added. 85 (WebCore::PlatformTouchPoint::PlatformTouchPoint): 86 1 87 2009-12-11 Grace Kloba <klobag@gmail.com> 2 88 -
trunk/WebCore/WebCore.pro
r51922 r51981 181 181 182 182 DEFINES += WTF_CHANGES=1 183 184 # Enable touch event support with Qt 4.6 185 !lessThan(QT_MINOR_VERSION, 6): DEFINES += ENABLE_TOUCH_EVENTS=1 183 186 184 187 # Used to compute defaults for the build-webkit script … … 368 371 dom/Text.idl \ 369 372 dom/TextEvent.idl \ 373 dom/Touch.idl \ 374 dom/TouchEvent.idl \ 375 dom/TouchList.idl \ 370 376 dom/TreeWalker.idl \ 371 377 dom/UIEvent.idl \ … … 922 928 dom/Text.cpp \ 923 929 dom/TextEvent.cpp \ 930 dom/Touch.cpp \ 931 dom/TouchEvent.cpp \ 932 dom/TouchList.cpp \ 924 933 dom/Traversal.cpp \ 925 934 dom/TreeWalker.cpp \ … … 1606 1615 dom/TextEvent.h \ 1607 1616 dom/Text.h \ 1617 dom/Touch.h \ 1618 dom/TouchEvent.h \ 1619 dom/TouchList.h \ 1608 1620 dom/TransformSource.h \ 1609 1621 dom/Traversal.h \ … … 1950 1962 platform/network/ResourceRequestBase.h \ 1951 1963 platform/network/ResourceResponseBase.h \ 1964 platform/PlatformTouchEvent.h \ 1965 platform/PlatformTouchPoint.h \ 1952 1966 platform/qt/ClipboardQt.h \ 1953 1967 platform/qt/QWebPageClient.h \ … … 2408 2422 platform/qt/PlatformMouseEventQt.cpp \ 2409 2423 platform/qt/PlatformScreenQt.cpp \ 2424 platform/qt/PlatformTouchEventQt.cpp \ 2425 platform/qt/PlatformTouchPointQt.cpp \ 2410 2426 platform/qt/PopupMenuQt.cpp \ 2411 2427 platform/qt/QWebPopup.cpp \ … … 2554 2570 contains(DEFINES, ENABLE_EVENTSOURCE=1) { 2555 2571 FEATURE_DEFINES_JAVASCRIPT += ENABLE_EVENTSOURCE=1 2572 } 2573 2574 contains(DEFINES, ENABLE_TOUCH_EVENTS=1) { 2575 FEATURE_DEFINES_JAVASCRIPT += ENABLE_TOUCH_EVENTS=1 2556 2576 } 2557 2577 -
trunk/WebCore/bindings/js/JSEventCustom.cpp
r51644 r51981 79 79 #endif 80 80 81 #if ENABLE(TOUCH_EVENTS) 82 #include "JSTouchEvent.h" 83 #include "TouchEvent.h" 84 #endif 85 81 86 using namespace JSC; 82 87 … … 114 119 else if (event->isCompositionEvent()) 115 120 wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CompositionEvent, event); 121 #if ENABLE(TOUCH_EVENTS) 122 else if (event->isTouchEvent()) 123 wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, TouchEvent, event); 124 #endif 116 125 else 117 126 wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, UIEvent, event); -
trunk/WebCore/dom/Document.cpp
r51793 r51981 2978 2978 else if (eventType == eventNames().beforeloadEvent) 2979 2979 addListenerType(BEFORELOAD_LISTENER); 2980 else if (eventType == eventNames().touchstartEvent 2981 || eventType == eventNames().touchmoveEvent 2982 || eventType == eventNames().touchendEvent) 2983 addListenerType(TOUCH_LISTENER); 2980 2984 } 2981 2985 -
trunk/WebCore/dom/Document.h
r51680 r51981 253 253 DEFINE_ATTRIBUTE_EVENT_LISTENER(search); 254 254 DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart); 255 #if ENABLE(TOUCH_EVENTS) 256 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); 257 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); 258 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); 259 #endif 255 260 256 261 DocumentType* doctype() const { return m_docType.get(); } … … 621 626 ANIMATIONITERATION_LISTENER = 0x400, 622 627 TRANSITIONEND_LISTENER = 0x800, 623 BEFORELOAD_LISTENER = 0x1000 628 BEFORELOAD_LISTENER = 0x1000, 629 TOUCH_LISTENER = 0x2000 624 630 }; 625 631 -
trunk/WebCore/dom/Document.idl
r51577 r51981 321 321 attribute [DontEnum] EventListener onsearch; 322 322 attribute [DontEnum] EventListener onselectstart; 323 #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS 324 attribute [DontEnum] EventListener ontouchstart; 325 attribute [DontEnum] EventListener ontouchmove; 326 attribute [DontEnum] EventListener ontouchend; 327 #endif 323 328 #endif 324 329 #endif -
trunk/WebCore/dom/Element.h
r51566 r51981 89 89 DEFINE_ATTRIBUTE_EVENT_LISTENER(search); 90 90 DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart); 91 #if ENABLE(TOUCH_EVENTS) 92 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); 93 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); 94 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); 95 #endif 91 96 92 97 const AtomicString& getIDAttribute() const; -
trunk/WebCore/dom/Element.idl
r48728 r51981 204 204 attribute [DontEnum] EventListener onsearch; 205 205 attribute [DontEnum] EventListener onselectstart; 206 #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS 207 attribute [DontEnum] EventListener ontouchstart; 208 attribute [DontEnum] EventListener ontouchmove; 209 attribute [DontEnum] EventListener ontouchend; 210 #endif 206 211 #endif 207 212 #endif -
trunk/WebCore/dom/Event.cpp
r51644 r51981 187 187 } 188 188 #endif 189 189 190 #if ENABLE(TOUCH_EVENTS) 191 bool Event::isTouchEvent() const 192 { 193 return false; 194 } 195 #endif 196 190 197 bool Event::storesResultAsString() const 191 198 { -
trunk/WebCore/dom/Event.h
r51644 r51981 127 127 virtual bool isErrorEvent() const; 128 128 #endif 129 #if ENABLE(TOUCH_EVENTS) 130 virtual bool isTouchEvent() const; 131 #endif 129 132 130 133 bool propagationStopped() const { return m_propagationStopped; } -
trunk/WebCore/dom/EventNames.h
r51644 r51981 147 147 macro(orientationchange) \ 148 148 \ 149 macro(touchstart) \ 150 macro(touchmove) \ 151 macro(touchend) \ 152 \ 149 153 // end of DOM_EVENT_NAMES_FOR_EACH 150 154 -
trunk/WebCore/html/HTMLAttributeNames.in
r51669 r51981 200 200 onsubmit 201 201 ontimeupdate 202 ontouchstart 203 ontouchmove 204 ontouchend 202 205 onunload 203 206 onvolumechange -
trunk/WebCore/html/HTMLElement.cpp
r49798 r51981 223 223 } else if (attr->name() == oninvalidAttr) { 224 224 setAttributeEventListener(eventNames().invalidEvent, createAttributeEventListener(this, attr)); 225 } else if (attr->name() == ontouchstartAttr) { 226 setAttributeEventListener(eventNames().touchstartEvent, createAttributeEventListener(this, attr)); 227 } else if (attr->name() == ontouchmoveAttr) { 228 setAttributeEventListener(eventNames().touchmoveEvent, createAttributeEventListener(this, attr)); 229 } else if (attr->name() == ontouchendAttr) { 230 setAttributeEventListener(eventNames().touchendEvent, createAttributeEventListener(this, attr)); 225 231 } 226 232 } -
trunk/WebCore/page/DOMWindow.h
r51644 r51981 323 323 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransitionEnd); 324 324 325 #if ENABLE(TOUCH_EVENTS) 326 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); 327 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); 328 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); 329 #endif 325 330 void captureEvents(); 326 331 void releaseEvents(); -
trunk/WebCore/page/DOMWindow.idl
r51971 r51981 290 290 attribute EventListener onorientationchange; 291 291 #endif 292 #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS 293 attribute [DontEnum] EventListener ontouchstart; 294 attribute [DontEnum] EventListener ontouchmove; 295 attribute [DontEnum] EventListener ontouchend; 296 #endif 292 297 293 298 // EventTarget interface … … 567 572 #endif 568 573 574 #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS 575 attribute TouchEventConstructor TouchEvent; 576 #endif 577 569 578 #endif // defined(LANGUAGE_JAVASCRIPT) 570 579
Note: See TracChangeset
for help on using the changeset viewer.