Fix compatibility with canScroll
authorCheng Zhao <zcbenz@gmail.com>
Fri, 9 Sep 2016 10:28:32 +0000 (19:28 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 14 Sep 2016 07:23:01 +0000 (16:23 +0900)
atom/common/native_mate_converters/blink_converter.cc

index b91bdf2..9adb03d 100644 (file)
@@ -238,6 +238,15 @@ bool Converter<blink::WebMouseWheelEvent>::FromV8(
   dict.Get("accelerationRatioX", &out->accelerationRatioX);
   dict.Get("accelerationRatioY", &out->accelerationRatioY);
   dict.Get("hasPreciseScrollingDeltas", &out->hasPreciseScrollingDeltas);
+
+#if defined(USE_AURA)
+  // Matches the behavior of ui/events/blink/web_input_event_traits.cc:
+  bool can_scroll = true;
+  if (dict.Get("canScroll", &can_scroll) && !can_scroll) {
+    out->hasPreciseScrollingDeltas = false;
+    out->modifiers &= ~blink::WebInputEvent::ControlKey;
+  }
+#endif
   return true;
 }