Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2621303004: Keep track of coalesced events in main thread event queue (Closed)
Patch Set: Rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100 954 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100
955 // - a formula that's relatively easy to use from JavaScript 955 // - a formula that's relatively easy to use from JavaScript
956 // Note that 'wheel' event deltaY values have their sign inverted. So to 956 // Note that 'wheel' event deltaY values have their sign inverted. So to
957 // convert a wheel deltaY back to a scale use Math.exp(-deltaY/100). 957 // convert a wheel deltaY back to a scale use Math.exp(-deltaY/100).
958 DCHECK_GT(pinchEvent.data.pinchUpdate.scale, 0); 958 DCHECK_GT(pinchEvent.data.pinchUpdate.scale, 0);
959 wheelEvent.deltaY = 100.0f * log(pinchEvent.data.pinchUpdate.scale); 959 wheelEvent.deltaY = 100.0f * log(pinchEvent.data.pinchUpdate.scale);
960 wheelEvent.hasPreciseScrollingDeltas = true; 960 wheelEvent.hasPreciseScrollingDeltas = true;
961 wheelEvent.wheelTicksX = 0; 961 wheelEvent.wheelTicksX = 0;
962 wheelEvent.wheelTicksY = pinchEvent.data.pinchUpdate.scale > 1 ? 1 : -1; 962 wheelEvent.wheelTicksY = pinchEvent.data.pinchUpdate.scale > 1 ? 1 : -1;
963 963
964 return handleInputEvent(wheelEvent); 964 return handleInputEvent(blink::WebCoalescedInputEvent(wheelEvent));
965 } 965 }
966 966
967 void WebViewImpl::transferActiveWheelFlingAnimation( 967 void WebViewImpl::transferActiveWheelFlingAnimation(
968 const WebActiveWheelFlingParameters& parameters) { 968 const WebActiveWheelFlingParameters& parameters) {
969 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation"); 969 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation");
970 DCHECK(!m_gestureAnimation); 970 DCHECK(!m_gestureAnimation);
971 m_positionOnFlingStart = parameters.point; 971 m_positionOnFlingStart = parameters.point;
972 m_globalPositionOnFlingStart = parameters.globalPoint; 972 m_globalPositionOnFlingStart = parameters.globalPoint;
973 m_flingModifier = parameters.modifiers; 973 m_flingModifier = parameters.modifiers;
974 std::unique_ptr<WebGestureCurve> curve = 974 std::unique_ptr<WebGestureCurve> curve =
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 bool WebViewImpl::hasVerticalScrollbar() { 2097 bool WebViewImpl::hasVerticalScrollbar() {
2098 return mainFrameImpl() 2098 return mainFrameImpl()
2099 ->frameView() 2099 ->frameView()
2100 ->layoutViewportScrollableArea() 2100 ->layoutViewportScrollableArea()
2101 ->verticalScrollbar(); 2101 ->verticalScrollbar();
2102 } 2102 }
2103 2103
2104 const WebInputEvent* WebViewImpl::m_currentInputEvent = nullptr; 2104 const WebInputEvent* WebViewImpl::m_currentInputEvent = nullptr;
2105 2105
2106 WebInputEventResult WebViewImpl::handleInputEvent( 2106 WebInputEventResult WebViewImpl::handleInputEvent(
2107 const WebInputEvent& inputEvent) { 2107 const WebCoalescedInputEvent& coalescedEvent) {
2108 const WebInputEvent& inputEvent = coalescedEvent.event();
2108 // TODO(dcheng): The fact that this is getting called when there is no local 2109 // TODO(dcheng): The fact that this is getting called when there is no local
2109 // main frame is problematic and probably indicates a bug in the input event 2110 // main frame is problematic and probably indicates a bug in the input event
2110 // routing code. 2111 // routing code.
2111 if (!mainFrameImpl()) 2112 if (!mainFrameImpl())
2112 return WebInputEventResult::NotHandled; 2113 return WebInputEventResult::NotHandled;
2113 2114
2114 WebAutofillClient* autofillClient = mainFrameImpl()->autofillClient(); 2115 WebAutofillClient* autofillClient = mainFrameImpl()->autofillClient();
2115 UserGestureNotifier notifier(this); 2116 UserGestureNotifier notifier(this);
2116 // On the first input event since page load, |notifier| instructs the 2117 // On the first input event since page load, |notifier| instructs the
2117 // autofill client to unblock values of password input fields of any forms 2118 // autofill client to unblock values of password input fields of any forms
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 node->dispatchMouseEvent( 2202 node->dispatchMouseEvent(
2202 PlatformMouseEventBuilder( 2203 PlatformMouseEventBuilder(
2203 mainFrameImpl()->frameView(), 2204 mainFrameImpl()->frameView(),
2204 static_cast<const WebMouseEvent&>(inputEvent)), 2205 static_cast<const WebMouseEvent&>(inputEvent)),
2205 eventType, static_cast<const WebMouseEvent&>(inputEvent).clickCount); 2206 eventType, static_cast<const WebMouseEvent&>(inputEvent).clickCount);
2206 return WebInputEventResult::HandledSystem; 2207 return WebInputEventResult::HandledSystem;
2207 } 2208 }
2208 2209
2209 // FIXME: This should take in the intended frame, not the local frame root. 2210 // FIXME: This should take in the intended frame, not the local frame root.
2210 WebInputEventResult result = PageWidgetDelegate::handleInputEvent( 2211 WebInputEventResult result = PageWidgetDelegate::handleInputEvent(
2211 *this, WebCoalescedInputEvent(inputEvent), mainFrameImpl()->frame()); 2212 *this, coalescedEvent, mainFrameImpl()->frame());
2212 if (result != WebInputEventResult::NotHandled) 2213 if (result != WebInputEventResult::NotHandled)
2213 return result; 2214 return result;
2214 2215
2215 // Unhandled pinch events should adjust the scale. 2216 // Unhandled pinch events should adjust the scale.
2216 if (inputEvent.type() == WebInputEvent::GesturePinchUpdate) { 2217 if (inputEvent.type() == WebInputEvent::GesturePinchUpdate) {
2217 const WebGestureEvent& pinchEvent = 2218 const WebGestureEvent& pinchEvent =
2218 static_cast<const WebGestureEvent&>(inputEvent); 2219 static_cast<const WebGestureEvent&>(inputEvent);
2219 2220
2220 // For touchpad gestures synthesize a Windows-like wheel event 2221 // For touchpad gestures synthesize a Windows-like wheel event
2221 // to send to any handlers that may exist. Not necessary for touchscreen 2222 // to send to any handlers that may exist. Not necessary for touchscreen
(...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after
4186 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) 4187 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame())
4187 return nullptr; 4188 return nullptr;
4188 return focusedFrame; 4189 return focusedFrame;
4189 } 4190 }
4190 4191
4191 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { 4192 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const {
4192 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; 4193 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr;
4193 } 4194 }
4194 4195
4195 } // namespace blink 4196 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698