Changeset 107125 in webkit
- Timestamp:
- Feb 8, 2012, 1:12:58 PM (15 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 8 edited
-
ChangeLog (modified) (1 diff)
-
public/WebInputEvent.h (modified) (2 diffs)
-
src/WebCompositorInputHandlerImpl.cpp (modified) (2 diffs)
-
src/WebCompositorInputHandlerImpl.h (modified) (1 diff)
-
src/WebInputEventConversion.cpp (modified) (1 diff)
-
src/WebPopupMenuImpl.cpp (modified) (1 diff)
-
src/WebViewImpl.cpp (modified) (1 diff)
-
tests/WebCompositorInputHandlerImplTest.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r107117 r107125 1 2012-02-08 Sadrul Habib Chowdhury <sadrul@chromium.org> 2 3 Add support for pinch gesture processing in the MT compositor. 4 https://bugs.webkit.org/show_bug.cgi?id=77804 5 6 Reviewed by James Robinson. 7 8 * public/WebInputEvent.h: 9 * src/WebCompositorInputHandlerImpl.cpp: 10 (WebKit::WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl): 11 (WebKit::WebCompositorInputHandlerImpl::handleInputEvent): 12 * src/WebCompositorInputHandlerImpl.h: 13 (WebCompositorInputHandlerImpl): 14 * src/WebInputEventConversion.cpp: 15 (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder): 16 * src/WebPopupMenuImpl.cpp: 17 (WebKit::WebPopupMenuImpl::handleInputEvent): 18 * src/WebViewImpl.cpp: 19 (WebKit::WebViewImpl::handleInputEvent): 20 * tests/WebCompositorInputHandlerImplTest.cpp: 21 1 22 2012-02-08 Nico Weber <nicolasweber@gmx.de> 2 23 -
trunk/Source/WebKit/chromium/public/WebInputEvent.h
r106214 r107125 110 110 GestureTapDown, 111 111 GestureDoubleTap, 112 GesturePinchBegin, 113 GesturePinchEnd, 114 GesturePinchUpdate, 112 115 113 116 // WebTouchEvent … … 352 355 int globalX; 353 356 int globalY; 357 358 // NOTE: |deltaX| and |deltaY| represents the amount to scroll for Scroll gesture events. For Pinch gesture events, |deltaX| represents the scaling/magnification factor. 354 359 float deltaX; 355 360 float deltaY; -
trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp
r106987 r107125 84 84 #ifndef NDEBUG 85 85 , m_expectScrollUpdateEnd(false) 86 , m_expectPinchUpdateEnd(false) 86 87 #endif 87 88 , m_scrollStarted(false) … … 174 175 return; 175 176 } 177 } else if (event.type == WebInputEvent::GesturePinchBegin) { 178 ASSERT(!m_expectPinchUpdateEnd); 179 #ifndef NDEBUG 180 m_expectPinchUpdateEnd = true; 181 #endif 182 m_inputHandlerClient->pinchGestureBegin(); 183 m_client->didHandleInputEvent(); 184 return; 185 } else if (event.type == WebInputEvent::GesturePinchEnd) { 186 ASSERT(m_expectPinchUpdateEnd); 187 #ifndef NDEBUG 188 m_expectPinchUpdateEnd = false; 189 #endif 190 m_inputHandlerClient->pinchGestureEnd(); 191 m_client->didHandleInputEvent(); 192 return; 193 } else if (event.type == WebInputEvent::GesturePinchUpdate) { 194 ASSERT(m_expectPinchUpdateEnd); 195 const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); 196 m_inputHandlerClient->pinchGestureUpdate(gestureEvent.deltaX, IntPoint(gestureEvent.x, gestureEvent.y)); 197 m_client->didHandleInputEvent(); 198 return; 176 199 } 177 200 m_client->didNotHandleInputEvent(true /* sendToWidget */); -
trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h
r106987 r107125 73 73 #ifndef NDEBUG 74 74 bool m_expectScrollUpdateEnd; 75 bool m_expectPinchUpdateEnd; 75 76 #endif 76 77 bool m_scrollStarted; -
trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp
r106063 r107125 156 156 m_type = PlatformEvent::GestureDoubleTap; 157 157 break; 158 case WebInputEvent::GesturePinchBegin: 159 case WebInputEvent::GesturePinchEnd: 160 case WebInputEvent::GesturePinchUpdate: 161 // FIXME: Once PlatformGestureEvent is updated to support pinch, this should set m_type to appropriate PlatformEvent type. 162 ASSERT_NOT_REACHED(); 158 163 default: 159 164 ASSERT_NOT_REACHED(); -
trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp
r107036 r107125 276 276 case WebInputEvent::ContextMenu: 277 277 return false; 278 279 case WebInputEvent::GesturePinchBegin: 280 case WebInputEvent::GesturePinchEnd: 281 case WebInputEvent::GesturePinchUpdate: 282 // FIXME: Once PlatformGestureEvent is updated to support pinch, this should call handleGestureEvent, just like it currently does for gesture scroll. 283 return false; 278 284 } 279 285 return false; -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r107036 r107125 1417 1417 #endif 1418 1418 1419 #if ENABLE(GESTURE_EVENTS) 1420 case WebInputEvent::GesturePinchBegin: 1421 case WebInputEvent::GesturePinchEnd: 1422 case WebInputEvent::GesturePinchUpdate: 1423 // FIXME: Once PlatformGestureEvent is updated to support pinch, this should call handleGestureEvent, just like it currently does for gesture scroll. 1424 handled = false; 1425 break; 1426 #endif 1427 1419 1428 default: 1420 1429 handled = false; -
trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp
r106987 r107125 47 47 MockInputHandlerClient() 48 48 : m_scrollStatus(ScrollStarted) 49 , m_pinchStarted(false) 50 , m_pinchEnded(false) 51 , m_pinchMagnification(0) 49 52 { 50 53 } … … 52 55 53 56 void setScrollStatus(ScrollStatus status) { m_scrollStatus = status; } 57 58 bool pinchStarted() const { return m_pinchStarted; } 59 bool pinchEnded() const { return m_pinchEnded; } 60 float pinchMaginifcation() const { return m_pinchMagnification; } 61 62 void resetPinch() 63 { 64 m_pinchStarted = m_pinchStarted = false; 65 m_pinchMagnification = 0; 66 } 54 67 55 68 private: … … 63 76 64 77 virtual bool haveWheelEventHandlers() OVERRIDE { return false; } 65 virtual void pinchGestureBegin() OVERRIDE { } 66 virtual void pinchGestureUpdate(float magnifyDelta, const WebCore::IntPoint& anchor) OVERRIDE { } 67 virtual void pinchGestureEnd() OVERRIDE { } 78 virtual void pinchGestureBegin() OVERRIDE 79 { 80 m_pinchStarted = true; 81 } 82 virtual void pinchGestureUpdate(float magnifyDelta, const WebCore::IntPoint& anchor) OVERRIDE 83 { 84 m_pinchMagnification = magnifyDelta; 85 } 86 virtual void pinchGestureEnd() OVERRIDE 87 { 88 m_pinchEnded = true; 89 } 68 90 virtual void startPageScaleAnimation(const WebCore::IntSize& targetPosition, 69 91 bool anchorPoint, … … 73 95 74 96 ScrollStatus m_scrollStatus; 97 bool m_pinchStarted; 98 bool m_pinchEnded; 99 float m_pinchMagnification; 75 100 }; 76 101 … … 201 226 } 202 227 203 } 228 TEST(WebCompositorInputHandlerImpl, gesturePinch) 229 { 230 WebKit::WebCompositor::initialize(0); 231 #ifndef NDEBUG 232 // WebCompositorInputHandler APIs can only be called from the compositor thread. 233 WebCore::DebugScopedSetImplThread alwaysImplThread; 234 #endif 235 236 MockInputHandlerClient mockInputHandler; 237 OwnPtr<WebCompositorInputHandlerImpl> inputHandler = WebCompositorInputHandlerImpl::create(&mockInputHandler); 238 MockWebCompositorInputHandlerClient mockClient; 239 inputHandler->setClient(&mockClient); 240 241 WebKit::WebGestureEvent gesture; 242 243 gesture.type = WebKit::WebInputEvent::GesturePinchBegin; 244 inputHandler->handleInputEvent(gesture); 245 EXPECT_TRUE(mockClient.handled()); 246 EXPECT_FALSE(mockClient.sendToWidget()); 247 EXPECT_TRUE(mockInputHandler.pinchStarted()); 248 mockClient.reset(); 249 mockInputHandler.resetPinch(); 250 251 gesture.type = WebKit::WebInputEvent::GesturePinchUpdate; 252 gesture.deltaX = 1.5; 253 inputHandler->handleInputEvent(gesture); 254 EXPECT_TRUE(mockClient.handled()); 255 EXPECT_FALSE(mockClient.sendToWidget()); 256 EXPECT_FALSE(mockInputHandler.pinchEnded()); 257 EXPECT_EQ(1.5, mockInputHandler.pinchMaginifcation()); 258 mockClient.reset(); 259 mockInputHandler.resetPinch(); 260 261 gesture.type = WebKit::WebInputEvent::GesturePinchUpdate; 262 gesture.deltaX = 0.5; 263 inputHandler->handleInputEvent(gesture); 264 EXPECT_TRUE(mockClient.handled()); 265 EXPECT_FALSE(mockClient.sendToWidget()); 266 EXPECT_FALSE(mockInputHandler.pinchEnded()); 267 EXPECT_EQ(0.5, mockInputHandler.pinchMaginifcation()); 268 mockClient.reset(); 269 mockInputHandler.resetPinch(); 270 271 gesture.type = WebKit::WebInputEvent::GesturePinchEnd; 272 inputHandler->handleInputEvent(gesture); 273 EXPECT_TRUE(mockClient.handled()); 274 EXPECT_FALSE(mockClient.sendToWidget()); 275 EXPECT_TRUE(mockInputHandler.pinchEnded()); 276 mockClient.reset(); 277 mockInputHandler.resetPinch(); 278 279 inputHandler->setClient(0); 280 281 WebKit::WebCompositor::shutdown(); 282 } 283 284 }
Note:
See TracChangeset
for help on using the changeset viewer.