| Index: Source/web/WebViewImpl.cpp
|
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
|
| index 5e2f87550859c5fc9913fc9a98807e382af7de04..3f6e5cb828dea0945983ecde15b60db01d8b9ac3 100644
|
| --- a/Source/web/WebViewImpl.cpp
|
| +++ b/Source/web/WebViewImpl.cpp
|
| @@ -375,6 +375,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
|
| , m_baseBackgroundColor(Color::white)
|
| , m_backgroundColorOverride(Color::transparent)
|
| , m_zoomFactorOverride(0)
|
| + , m_sentEarlyShowPress(false)
|
| {
|
| Page::PageClients pageClients;
|
| pageClients.chromeClient = &m_chromeClientImpl;
|
| @@ -630,6 +631,10 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
|
| // complicated set of cases handled below.
|
| switch (event.type) {
|
| case WebInputEvent::GestureShowPress:
|
| + // Skip if already seen a ShowPress triggered by TapDown.
|
| + if (m_sentEarlyShowPress)
|
| + return false;
|
| +
|
| // Queue a highlight animation, then hand off to regular handler.
|
| if (settingsImpl()->gestureTapHighlightEnabled())
|
| enableTapHighlightAtPoint(platformEvent);
|
| @@ -724,10 +729,13 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
|
| // GestureTap with tap count = 2 is used instead. So we drop GestureDoubleTap here.
|
| eventSwallowed = true;
|
| break;
|
| + case WebInputEvent::GestureTapDown:
|
| + m_sentEarlyShowPress = false;
|
| + eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(platformEvent);
|
| + break;
|
| case WebInputEvent::GestureScrollBegin:
|
| case WebInputEvent::GesturePinchBegin:
|
| m_client->cancelScheduledContentIntents();
|
| - case WebInputEvent::GestureTapDown:
|
| case WebInputEvent::GestureScrollEnd:
|
| case WebInputEvent::GestureScrollUpdate:
|
| case WebInputEvent::GestureScrollUpdateWithoutPropagation:
|
| @@ -743,9 +751,40 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event)
|
| ASSERT_NOT_REACHED();
|
| }
|
| m_client->didHandleGestureEvent(event, eventCancelled);
|
| +
|
| + if (event.type == WebInputEvent::GestureTapDown
|
| + && earlyGestureShowPress(platformEvent)) {
|
| + WebGestureEvent showPressEvent = event;
|
| + showPressEvent.type = WebInputEvent::GestureShowPress;
|
| + eventSwallowed = handleGestureEvent(showPressEvent);
|
| + // Ignore subsequent ShowPress events until another TapDown
|
| + m_sentEarlyShowPress = true;
|
| + }
|
| +
|
| return eventSwallowed;
|
| }
|
|
|
| +// GestureShowPress is normally delayed to avoid triggering on the start of a
|
| +// scroll, but when scrolling and pinching aren't possible we can do the
|
| +// ShowPress early, immediately after TapDown.
|
| +bool WebViewImpl::earlyGestureShowPress(const WebCore::PlatformGestureEvent& event)
|
| +{
|
| + LocalFrame* mainFrame = mainFrameImpl()->frame();
|
| + FrameView* frameView = mainFrame->view();
|
| +
|
| + if (frameView && !frameView->isScrollable() && !isPinchZoomable()) {
|
| + IntPoint adjustedPoint = event.position();
|
| + LocalFrame* eventFrame = mainFrame->eventHandler().frameForGestureEvent(event, adjustedPoint);
|
| + IntPoint hitTestPoint = eventFrame->view()->windowToContents(event.position());
|
| + HitTestResult result = eventFrame->eventHandler().hitTestResultAtPoint(hitTestPoint, HitTestRequest::TouchEvent | HitTestRequest::ReadOnly | HitTestRequest::AllowFrameScrollbars);
|
| +
|
| + // If no ancestor is scrollable then this couldn't possibly be the start of a scroll.
|
| + return !eventFrame->eventHandler().hasScrollableAncestor(result.innerElement());
|
| + }
|
| +
|
| + return false;
|
| +}
|
| +
|
| void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters& parameters)
|
| {
|
| TRACE_EVENT0("webkit", "WebViewImpl::transferActiveWheelFlingAnimation");
|
| @@ -2913,6 +2952,15 @@ float WebViewImpl::maximumPageScaleFactor() const
|
| return m_pageScaleConstraintsSet.finalConstraints().maximumScale;
|
| }
|
|
|
| +bool WebViewImpl::isPinchZoomable() const
|
| +{
|
| + // This covers all cases:
|
| + // * viewport user-scalable: no
|
| + // * viewport minimum and maximum scale equal
|
| + // * pinch disabled by command line flag
|
| + return minimumPageScaleFactor() != maximumPageScaleFactor();
|
| +}
|
| +
|
| void WebViewImpl::saveScrollAndScaleState()
|
| {
|
| m_savedPageScaleFactor = pageScaleFactor();
|
|
|