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

Side by Side Diff: content/common/input/web_input_event_traits.cc

Issue 791923003: replace COMPILE_ASSERT with static_assert in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixups Created 5 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
« no previous file with comments | « content/common/gpu/media/vaapi_h264_decoder.cc ('k') | content/common/pepper_plugin_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/input/web_input_event_traits.h" 5 #include "content/common/input/web_input_event_traits.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 bool CanCoalesce(const WebTouchEvent& event_to_coalesce, 199 bool CanCoalesce(const WebTouchEvent& event_to_coalesce,
200 const WebTouchEvent& event) { 200 const WebTouchEvent& event) {
201 if (event.type != event_to_coalesce.type || 201 if (event.type != event_to_coalesce.type ||
202 event.type != WebInputEvent::TouchMove || 202 event.type != WebInputEvent::TouchMove ||
203 event.modifiers != event_to_coalesce.modifiers || 203 event.modifiers != event_to_coalesce.modifiers ||
204 event.touchesLength != event_to_coalesce.touchesLength || 204 event.touchesLength != event_to_coalesce.touchesLength ||
205 event.touchesLength > WebTouchEvent::touchesLengthCap) 205 event.touchesLength > WebTouchEvent::touchesLengthCap)
206 return false; 206 return false;
207 207
208 COMPILE_ASSERT(WebTouchEvent::touchesLengthCap <= sizeof(int32_t) * 8U, 208 static_assert(WebTouchEvent::touchesLengthCap <= sizeof(int32_t) * 8U,
209 suboptimal_touches_length_cap_size); 209 "suboptimal touchesLengthCap size");
210 // Ensure that we have a 1-to-1 mapping of pointer ids between touches. 210 // Ensure that we have a 1-to-1 mapping of pointer ids between touches.
211 std::bitset<WebTouchEvent::touchesLengthCap> unmatched_event_touches( 211 std::bitset<WebTouchEvent::touchesLengthCap> unmatched_event_touches(
212 (1 << event.touchesLength) - 1); 212 (1 << event.touchesLength) - 1);
213 for (unsigned i = 0; i < event_to_coalesce.touchesLength; ++i) { 213 for (unsigned i = 0; i < event_to_coalesce.touchesLength; ++i) {
214 int event_touch_index = 214 int event_touch_index =
215 GetIndexOfTouchID(event, event_to_coalesce.touches[i].id); 215 GetIndexOfTouchID(event, event_to_coalesce.touches[i].id);
216 if (event_touch_index == kInvalidTouchIndex) 216 if (event_touch_index == kInvalidTouchIndex)
217 return false; 217 return false;
218 if (!unmatched_event_touches[event_touch_index]) 218 if (!unmatched_event_touches[event_touch_index])
219 return false; 219 return false;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 case WebInputEvent::TouchStart: 479 case WebInputEvent::TouchStart:
480 case WebInputEvent::TouchMove: 480 case WebInputEvent::TouchMove:
481 case WebInputEvent::TouchEnd: 481 case WebInputEvent::TouchEnd:
482 return !static_cast<const WebTouchEvent&>(event).cancelable; 482 return !static_cast<const WebTouchEvent&>(event).cancelable;
483 default: 483 default:
484 return false; 484 return false;
485 } 485 }
486 } 486 }
487 487
488 } // namespace content 488 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/vaapi_h264_decoder.cc ('k') | content/common/pepper_plugin_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698