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

Unified Diff: ui/events/blink/input_handler_proxy.cc

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/blink/input_handler_proxy.cc
diff --git a/ui/events/blink/input_handler_proxy.cc b/ui/events/blink/input_handler_proxy.cc
index 0c5c46559b95d85b17a575cebc9323e4f056238d..cf87b09a44f7f7d0b862bda1827f05fa7d5db20f 100644
--- a/ui/events/blink/input_handler_proxy.cc
+++ b/ui/events/blink/input_handler_proxy.cc
@@ -82,7 +82,7 @@ bool ShouldSuppressScrollForFlingBoosting(
const WebGestureEvent& scroll_update_event,
double time_since_last_boost_event,
double time_since_last_fling_animate) {
- DCHECK_EQ(WebInputEvent::GestureScrollUpdate, scroll_update_event.type);
+ DCHECK_EQ(WebInputEvent::GestureScrollUpdate, scroll_update_event.type());
gfx::Vector2dF dx(scroll_update_event.data.scrollUpdate.deltaX,
scroll_update_event.data.scrollUpdate.deltaY);
@@ -107,7 +107,7 @@ bool ShouldSuppressScrollForFlingBoosting(
bool ShouldBoostFling(const gfx::Vector2dF& current_fling_velocity,
const WebGestureEvent& fling_start_event) {
- DCHECK_EQ(WebInputEvent::GestureFlingStart, fling_start_event.type);
+ DCHECK_EQ(WebInputEvent::GestureFlingStart, fling_start_event.type());
gfx::Vector2dF new_fling_velocity(
fling_start_event.data.flingStart.velocityX,
@@ -135,7 +135,7 @@ WebGestureEvent ObtainGestureScrollBegin(const WebGestureEvent& event) {
cc::ScrollState CreateScrollStateForGesture(const WebGestureEvent& event) {
cc::ScrollStateData scroll_state_data;
- switch (event.type) {
+ switch (event.type()) {
case WebInputEvent::GestureScrollBegin:
scroll_state_data.position_x = event.x;
scroll_state_data.position_y = event.y;
@@ -168,11 +168,11 @@ cc::ScrollState CreateScrollStateForGesture(const WebGestureEvent& event) {
void ReportInputEventLatencyUma(const WebInputEvent& event,
const ui::LatencyInfo& latency_info) {
- if (!(event.type == WebInputEvent::GestureScrollBegin ||
- event.type == WebInputEvent::GestureScrollUpdate ||
- event.type == WebInputEvent::GesturePinchBegin ||
- event.type == WebInputEvent::GesturePinchUpdate ||
- event.type == WebInputEvent::GestureFlingStart)) {
+ if (!(event.type() == WebInputEvent::GestureScrollBegin ||
+ event.type() == WebInputEvent::GestureScrollUpdate ||
+ event.type() == WebInputEvent::GesturePinchBegin ||
+ event.type() == WebInputEvent::GesturePinchUpdate ||
+ event.type() == WebInputEvent::GestureFlingStart)) {
return;
}
@@ -185,7 +185,7 @@ void ReportInputEventLatencyUma(const WebInputEvent& event,
base::TimeDelta delta = base::TimeTicks::Now() - it->second.event_time;
for (size_t i = 0; i < it->second.event_count; ++i) {
- switch (event.type) {
+ switch (event.type()) {
case blink::WebInputEvent::GestureScrollBegin:
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Event.Latency.RendererImpl.GestureScrollBegin",
@@ -295,7 +295,7 @@ void InputHandlerProxy::HandleInputEventWithLatencyInfo(
// Note: Other input can race ahead of gesture input as they don't have to go
// through the queue, but we believe it's OK to do so.
if (!compositor_event_queue_ ||
- !IsGestureScollOrPinch(event_with_callback->event().type)) {
+ !IsGestureScollOrPinch(event_with_callback->event().type())) {
DispatchSingleInputEvent(std::move(event_with_callback),
tick_clock_->NowTicks());
return;
@@ -320,10 +320,10 @@ void InputHandlerProxy::DispatchSingleInputEvent(
std::unique_ptr<EventWithCallback> event_with_callback,
const base::TimeTicks now) {
if (compositor_event_queue_ &&
- IsGestureScollOrPinch(event_with_callback->event().type)) {
+ IsGestureScollOrPinch(event_with_callback->event().type())) {
// Report the coalesced count only for continuous events to avoid the noise
// from non-continuous events.
- if (IsContinuousGestureEvent(event_with_callback->event().type)) {
+ if (IsContinuousGestureEvent(event_with_callback->event().type())) {
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Event.CompositorThreadEventQueue.Continuous.HeadQueueingTime",
(now - event_with_callback->creation_timestamp()).InMicroseconds(), 1,
@@ -355,7 +355,7 @@ void InputHandlerProxy::DispatchSingleInputEvent(
InputHandlerProxy::EventDisposition disposition =
HandleInputEvent(event_with_callback->event());
- switch (event_with_callback->event().type) {
+ switch (event_with_callback->event().type()) {
case blink::WebGestureEvent::GestureScrollBegin:
case blink::WebGestureEvent::GesturePinchBegin:
case blink::WebGestureEvent::GestureScrollUpdate:
@@ -393,7 +393,7 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleInputEvent(
if (FilterInputEventForFlingBoosting(event))
return DID_HANDLE;
- switch (event.type) {
+ switch (event.type()) {
case WebInputEvent::MouseWheel:
return HandleMouseWheel(static_cast<const WebMouseWheelEvent&>(event));
@@ -506,7 +506,7 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleInputEvent(
}
default:
- if (WebInputEvent::isKeyboardEventType(event.type)) {
+ if (WebInputEvent::isKeyboardEventType(event.type())) {
// Only call |CancelCurrentFling()| if a fling was active, as it will
// otherwise disrupt an in-progress touch scroll.
if (fling_curve_)
@@ -634,7 +634,7 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::ScrollByMouseWheel(
} else if (ShouldAnimate(wheel_event.hasPreciseScrollingDeltas)) {
base::TimeTicks event_time =
base::TimeTicks() +
- base::TimeDelta::FromSecondsD(wheel_event.timeStampSeconds);
+ base::TimeDelta::FromSecondsD(wheel_event.timeStampSeconds());
base::TimeDelta delay = base::TimeTicks::Now() - event_time;
cc::InputHandler::ScrollStatus scroll_status =
input_handler_->ScrollAnimated(gfx::Point(wheel_event.x, wheel_event.y),
@@ -790,7 +790,7 @@ InputHandlerProxy::HandleGestureScrollUpdate(
blink::WebGestureEvent::ScrollUnits::Pixels)) {
base::TimeTicks event_time =
base::TimeTicks() +
- base::TimeDelta::FromSecondsD(gesture_event.timeStampSeconds);
+ base::TimeDelta::FromSecondsD(gesture_event.timeStampSeconds());
base::TimeDelta delay = base::TimeTicks::Now() - event_time;
switch (input_handler_->ScrollAnimated(scroll_point, scroll_delta, delay)
.thread) {
@@ -894,12 +894,12 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
// Note that the timestamp will only be used to kickstart the animation if
// its sufficiently close to the timestamp of the first call |Animate()|.
has_fling_animation_started_ = false;
- fling_parameters_.startTime = gesture_event.timeStampSeconds;
+ fling_parameters_.startTime = gesture_event.timeStampSeconds();
fling_parameters_.delta = WebFloatPoint(vx, vy);
fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y);
fling_parameters_.globalPoint =
WebPoint(gesture_event.globalX, gesture_event.globalY);
- fling_parameters_.modifiers = gesture_event.modifiers;
+ fling_parameters_.modifiers = gesture_event.modifiers();
fling_parameters_.sourceDevice = gesture_event.sourceDevice;
RequestAnimation();
return DID_HANDLE;
@@ -1022,7 +1022,7 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleTouchEnd(
bool InputHandlerProxy::FilterInputEventForFlingBoosting(
const WebInputEvent& event) {
- if (!WebInputEvent::isGestureEventType(event.type))
+ if (!WebInputEvent::isGestureEventType(event.type()))
return false;
if (!fling_curve_) {
@@ -1032,7 +1032,7 @@ bool InputHandlerProxy::FilterInputEventForFlingBoosting(
const WebGestureEvent& gesture_event =
static_cast<const WebGestureEvent&>(event);
- if (gesture_event.type == WebInputEvent::GestureFlingCancel) {
+ if (gesture_event.type() == WebInputEvent::GestureFlingCancel) {
if (gesture_event.data.flingCancel.preventBoosting)
return false;
@@ -1043,7 +1043,7 @@ bool InputHandlerProxy::FilterInputEventForFlingBoosting(
"InputHandlerProxy::FlingBoostStart",
TRACE_EVENT_SCOPE_THREAD);
deferred_fling_cancel_time_seconds_ =
- event.timeStampSeconds + kFlingBoostTimeoutDelaySeconds;
+ event.timeStampSeconds() + kFlingBoostTimeoutDelaySeconds;
return true;
}
@@ -1058,7 +1058,7 @@ bool InputHandlerProxy::FilterInputEventForFlingBoosting(
return false;
}
- switch (gesture_event.type) {
+ switch (gesture_event.type()) {
case WebInputEvent::GestureTapCancel:
case WebInputEvent::GestureTapDown:
return false;
@@ -1080,9 +1080,9 @@ bool InputHandlerProxy::FilterInputEventForFlingBoosting(
case WebInputEvent::GestureScrollUpdate: {
const double time_since_last_boost_event =
- event.timeStampSeconds - last_fling_boost_event_.timeStampSeconds;
+ event.timeStampSeconds() - last_fling_boost_event_.timeStampSeconds();
const double time_since_last_fling_animate = std::max(
- 0.0, event.timeStampSeconds - InSecondsF(last_fling_animate_time_));
+ 0.0, event.timeStampSeconds() - InSecondsF(last_fling_animate_time_));
if (ShouldSuppressScrollForFlingBoosting(current_fling_velocity_,
gesture_event,
time_since_last_boost_event,
@@ -1106,7 +1106,7 @@ bool InputHandlerProxy::FilterInputEventForFlingBoosting(
DCHECK_EQ(fling_parameters_.sourceDevice, gesture_event.sourceDevice);
bool fling_boosted =
- fling_parameters_.modifiers == gesture_event.modifiers &&
+ fling_parameters_.modifiers == gesture_event.modifiers() &&
ShouldBoostFling(current_fling_velocity_, gesture_event);
gfx::Vector2dF new_fling_velocity(
@@ -1129,7 +1129,7 @@ bool InputHandlerProxy::FilterInputEventForFlingBoosting(
gesture_event.sourceDevice,
velocity,
blink::WebSize()));
- fling_parameters_.startTime = gesture_event.timeStampSeconds;
+ fling_parameters_.startTime = gesture_event.timeStampSeconds();
fling_parameters_.delta = velocity;
fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y);
fling_parameters_.globalPoint =
@@ -1164,7 +1164,7 @@ void InputHandlerProxy::ExtendBoostedFlingTimeout(
"InputHandlerProxy::ExtendBoostedFlingTimeout",
TRACE_EVENT_SCOPE_THREAD);
deferred_fling_cancel_time_seconds_ =
- event.timeStampSeconds + kFlingBoostTimeoutDelaySeconds;
+ event.timeStampSeconds() + kFlingBoostTimeoutDelaySeconds;
last_fling_boost_event_ = event;
}
@@ -1365,8 +1365,8 @@ bool InputHandlerProxy::CancelCurrentFlingWithoutNotifyingClient() {
WebGestureEvent last_fling_boost_event = last_fling_boost_event_;
last_fling_boost_event_ = WebGestureEvent();
- if (last_fling_boost_event.type == WebInputEvent::GestureScrollBegin ||
- last_fling_boost_event.type == WebInputEvent::GestureScrollUpdate) {
+ if (last_fling_boost_event.type() == WebInputEvent::GestureScrollBegin ||
+ last_fling_boost_event.type() == WebInputEvent::GestureScrollUpdate) {
// Synthesize a GestureScrollBegin, as the original was suppressed.
HandleInputEvent(ObtainGestureScrollBegin(last_fling_boost_event));
}

Powered by Google App Engine
This is Rietveld 408576698