WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-81458-20120318143747.patch (text/plain), 7.21 KB, created by
Robert Kroeger
on 2012-03-18 11:37:49 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Robert Kroeger
Created:
2012-03-18 11:37:49 PDT
Size:
7.21 KB
patch
obsolete
>Subversion Revision: 111127 >diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp >index 48906ea5f95359d7104ff108296d946aeb11fcc8..80efe9d43a1cc4ea939108c2d8a7cdef0be08ff7 100644 >--- a/Source/WebKit/chromium/src/WebViewImpl.cpp >+++ b/Source/WebKit/chromium/src/WebViewImpl.cpp >@@ -31,6 +31,7 @@ > #include "config.h" > #include "WebViewImpl.h" > >+#include "ActivePlatformGestureAnimation.h" > #include "AutofillPopupMenuClient.h" > #include "AXObjectCache.h" > #include "BackForwardListChromium.h" >@@ -109,6 +110,7 @@ > #include "SpeechRecognitionClient.h" > #include "TextIterator.h" > #include "Timer.h" >+#include "TouchFlingPlatformGestureCurve.h" > #include "TraceEvent.h" > #include "TypingCommand.h" > #include "UserGestureIndicator.h" >@@ -143,6 +145,7 @@ > #include "platform/WebString.h" > #include "platform/WebVector.h" > #include "WebViewClient.h" >+#include "WheelEvent.h" > #include <wtf/ByteArray.h> > #include <wtf/CurrentTime.h> > #include <wtf/MainThread.h> >@@ -364,6 +367,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) > #if ENABLE(MEDIA_STREAM) > , m_userMediaClientImpl(this) > #endif >+ , m_flingmodifier(0) > { > // WebKit/win/WebView.cpp does the same thing, except they call the > // KJS specific wrapper around this method. We need to have threading >@@ -408,6 +412,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client) > #endif > > m_inspectorSettingsMap = adoptPtr(new SettingsMap); >+ >+ m_lastWheelPosition = WebPoint(-1, -1); >+ m_lastWheelGlobalPosition = WebPoint(-1, -1); > } > > WebViewImpl::~WebViewImpl() >@@ -603,11 +610,63 @@ bool WebViewImpl::mouseWheel(const WebMouseWheelEvent& event) > return mainFrameImpl()->frame()->eventHandler()->handleWheelEvent(platformEvent); > } > >+void WebViewImpl::scrollBy(const WebCore::IntPoint& delta) >+{ >+ WebMouseWheelEvent syntheticWheel; >+ const float tickDivisor = (float)WebCore::WheelEvent::tickMultiplier; >+ >+ syntheticWheel.deltaX = delta.x(); >+ syntheticWheel.deltaY = delta.y(); >+ syntheticWheel.wheelTicksX = delta.x() / tickDivisor; >+ syntheticWheel.wheelTicksY = delta.y() / tickDivisor; >+ syntheticWheel.hasPreciseScrollingDeltas = true; >+ syntheticWheel.x = m_lastWheelPosition.x; >+ syntheticWheel.y = m_lastWheelPosition.y; >+ syntheticWheel.globalX = m_lastWheelGlobalPosition.x; >+ syntheticWheel.globalY = m_lastWheelGlobalPosition.y; >+ syntheticWheel.modifiers = m_flingmodifier; >+ >+ mouseWheel(syntheticWheel); >+} >+ > #if ENABLE(GESTURE_EVENTS) > bool WebViewImpl::gestureEvent(const WebGestureEvent& event) > { >- PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); >- return mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); >+ switch (event.type) { >+ case WebInputEvent::GestureFlingStart: { >+ // FIXME: remove this in a subsequent patch revision. >+ fprintf(stderr, "got a fling start: %f %f\n", event.deltaX, event.deltaY); >+ m_lastWheelPosition = WebPoint(event.x, event.y); >+ m_lastWheelGlobalPosition = WebPoint(event.globalX, event.globalY); >+ FloatPoint fp(event.deltaX, event.deltaY); >+ // FIXME: Make the curve parametrizable from the browser. >+ m_gestureAnimation = ActivePlatformGestureAnimation::create(TouchFlingPlatformGestureCurve::create(fp), this); >+ scheduleAnimation(); >+ return false; >+ } >+ case WebInputEvent::GestureFlingCancel: >+ // FIXME: put this into a sub-function? >+ m_gestureAnimation.clear(); >+ m_flingmodifier = 0; >+ m_lastWheelPosition = WebPoint(-1, -1); >+ m_lastWheelGlobalPosition = WebPoint(-1, -1); >+ return false; >+ case WebInputEvent::GestureScrollBegin: >+ case WebInputEvent::GestureScrollEnd: >+ case WebInputEvent::GestureScrollUpdate: >+ case WebInputEvent::GestureTap: >+ case WebInputEvent::GestureTapDown: >+ case WebInputEvent::GestureDoubleTap: >+ case WebInputEvent::GesturePinchBegin: >+ case WebInputEvent::GesturePinchEnd: >+ case WebInputEvent::GesturePinchUpdate: { >+ PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); >+ return mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); >+ } >+ default: >+ ASSERT_NOT_REACHED(); >+ } >+ return false; > } > > void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec) >@@ -1267,6 +1326,14 @@ void WebViewImpl::animate(double frameBeginTime) > if (!frameBeginTime) > frameBeginTime = currentTime(); > >+ // Create synthetic wheel events as necessary for fling. >+ if (m_gestureAnimation) { >+ if (m_gestureAnimation->animate(frameBeginTime)) >+ scheduleAnimation(); >+ else >+ m_gestureAnimation.clear(); >+ } >+ > #if USE(ACCELERATED_COMPOSITING) > // In composited mode, we always go through the compositor so it can apply > // appropriate flow-control mechanisms. >@@ -2838,6 +2905,8 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa > m_observedNewNavigation = false; > if (!isNavigationWithinPage) > m_pageScaleFactorIsSet = false; >+ >+ m_gestureAnimation.clear(); > } > > void WebViewImpl::layoutUpdated(WebFrameImpl* webframe) >diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h >index 9d93969f8cf1fa604a3e95137dfe20881c199347..75f8fa58c5346a768187b98c8058801446989fe3 100644 >--- a/Source/WebKit/chromium/src/WebViewImpl.h >+++ b/Source/WebKit/chromium/src/WebViewImpl.h >@@ -52,11 +52,13 @@ > #include "IntRect.h" > #include "NotificationPresenterImpl.h" > #include "PageOverlayList.h" >+#include "PlatformGestureCurveTarget.h" > #include "UserMediaClientImpl.h" > #include <wtf/OwnPtr.h> > #include <wtf/RefCounted.h> > > namespace WebCore { >+class ActivePlatformGestureAnimation; > class ChromiumDataObject; > class DocumentLoader; > class Frame; >@@ -65,6 +67,7 @@ class HistoryItem; > class HitTestResult; > class KeyboardEvent; > class Page; >+class PlatformGestureCurveTarget; > class PlatformKeyboardEvent; > class PopupContainer; > class PopupMenuClient; >@@ -96,7 +99,7 @@ class WebMouseWheelEvent; > class WebSettingsImpl; > class WebTouchEvent; > >-class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl> { >+class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl>, public WebCore::PlatformGestureCurveTarget { > public: > enum AutoZoomType { > DoubleTap, >@@ -333,6 +336,9 @@ public: > void numberOfWheelEventHandlersChanged(unsigned); > void numberOfTouchEventHandlersChanged(unsigned); > >+ // PlatformGestureCurveTarget implementation for wheel fling. >+ virtual void scrollBy(const WebCore::IntPoint&); >+ > // Handles context menu events orignated via the the keyboard. These > // include the VK_APPS virtual key and the Shift+F10 combine. Code is > // based on the Webkit function bool WebView::handleContextMenuEvent(WPARAM >@@ -718,6 +724,10 @@ private: > #if ENABLE(MEDIA_STREAM) > UserMediaClientImpl m_userMediaClientImpl; > #endif >+ OwnPtr<WebCore::ActivePlatformGestureAnimation> m_gestureAnimation; >+ WebPoint m_lastWheelPosition; >+ WebPoint m_lastWheelGlobalPosition; >+ int m_flingmodifier; > }; > > } // namespace WebKit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 81458
:
132472
|
132496
|
132513
|
132516
|
132519
|
132571