Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (107124 => 107125)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-02-08 21:02:53 UTC (rev 107124)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-02-08 21:12:58 UTC (rev 107125)
@@ -1,3 +1,24 @@
+2012-02-08 Sadrul Habib Chowdhury <sad...@chromium.org>
+
+ Add support for pinch gesture processing in the MT compositor.
+ https://bugs.webkit.org/show_bug.cgi?id=77804
+
+ Reviewed by James Robinson.
+
+ * public/WebInputEvent.h:
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl):
+ (WebKit::WebCompositorInputHandlerImpl::handleInputEvent):
+ * src/WebCompositorInputHandlerImpl.h:
+ (WebCompositorInputHandlerImpl):
+ * src/WebInputEventConversion.cpp:
+ (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
+ * src/WebPopupMenuImpl.cpp:
+ (WebKit::WebPopupMenuImpl::handleInputEvent):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::handleInputEvent):
+ * tests/WebCompositorInputHandlerImplTest.cpp:
+
2012-02-08 Nico Weber <nicolaswe...@gmx.de>
[chromium] Make dependency on Accelerate.framework explicit.
Modified: trunk/Source/WebKit/chromium/public/WebInputEvent.h (107124 => 107125)
--- trunk/Source/WebKit/chromium/public/WebInputEvent.h 2012-02-08 21:02:53 UTC (rev 107124)
+++ trunk/Source/WebKit/chromium/public/WebInputEvent.h 2012-02-08 21:12:58 UTC (rev 107125)
@@ -109,6 +109,9 @@
GestureTap,
GestureTapDown,
GestureDoubleTap,
+ GesturePinchBegin,
+ GesturePinchEnd,
+ GesturePinchUpdate,
// WebTouchEvent
TouchStart,
@@ -351,6 +354,8 @@
int y;
int globalX;
int globalY;
+
+ // NOTE: |deltaX| and |deltaY| represents the amount to scroll for Scroll gesture events. For Pinch gesture events, |deltaX| represents the scaling/magnification factor.
float deltaX;
float deltaY;
Modified: trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp (107124 => 107125)
--- trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp 2012-02-08 21:02:53 UTC (rev 107124)
+++ trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp 2012-02-08 21:12:58 UTC (rev 107125)
@@ -83,6 +83,7 @@
, m_inputHandlerClient(inputHandlerClient)
#ifndef NDEBUG
, m_expectScrollUpdateEnd(false)
+ , m_expectPinchUpdateEnd(false)
#endif
, m_scrollStarted(false)
{
@@ -173,6 +174,28 @@
m_scrollStarted = false;
return;
}
+ } else if (event.type == WebInputEvent::GesturePinchBegin) {
+ ASSERT(!m_expectPinchUpdateEnd);
+#ifndef NDEBUG
+ m_expectPinchUpdateEnd = true;
+#endif
+ m_inputHandlerClient->pinchGestureBegin();
+ m_client->didHandleInputEvent();
+ return;
+ } else if (event.type == WebInputEvent::GesturePinchEnd) {
+ ASSERT(m_expectPinchUpdateEnd);
+#ifndef NDEBUG
+ m_expectPinchUpdateEnd = false;
+#endif
+ m_inputHandlerClient->pinchGestureEnd();
+ m_client->didHandleInputEvent();
+ return;
+ } else if (event.type == WebInputEvent::GesturePinchUpdate) {
+ ASSERT(m_expectPinchUpdateEnd);
+ const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event);
+ m_inputHandlerClient->pinchGestureUpdate(gestureEvent.deltaX, IntPoint(gestureEvent.x, gestureEvent.y));
+ m_client->didHandleInputEvent();
+ return;
}
m_client->didNotHandleInputEvent(true /* sendToWidget */);
}
Modified: trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h (107124 => 107125)
--- trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h 2012-02-08 21:02:53 UTC (rev 107124)
+++ trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h 2012-02-08 21:12:58 UTC (rev 107125)
@@ -72,6 +72,7 @@
#ifndef NDEBUG
bool m_expectScrollUpdateEnd;
+ bool m_expectPinchUpdateEnd;
#endif
bool m_scrollStarted;
Modified: trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp (107124 => 107125)
--- trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp 2012-02-08 21:02:53 UTC (rev 107124)
+++ trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp 2012-02-08 21:12:58 UTC (rev 107125)
@@ -155,6 +155,11 @@
case WebInputEvent::GestureDoubleTap:
m_type = PlatformEvent::GestureDoubleTap;
break;
+ case WebInputEvent::GesturePinchBegin:
+ case WebInputEvent::GesturePinchEnd:
+ case WebInputEvent::GesturePinchUpdate:
+ // FIXME: Once PlatformGestureEvent is updated to support pinch, this should set m_type to appropriate PlatformEvent type.
+ ASSERT_NOT_REACHED();
default:
ASSERT_NOT_REACHED();
}
Modified: trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp (107124 => 107125)
--- trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp 2012-02-08 21:02:53 UTC (rev 107124)
+++ trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp 2012-02-08 21:12:58 UTC (rev 107125)
@@ -275,6 +275,12 @@
case WebInputEvent::MouseEnter:
case WebInputEvent::ContextMenu:
return false;
+
+ case WebInputEvent::GesturePinchBegin:
+ case WebInputEvent::GesturePinchEnd:
+ case WebInputEvent::GesturePinchUpdate:
+ // FIXME: Once PlatformGestureEvent is updated to support pinch, this should call handleGestureEvent, just like it currently does for gesture scroll.
+ return false;
}
return false;
}
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (107124 => 107125)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-02-08 21:02:53 UTC (rev 107124)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-02-08 21:12:58 UTC (rev 107125)
@@ -1416,6 +1416,15 @@
break;
#endif
+#if ENABLE(GESTURE_EVENTS)
+ case WebInputEvent::GesturePinchBegin:
+ case WebInputEvent::GesturePinchEnd:
+ case WebInputEvent::GesturePinchUpdate:
+ // FIXME: Once PlatformGestureEvent is updated to support pinch, this should call handleGestureEvent, just like it currently does for gesture scroll.
+ handled = false;
+ break;
+#endif
+
default:
handled = false;
}
Modified: trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp (107124 => 107125)
--- trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp 2012-02-08 21:02:53 UTC (rev 107124)
+++ trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp 2012-02-08 21:12:58 UTC (rev 107125)
@@ -46,12 +46,25 @@
public:
MockInputHandlerClient()
: m_scrollStatus(ScrollStarted)
+ , m_pinchStarted(false)
+ , m_pinchEnded(false)
+ , m_pinchMagnification(0)
{
}
virtual ~MockInputHandlerClient() { }
void setScrollStatus(ScrollStatus status) { m_scrollStatus = status; }
+ bool pinchStarted() const { return m_pinchStarted; }
+ bool pinchEnded() const { return m_pinchEnded; }
+ float pinchMaginifcation() const { return m_pinchMagnification; }
+
+ void resetPinch()
+ {
+ m_pinchStarted = m_pinchStarted = false;
+ m_pinchMagnification = 0;
+ }
+
private:
virtual void setNeedsRedraw() OVERRIDE { }
virtual ScrollStatus scrollBegin(const WebCore::IntPoint&) OVERRIDE
@@ -62,9 +75,18 @@
virtual void scrollEnd() OVERRIDE { }
virtual bool haveWheelEventHandlers() OVERRIDE { return false; }
- virtual void pinchGestureBegin() OVERRIDE { }
- virtual void pinchGestureUpdate(float magnifyDelta, const WebCore::IntPoint& anchor) OVERRIDE { }
- virtual void pinchGestureEnd() OVERRIDE { }
+ virtual void pinchGestureBegin() OVERRIDE
+ {
+ m_pinchStarted = true;
+ }
+ virtual void pinchGestureUpdate(float magnifyDelta, const WebCore::IntPoint& anchor) OVERRIDE
+ {
+ m_pinchMagnification = magnifyDelta;
+ }
+ virtual void pinchGestureEnd() OVERRIDE
+ {
+ m_pinchEnded = true;
+ }
virtual void startPageScaleAnimation(const WebCore::IntSize& targetPosition,
bool anchorPoint,
float pageScale,
@@ -72,6 +94,9 @@
double durationMs) OVERRIDE { }
ScrollStatus m_scrollStatus;
+ bool m_pinchStarted;
+ bool m_pinchEnded;
+ float m_pinchMagnification;
};
class MockWebCompositorInputHandlerClient : public WebKit::WebCompositorInputHandlerClient {
@@ -200,4 +225,60 @@
WebKit::WebCompositor::shutdown();
}
+TEST(WebCompositorInputHandlerImpl, gesturePinch)
+{
+ WebKit::WebCompositor::initialize(0);
+#ifndef NDEBUG
+ // WebCompositorInputHandler APIs can only be called from the compositor thread.
+ WebCore::DebugScopedSetImplThread alwaysImplThread;
+#endif
+
+ MockInputHandlerClient mockInputHandler;
+ OwnPtr<WebCompositorInputHandlerImpl> inputHandler = WebCompositorInputHandlerImpl::create(&mockInputHandler);
+ MockWebCompositorInputHandlerClient mockClient;
+ inputHandler->setClient(&mockClient);
+
+ WebKit::WebGestureEvent gesture;
+
+ gesture.type = WebKit::WebInputEvent::GesturePinchBegin;
+ inputHandler->handleInputEvent(gesture);
+ EXPECT_TRUE(mockClient.handled());
+ EXPECT_FALSE(mockClient.sendToWidget());
+ EXPECT_TRUE(mockInputHandler.pinchStarted());
+ mockClient.reset();
+ mockInputHandler.resetPinch();
+
+ gesture.type = WebKit::WebInputEvent::GesturePinchUpdate;
+ gesture.deltaX = 1.5;
+ inputHandler->handleInputEvent(gesture);
+ EXPECT_TRUE(mockClient.handled());
+ EXPECT_FALSE(mockClient.sendToWidget());
+ EXPECT_FALSE(mockInputHandler.pinchEnded());
+ EXPECT_EQ(1.5, mockInputHandler.pinchMaginifcation());
+ mockClient.reset();
+ mockInputHandler.resetPinch();
+
+ gesture.type = WebKit::WebInputEvent::GesturePinchUpdate;
+ gesture.deltaX = 0.5;
+ inputHandler->handleInputEvent(gesture);
+ EXPECT_TRUE(mockClient.handled());
+ EXPECT_FALSE(mockClient.sendToWidget());
+ EXPECT_FALSE(mockInputHandler.pinchEnded());
+ EXPECT_EQ(0.5, mockInputHandler.pinchMaginifcation());
+ mockClient.reset();
+ mockInputHandler.resetPinch();
+
+ gesture.type = WebKit::WebInputEvent::GesturePinchEnd;
+ inputHandler->handleInputEvent(gesture);
+ EXPECT_TRUE(mockClient.handled());
+ EXPECT_FALSE(mockClient.sendToWidget());
+ EXPECT_TRUE(mockInputHandler.pinchEnded());
+ mockClient.reset();
+ mockInputHandler.resetPinch();
+
+ inputHandler->setClient(0);
+
+ WebKit::WebCompositor::shutdown();
}
+
+}