Changeset 122286 in webkit
- Timestamp:
- Jul 10, 2012 6:47:58 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r122281 r122286 1 2012-07-10 Kevin Ellis <kevers@chromium.org> 2 3 Input elements with type=range do not have default touch handlers. 4 https://bugs.webkit.org/show_bug.cgi?id=88807 5 6 Reviewed by Antonio Gomes. 7 8 Add automated test for manipulating an input slider via touch 9 events. 10 11 * fast/events/touch/script-tests/touch-slider-no-js-touch-listener.js: Added. 12 (checkPosition): 13 * fast/events/touch/script-tests/touch-slider.js: Added. 14 (onTouchStart): 15 (onTouchEnd): 16 (onKeyDown): 17 (checkPosition): 18 * fast/events/touch/touch-slider-expected.txt: Added. 19 * fast/events/touch/touch-slider-no-js-touch-listener-expected.txt: Added. 20 * fast/events/touch/touch-slider-no-js-touch-listener.html: Added. 21 * fast/events/touch/touch-slider.html: Added. 22 * platform/chromium/fast/events/touch/touch-slider-expected.txt: Added. 23 * platform/chromium/fast/events/touch/touch-slider-no-js-touch-listener-expected.txt: Added. 24 1 25 2012-07-10 Kenneth Russell <kbr@google.com> 2 26 -
trunk/Source/WebCore/ChangeLog
r122282 r122286 1 2012-07-10 Kevin Ellis <kevers@chromium.org> 2 3 Input elements with type=range do not have default touch handlers. 4 https://bugs.webkit.org/show_bug.cgi?id=88807 5 6 Reviewed by Antonio Gomes. 7 8 This patch adds support for touch event handling on input elements 9 and dragging a slider with touch start and move events. Previously, 10 manipulating a slider on a touch screen required generation of 11 synthetic mouse events. 12 13 Tests: fast/events/touch/touch-slider-no-js-touch-listener.html 14 fast/events/touch/touch-slider.html 15 16 * dom/Event.cpp: 17 (WebCore::Event::isTouchEvent): 18 (WebCore): 19 * dom/Event.h: 20 (Event): 21 * dom/Touch.cpp: 22 (WebCore::Touch::Touch): 23 * dom/Touch.h: 24 (WebCore::Touch::absoluteLocation): 25 (Touch): 26 * dom/TouchEvent.cpp: 27 (WebCore::TouchEvent::isTouchEvent): 28 (WebCore): 29 * dom/TouchEvent.h: 30 (TouchEvent): 31 * html/HTMLInputElement.cpp: 32 (WebCore::HTMLInputElement::HTMLInputElement): 33 (WebCore::HTMLInputElement::~HTMLInputElement): 34 (WebCore::HTMLInputElement::updateType): 35 (WebCore::HTMLInputElement::defaultEventHandler): 36 * html/HTMLInputElement.h: 37 (HTMLInputElement): 38 * html/InputType.cpp: 39 (WebCore): 40 (WebCore::InputType::handleTouchEvent): 41 (WebCore::InputType::hasTouchEventHandler): 42 * html/InputType.h: 43 (WebCore): 44 (ClickHandlingState): 45 (InputType): 46 * html/RangeInputType.cpp: 47 (WebCore): 48 (WebCore::RangeInputType::handleTouchEvent): 49 (WebCore::RangeInputType::hasTouchEventHandler): 50 * html/RangeInputType.h: 51 (RangeInputType): 52 * html/shadow/SliderThumbElement.h: 53 (SliderThumbElement): 54 1 55 2012-07-10 Pravin D <pravind.2k4@gmail.com> 2 56 -
trunk/Source/WebCore/dom/Event.cpp
r114867 r122286 127 127 } 128 128 129 bool Event::isTouchEvent() const 130 { 131 return false; 132 } 133 129 134 bool Event::isDragEvent() const 130 135 { -
trunk/Source/WebCore/dom/Event.h
r116039 r122286 121 121 virtual bool isMouseEvent() const; 122 122 virtual bool isKeyboardEvent() const; 123 virtual bool isTouchEvent() const; 123 124 124 125 // Drag events are a subset of mouse events. -
trunk/Source/WebCore/dom/Touch.cpp
r95901 r122286 30 30 #include "Touch.h" 31 31 32 #include "DOMWindow.h" 32 33 #include "Frame.h" 33 34 #include "FrameView.h" … … 69 70 , m_force(force) 70 71 { 72 float scaleFactor = frame->pageZoomFactor() * frame->frameScaleFactor(); 73 float x = pageX * scaleFactor; 74 float y = pageY * scaleFactor; 75 m_absoluteLocation = roundedLayoutPoint(FloatPoint(x, y)); 71 76 } 72 77 -
trunk/Source/WebCore/dom/Touch.h
r95901 r122286 30 30 31 31 #include "EventTarget.h" 32 #include "LayoutTypes.h" 32 33 #include <wtf/PassRefPtr.h> 33 34 #include <wtf/RefCounted.h> … … 60 61 float webkitRotationAngle() const { return m_rotationAngle; } 61 62 float webkitForce() const { return m_force; } 63 const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; } 62 64 63 65 private: … … 78 80 float m_rotationAngle; 79 81 float m_force; 82 LayoutPoint m_absoluteLocation; 80 83 }; 81 84 -
trunk/Source/WebCore/dom/TouchEvent.cpp
r113575 r122286 95 95 } 96 96 97 bool TouchEvent::isTouchEvent() const 98 { 99 return true; 100 } 101 97 102 } // namespace WebCore 98 103 -
trunk/Source/WebCore/dom/TouchEvent.h
r113575 r122286 70 70 bool isTouchHold() const { return m_touchHold; } 71 71 #endif 72 virtual bool isTouchEvent() const OVERRIDE; 72 73 73 74 virtual const AtomicString& interfaceName() const; -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r121519 r122286 68 68 #endif 69 69 70 #if ENABLE(TOUCH_EVENTS) 71 #include "TouchEvent.h" 72 #endif 73 70 74 using namespace std; 71 75 … … 99 103 , m_wasModifiedByUser(false) 100 104 , m_canReceiveDroppedFiles(false) 105 , m_hasTouchEventHandler(false) 101 106 , m_inputType(InputType::createText(this)) 102 107 { … … 131 136 if (isRadioButton()) 132 137 document()->formController()->checkedRadioButtons().removeButton(this); 138 #if ENABLE(TOUCH_EVENTS) 139 if (m_hasTouchEventHandler) 140 document()->didRemoveTouchEventHandler(); 141 #endif 133 142 } 134 143 … … 401 410 m_inputType = newType.release(); 402 411 m_inputType->createShadowSubtree(); 412 413 #if ENABLE(TOUCH_EVENTS) 414 bool hasTouchEventHandler = m_inputType->hasTouchEventHandler(); 415 if (hasTouchEventHandler != m_hasTouchEventHandler) { 416 if (hasTouchEventHandler) { 417 document()->didAddTouchEventHandler(); 418 document()->addListenerType(Document::TOUCH_LISTENER); 419 } else 420 document()->didRemoveTouchEventHandler(); 421 m_hasTouchEventHandler = hasTouchEventHandler; 422 } 423 #endif 403 424 404 425 setNeedsWillValidateCheck(); … … 1039 1060 } 1040 1061 1062 #if ENABLE(TOUCH_EVENTS) 1063 if (evt->isTouchEvent()) { 1064 m_inputType->handleTouchEvent(static_cast<TouchEvent*>(evt)); 1065 if (evt->defaultHandled()) 1066 return; 1067 } 1068 #endif 1069 1041 1070 if (evt->isKeyboardEvent() && evt->type() == eventNames().keydownEvent) { 1042 1071 m_inputType->handleKeydownEvent(static_cast<KeyboardEvent*>(evt)); -
trunk/Source/WebCore/html/HTMLInputElement.h
r121519 r122286 391 391 bool m_wasModifiedByUser : 1; 392 392 bool m_canReceiveDroppedFiles : 1; 393 bool m_hasTouchEventHandler: 1; 393 394 OwnPtr<InputType> m_inputType; 394 395 }; -
trunk/Source/WebCore/html/InputType.cpp
r121019 r122286 418 418 } 419 419 420 #if ENABLE(TOUCH_EVENTS) 421 void InputType::handleTouchEvent(TouchEvent*) 422 { 423 } 424 #endif 425 420 426 void InputType::forwardEvent(Event*) 421 427 { … … 873 879 { 874 880 } 881 882 #if ENABLE(TOUCH_EVENTS) 883 bool InputType::hasTouchEventHandler() const 884 { 885 return false; 886 } 887 #endif 875 888 876 889 String InputType::defaultToolTip() const -
trunk/Source/WebCore/html/InputType.h
r120695 r122286 62 62 class RenderObject; 63 63 class RenderStyle; 64 class TouchEvent; 64 65 class WheelEvent; 65 66 … … 68 69 struct ClickHandlingState { 69 70 WTF_MAKE_FAST_ALLOCATED; 71 70 72 public: 71 73 bool checked; … … 191 193 virtual void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*); 192 194 virtual void handleWheelEvent(WheelEvent*); 195 #if ENABLE(TOUCH_EVENTS) 196 virtual void handleTouchEvent(TouchEvent*); 197 #endif 193 198 virtual void forwardEvent(Event*); 194 199 // Helpers for event handlers. … … 203 208 virtual bool canBeSuccessfulSubmitButton(); 204 209 virtual void subtreeHasChanged(); 210 #if ENABLE(TOUCH_EVENTS) 211 virtual bool hasTouchEventHandler() const; 212 #endif 205 213 206 214 // Shadow tree handling -
trunk/Source/WebCore/html/RangeInputType.cpp
r120313 r122286 50 50 #include <wtf/PassOwnPtr.h> 51 51 52 #if ENABLE(TOUCH_EVENTS) 53 #include "Touch.h" 54 #include "TouchEvent.h" 55 #include "TouchList.h" 56 #endif 57 52 58 namespace WebCore { 53 59 … … 134 140 thumb->dragFrom(event->absoluteLocation()); 135 141 } 142 143 #if ENABLE(TOUCH_EVENTS) 144 #if ENABLE(TOUCH_SLIDER) 145 void RangeInputType::handleTouchEvent(TouchEvent* event) 146 { 147 if (element()->disabled() || element()->readOnly()) 148 return; 149 150 if (event->type() == eventNames().touchendEvent) { 151 event->setDefaultHandled(); 152 return; 153 } 154 155 TouchList* touches = event->targetTouches(); 156 if (touches->length() == 1) { 157 Touch* touch = touches->item(0); 158 SliderThumbElement* thumb = sliderThumbElementOf(element()); 159 thumb->setPositionFromPoint(touch->absoluteLocation()); 160 event->setDefaultHandled(); 161 } 162 } 163 164 bool RangeInputType::hasTouchEventHandler() const 165 { 166 return true; 167 } 168 #endif 169 #endif 136 170 137 171 void RangeInputType::handleKeydownEvent(KeyboardEvent* event) -
trunk/Source/WebCore/html/RangeInputType.h
r120313 r122286 52 52 virtual bool isSteppable() const OVERRIDE; 53 53 virtual void handleMouseDownEvent(MouseEvent*) OVERRIDE; 54 #if ENABLE(TOUCH_EVENTS) 55 #if ENABLE(TOUCH_SLIDER) 56 virtual void handleTouchEvent(TouchEvent*) OVERRIDE; 57 virtual bool hasTouchEventHandler() const OVERRIDE; 58 #endif 59 #endif 54 60 virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE; 55 61 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const OVERRIDE; -
trunk/Source/WebCore/html/shadow/SliderThumbElement.h
r95901 r122286 58 58 virtual const AtomicString& shadowPseudoId() const; 59 59 HTMLInputElement* hostInput() const; 60 void setPositionFromPoint(const LayoutPoint&); 60 61 61 62 private: … … 68 69 void startDragging(); 69 70 void stopDragging(); 70 void setPositionFromPoint(const LayoutPoint&);71 71 72 72 bool m_inDragMode; -
trunk/Source/WebKit/chromium/ChangeLog
r122284 r122286 1 2012-07-10 Kevin Ellis <kevers@chromium.org> 2 3 Input elements with type=range do not have default touch handlers. 4 https://bugs.webkit.org/show_bug.cgi?id=88807 5 6 Reviewed by Antonio Gomes. 7 8 Adds flag to enable native handling of touch events for input elements 9 with type=range. 10 11 * features.gypi: 12 1 13 2012-07-10 Adam Klein <adamk@chromium.org> 2 14 -
trunk/Source/WebKit/chromium/features.gypi
r122195 r122286 98 98 'ENABLE_TOUCH_EVENTS=<(enable_touch_events)', 99 99 'ENABLE_TOUCH_ICON_LOADING=<(enable_touch_icon_loading)', 100 'ENABLE_TOUCH_SLIDER=1', 100 101 'ENABLE_V8_SCRIPT_DEBUG_SERVER=1', 101 102 'ENABLE_VIDEO=1',
Note: See TracChangeset
for help on using the changeset viewer.