- Revision
- 137765
- Author
- [email protected]
- Date
- 2012-12-14 13:17:08 -0800 (Fri, 14 Dec 2012)
Log Message
Send a message from WebViewImpl to the compositor to inform about end of flings
https://bugs.webkit.org/show_bug.cgi?id=104947
Patch by Yusuf Ozuysal <[email protected]> on 2012-12-14
Reviewed by James Robinson.
Whenever we have a fling animation finished on cancelled on main thread this sends
a message that will be relayed to the compositor input handler. Then the input handler
keeps track of main thread fling with a boolean and doesn't send flingCancels
unnecessarily
Source/Platform:
* chromium/public/WebInputHandler.h:
(WebInputHandler):
* chromium/public/WebLayerTreeView.h:
(WebLayerTreeView):
(WebKit::WebLayerTreeView::mainThreadHasStoppedFlinging):
Source/WebKit/chromium:
* src/WebCompositorInputHandlerImpl.cpp:
(WebKit::WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl):
(WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal):
(WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
(WebKit::WebCompositorInputHandlerImpl::mainThreadHasStoppedFlinging):
(WebKit):
* src/WebCompositorInputHandlerImpl.h:
(WebCompositorInputHandlerImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::handleGestureEvent):
(WebKit::WebViewImpl::handleKeyEvent):
(WebKit::WebViewImpl::updateAnimations):
(WebKit::WebViewImpl::didCommitLoad):
Modified Paths
Diff
Modified: trunk/Source/Platform/ChangeLog (137764 => 137765)
--- trunk/Source/Platform/ChangeLog 2012-12-14 21:07:07 UTC (rev 137764)
+++ trunk/Source/Platform/ChangeLog 2012-12-14 21:17:08 UTC (rev 137765)
@@ -1,3 +1,21 @@
+2012-12-14 Yusuf Ozuysal <[email protected]>
+
+ Send a message from WebViewImpl to the compositor to inform about end of flings
+ https://bugs.webkit.org/show_bug.cgi?id=104947
+
+ Reviewed by James Robinson.
+
+ Whenever we have a fling animation finished on cancelled on main thread this sends
+ a message that will be relayed to the compositor input handler. Then the input handler
+ keeps track of main thread fling with a boolean and doesn't send flingCancels
+ unnecessarily
+
+ * chromium/public/WebInputHandler.h:
+ (WebInputHandler):
+ * chromium/public/WebLayerTreeView.h:
+ (WebLayerTreeView):
+ (WebKit::WebLayerTreeView::mainThreadHasStoppedFlinging):
+
2012-12-12 Gavin Peters <[email protected]>
[chromium] Add destructor to WebPrerender
Modified: trunk/Source/Platform/chromium/public/WebInputHandler.h (137764 => 137765)
--- trunk/Source/Platform/chromium/public/WebInputHandler.h 2012-12-14 21:07:07 UTC (rev 137764)
+++ trunk/Source/Platform/chromium/public/WebInputHandler.h 2012-12-14 21:17:08 UTC (rev 137765)
@@ -33,6 +33,7 @@
virtual void bindToClient(WebInputHandlerClient*) = 0;
virtual void animate(double monotonicTime) = 0;
+ virtual void mainThreadHasStoppedFlinging() = 0;
};
}
Modified: trunk/Source/Platform/chromium/public/WebLayerTreeView.h (137764 => 137765)
--- trunk/Source/Platform/chromium/public/WebLayerTreeView.h 2012-12-14 21:07:07 UTC (rev 137764)
+++ trunk/Source/Platform/chromium/public/WebLayerTreeView.h 2012-12-14 21:17:08 UTC (rev 137765)
@@ -158,6 +158,9 @@
// mode.
virtual void updateAnimations(double frameBeginTime) = 0;
+ // Relays the end of a fling animation.
+ virtual void didStopFlinging() { }
+
// Composites and attempts to read back the result into the provided
// buffer. If it wasn't possible, e.g. due to context lost, will return
// false. Pixel format is 32bit (RGBA), and the provided buffer must be
Modified: trunk/Source/WebKit/chromium/ChangeLog (137764 => 137765)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-12-14 21:07:07 UTC (rev 137764)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-12-14 21:17:08 UTC (rev 137765)
@@ -1,3 +1,29 @@
+2012-12-14 Yusuf Ozuysal <[email protected]>
+
+ Send a message from WebViewImpl to the compositor to inform about end of flings
+ https://bugs.webkit.org/show_bug.cgi?id=104947
+
+ Reviewed by James Robinson.
+
+ Whenever we have a fling animation finished on cancelled on main thread this sends
+ a message that will be relayed to the compositor input handler. Then the input handler
+ keeps track of main thread fling with a boolean and doesn't send flingCancels
+ unnecessarily
+
+ * src/WebCompositorInputHandlerImpl.cpp:
+ (WebKit::WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl):
+ (WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal):
+ (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
+ (WebKit::WebCompositorInputHandlerImpl::mainThreadHasStoppedFlinging):
+ (WebKit):
+ * src/WebCompositorInputHandlerImpl.h:
+ (WebCompositorInputHandlerImpl):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::handleGestureEvent):
+ (WebKit::WebViewImpl::handleKeyEvent):
+ (WebKit::WebViewImpl::updateAnimations):
+ (WebKit::WebViewImpl::didCommitLoad):
+
2012-12-14 Sheriff Bot <[email protected]>
Unreviewed, rolling out r137570.
Modified: trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp (137764 => 137765)
--- trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp 2012-12-14 21:07:07 UTC (rev 137764)
+++ trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp 2012-12-14 21:17:08 UTC (rev 137765)
@@ -71,6 +71,7 @@
#endif
, m_gestureScrollOnImplThread(false)
, m_gesturePinchOnImplThread(false)
+ , m_flingActiveOnMainThread(false)
{
}
@@ -198,6 +199,8 @@
} else if (event.type == WebInputEvent::GestureFlingCancel) {
if (cancelCurrentFling())
return DidHandle;
+ else if (!m_flingActiveOnMainThread)
+ return DropEvent;
#if ENABLE(TOUCH_EVENT_TRACKING)
} else if (event.type == WebInputEvent::TouchStart) {
const WebTouchEvent& touchEvent = *static_cast<const WebTouchEvent*>(&event);
@@ -230,6 +233,7 @@
}
case WebInputHandlerClient::ScrollStatusOnMainThread: {
TRACE_EVENT_INSTANT0("webkit", "WebCompositorInputHandlerImpl::handleGestureFling::scrollOnMainThread");
+ m_flingActiveOnMainThread = true;
return DidNotHandle;
}
case WebInputHandlerClient::ScrollStatusIgnored: {
@@ -349,4 +353,9 @@
}
}
+void WebCompositorInputHandlerImpl::mainThreadHasStoppedFlinging()
+{
+ m_flingActiveOnMainThread = false;
}
+
+}
Modified: trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h (137764 => 137765)
--- trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h 2012-12-14 21:07:07 UTC (rev 137764)
+++ trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h 2012-12-14 21:17:08 UTC (rev 137765)
@@ -63,6 +63,7 @@
// WebInputHandler implementation.
virtual void bindToClient(WebInputHandlerClient*);
virtual void animate(double monotonicTime);
+ virtual void mainThreadHasStoppedFlinging();
// WebGestureCurveTarget implementation.
virtual void scrollBy(const WebPoint&);
@@ -98,6 +99,9 @@
#endif
bool m_gestureScrollOnImplThread;
bool m_gesturePinchOnImplThread;
+ // This is always false when there are no flings on the main thread, but conservative in the
+ // sense that we might not be actually flinging when it is true.
+ bool m_flingActiveOnMainThread;
static int s_nextAvailableIdentifier;
static HashSet<WebCompositorInputHandlerImpl*>* s_compositors;
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (137764 => 137765)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-12-14 21:07:07 UTC (rev 137764)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-12-14 21:17:08 UTC (rev 137765)
@@ -707,6 +707,8 @@
case WebInputEvent::GestureFlingCancel:
if (m_gestureAnimation) {
m_gestureAnimation.clear();
+ if (m_layerTreeView)
+ m_layerTreeView->didStopFlinging();
eventSwallowed = true;
}
break;
@@ -858,8 +860,11 @@
|| (event.type == WebInputEvent::KeyUp));
// Halt an in-progress fling on a key event.
- if (m_gestureAnimation)
+ if (m_gestureAnimation) {
m_gestureAnimation.clear();
+ if (m_layerTreeView)
+ m_layerTreeView->didStopFlinging();
+ }
// Please refer to the comments explaining the m_suppressNextKeypressEvent
// member.
@@ -1765,8 +1770,11 @@
if (m_gestureAnimation) {
if (m_gestureAnimation->animate(monotonicFrameBeginTime))
scheduleAnimation();
- else
+ else {
m_gestureAnimation.clear();
+ if (m_layerTreeView)
+ m_layerTreeView->didStopFlinging();
+ }
}
if (!m_page)
@@ -3646,6 +3654,8 @@
// Make sure link highlight from previous page is cleared.
m_linkHighlight.clear();
m_gestureAnimation.clear();
+ if (m_layerTreeView)
+ m_layerTreeView->didStopFlinging();
resetSavedScrollAndScaleState();
}