| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/renderer_host/input/web_touch_event_traits.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 | |
| 9 using blink::WebInputEvent; | |
| 10 using blink::WebTouchEvent; | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 namespace { | |
| 15 | |
| 16 bool AllTouchPointsHaveState(const WebTouchEvent& event, | |
| 17 blink::WebTouchPoint::State state) { | |
| 18 if(!event.touchesLength) | |
| 19 return false; | |
| 20 for (size_t i = 0; i < event.touchesLength; ++i) { | |
| 21 if (event.touches[i].state != state) | |
| 22 return false; | |
| 23 } | |
| 24 return true; | |
| 25 } | |
| 26 | |
| 27 } // namespace | |
| 28 | |
| 29 bool WebTouchEventTraits::IsTouchSequenceStart(const WebTouchEvent& event) { | |
| 30 DCHECK(event.touchesLength); | |
| 31 if (event.type != WebInputEvent::TouchStart) | |
| 32 return false; | |
| 33 return AllTouchPointsHaveState(event, blink::WebTouchPoint::StatePressed); | |
| 34 } | |
| 35 | |
| 36 } // namespace content | |
| OLD | NEW |