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

Unified Diff: components/test_runner/event_sender.cc

Issue 2049323002: [Mac] Don't dispatch wheel events for PhaseMayBegin|Cancelled|Ended (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use == instead of strcmp() Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/mouse-wheel-main-frame-event.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/event_sender.cc
diff --git a/components/test_runner/event_sender.cc b/components/test_runner/event_sender.cc
index be730ccc00809fa273ecd47071c9eb71d6e49259..b3eb652921b264591e976cbc26abd50980006b25 100644
--- a/components/test_runner/event_sender.cc
+++ b/components/test_runner/event_sender.cc
@@ -329,6 +329,34 @@ int GetKeyModifiersFromV8(v8::Isolate* isolate, v8::Local<v8::Value> value) {
return GetKeyModifiers(modifier_names);
}
+WebMouseWheelEvent::Phase GetMouseWheelEventPhase(
+ const std::string& phase_name) {
+ if (phase_name == "phaseNone") {
+ return WebMouseWheelEvent::PhaseNone;
+ } else if (phase_name == "phaseBegan") {
+ return WebMouseWheelEvent::PhaseBegan;
+ } else if (phase_name == "phaseStationary") {
+ return WebMouseWheelEvent::PhaseStationary;
+ } else if (phase_name == "phaseChanged") {
+ return WebMouseWheelEvent::PhaseChanged;
+ } else if (phase_name == "phaseEnded") {
+ return WebMouseWheelEvent::PhaseEnded;
+ } else if (phase_name == "phaseCancelled") {
+ return WebMouseWheelEvent::PhaseCancelled;
+ } else if (phase_name == "phaseMayBegin") {
+ return WebMouseWheelEvent::PhaseMayBegin;
+ }
+
+ return WebMouseWheelEvent::PhaseNone;
+}
+
+WebMouseWheelEvent::Phase GetMouseWheelEventPhaseFromV8(
+ v8::Local<v8::Value> value) {
+ if (value->IsString())
+ return GetMouseWheelEventPhase(gin::V8ToString(value));
+ return WebMouseWheelEvent::PhaseNone;
+}
+
// Maximum distance (in space and time) for a mouse click to register as a
// double or triple click.
const double kMultipleClickTimeSec = 1;
@@ -2540,6 +2568,7 @@ void EventSender::InitMouseWheelEvent(gin::Arguments* args,
bool paged = false;
bool has_precise_scrolling_deltas = false;
int modifiers = 0;
+ WebMouseWheelEvent::Phase phase = WebMouseWheelEvent::PhaseNone;
if (!args->PeekNext().IsEmpty()) {
args->GetNext(&paged);
if (!args->PeekNext().IsEmpty()) {
@@ -2550,6 +2579,11 @@ void EventSender::InitMouseWheelEvent(gin::Arguments* args,
modifiers = GetKeyModifiersFromV8(args->isolate(), value);
if (!args->PeekNext().IsEmpty()) {
args->GetNext(send_gestures);
+ if (!args->PeekNext().IsEmpty()) {
+ v8::Local<v8::Value> phase_value;
+ args->GetNext(&phase_value);
+ phase = GetMouseWheelEventPhaseFromV8(phase_value);
+ }
}
}
}
@@ -2566,6 +2600,7 @@ void EventSender::InitMouseWheelEvent(gin::Arguments* args,
event->deltaY = event->wheelTicksY;
event->scrollByPage = paged;
event->hasPreciseScrollingDeltas = has_precise_scrolling_deltas;
+ event->phase = phase;
if (scroll_type == MouseScrollType::PIXEL) {
event->wheelTicksX /= kScrollbarPixelsPerTick;
event->wheelTicksY /= kScrollbarPixelsPerTick;
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/mouse-wheel-main-frame-event.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698