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

Side by Side Diff: public/web/WebInputEvent.h

Issue 743883005: Store binary flags in bool instead of int in WebInputEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Include remaining bools Created 6 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 unified diff | Download patch
« no previous file with comments | « Source/web/WebInputEvent.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // The actual key code genenerated by the platform. The DOM spec runs 236 // The actual key code genenerated by the platform. The DOM spec runs
237 // on Windows-equivalent codes (thus |windowsKeyCode| above) but it 237 // on Windows-equivalent codes (thus |windowsKeyCode| above) but it
238 // doesn't hurt to have this one around. 238 // doesn't hurt to have this one around.
239 int nativeKeyCode; 239 int nativeKeyCode;
240 240
241 // This identifies whether this event was tagged by the system as being 241 // This identifies whether this event was tagged by the system as being
242 // a "system key" event (see 242 // a "system key" event (see
243 // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for 243 // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for
244 // details). Other platforms don't have this concept, but it's just 244 // details). Other platforms don't have this concept, but it's just
245 // easier to leave it always false than ifdef. 245 // easier to leave it always false than ifdef.
246 // See comment at the top of the file for why an int is used here.
247 bool isSystemKey; 246 bool isSystemKey;
248 247
249 // |text| is the text generated by this keystroke. |unmodifiedText| is 248 // |text| is the text generated by this keystroke. |unmodifiedText| is
250 // |text|, but unmodified by an concurrently-held modifiers (except 249 // |text|, but unmodified by an concurrently-held modifiers (except
251 // shift). This is useful for working out shortcut keys. Linux and 250 // shift). This is useful for working out shortcut keys. Linux and
252 // Windows guarantee one character per event. The Mac does not, but in 251 // Windows guarantee one character per event. The Mac does not, but in
253 // reality that's all it ever gives. We're generous, and cap it a bit 252 // reality that's all it ever gives. We're generous, and cap it a bit
254 // longer. 253 // longer.
255 WebUChar text[textLengthCap]; 254 WebUChar text[textLengthCap];
256 WebUChar unmodifiedText[textLengthCap]; 255 WebUChar unmodifiedText[textLengthCap];
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 }; 345 };
347 346
348 float deltaX; 347 float deltaX;
349 float deltaY; 348 float deltaY;
350 float wheelTicksX; 349 float wheelTicksX;
351 float wheelTicksY; 350 float wheelTicksY;
352 351
353 float accelerationRatioX; 352 float accelerationRatioX;
354 float accelerationRatioY; 353 float accelerationRatioY;
355 354
356 // See comment at the top of the file for why an int is used here.
357 int scrollByPage;
358
359 // See comment at the top of the file for why an int is used here.
360 int hasPreciseScrollingDeltas;
361 Phase phase; 355 Phase phase;
362 Phase momentumPhase; 356 Phase momentumPhase;
363 357
364 // See comment at the top of the file for why an int is used here.
365 // Rubberbanding is an OSX visual effect. When a user scrolls the content 358 // Rubberbanding is an OSX visual effect. When a user scrolls the content
366 // area with a track pad, and the content area is already at its limit in 359 // area with a track pad, and the content area is already at its limit in
367 // the direction being scrolled, the entire content area is allowed to 360 // the direction being scrolled, the entire content area is allowed to
368 // scroll slightly off screen, revealing a grey background. When the user 361 // scroll slightly off screen, revealing a grey background. When the user
369 // lets go, the content area snaps back into place. Blink is responsible 362 // lets go, the content area snaps back into place. Blink is responsible
370 // for this rubberbanding effect, but the embedder may wish to disable 363 // for this rubberbanding effect, but the embedder may wish to disable
371 // rubber banding in the left or right direction, if the scroll should have 364 // rubber banding in the left or right direction, if the scroll should have
372 // an alternate effect. The common case is that a scroll in the left or 365 // an alternate effect. The common case is that a scroll in the left or
373 // right directions causes a back or forwards navigation, respectively. 366 // right directions causes a back or forwards navigation, respectively.
374 // 367 //
375 // These flags prevent rubber banding from starting in a given direction, 368 // These flags prevent rubber banding from starting in a given direction,
376 // but have no effect on an ongoing rubber banding. A rubber banding that 369 // but have no effect on an ongoing rubber banding. A rubber banding that
377 // started in the vertical direction is allowed to continue in the right 370 // started in the vertical direction is allowed to continue in the right
378 // direction, even if canRubberbandRight is 0. 371 // direction, even if canRubberbandRight is 0.
379 int canRubberbandLeft; 372 bool canRubberbandLeft;
380 int canRubberbandRight; 373 bool canRubberbandRight;
374
375 bool scrollByPage;
376 bool hasPreciseScrollingDeltas;
381 377
382 WebMouseWheelEvent() 378 WebMouseWheelEvent()
383 : WebMouseEvent(sizeof(WebMouseWheelEvent)) 379 : WebMouseEvent(sizeof(WebMouseWheelEvent))
384 , deltaX(0.0f) 380 , deltaX(0.0f)
385 , deltaY(0.0f) 381 , deltaY(0.0f)
386 , wheelTicksX(0.0f) 382 , wheelTicksX(0.0f)
387 , wheelTicksY(0.0f) 383 , wheelTicksY(0.0f)
388 , accelerationRatioX(1.0f) 384 , accelerationRatioX(1.0f)
389 , accelerationRatioY(1.0f) 385 , accelerationRatioY(1.0f)
390 , scrollByPage(false)
391 , hasPreciseScrollingDeltas(false)
392 , phase(PhaseNone) 386 , phase(PhaseNone)
393 , momentumPhase(PhaseNone) 387 , momentumPhase(PhaseNone)
394 , canRubberbandLeft(true) 388 , canRubberbandLeft(true)
395 , canRubberbandRight(true) 389 , canRubberbandRight(true)
390 , scrollByPage(false)
391 , hasPreciseScrollingDeltas(false)
396 { 392 {
397 } 393 }
398 }; 394 };
399 395
400 // WebGestureEvent ------------------------------------------------------------- - 396 // WebGestureEvent ------------------------------------------------------------- -
401 397
402 class WebGestureEvent : public WebInputEvent { 398 class WebGestureEvent : public WebInputEvent {
403 public: 399 public:
404 int x; 400 int x;
405 int y; 401 int y;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 // May be redundant with deltaX/deltaY in the first scrollUpdate. 437 // May be redundant with deltaX/deltaY in the first scrollUpdate.
442 float deltaXHint; 438 float deltaXHint;
443 float deltaYHint; 439 float deltaYHint;
444 } scrollBegin; 440 } scrollBegin;
445 441
446 struct { 442 struct {
447 float deltaX; 443 float deltaX;
448 float deltaY; 444 float deltaY;
449 float velocityX; 445 float velocityX;
450 float velocityY; 446 float velocityY;
451
452 // TODO: Use a bitfield instead of two ints for these flags
453
454 // Whether any previous GestureScrollUpdate in the current scroll 447 // Whether any previous GestureScrollUpdate in the current scroll
455 // sequence was suppressed (e.g., the causal touchmove was 448 // sequence was suppressed (e.g., the causal touchmove was
456 // preventDefault'ed). This bit is particularly useful for 449 // preventDefault'ed). This bit is particularly useful for
457 // determining whether the observed scroll update sequence captures 450 // determining whether the observed scroll update sequence captures
458 // the entirety of the generative motion. 451 // the entirety of the generative motion.
459 // See comment at the top for why an int is used here instead of a b ool. 452 bool previousUpdateInSequencePrevented;
460 int previousUpdateInSequencePrevented; 453 bool preventPropagation;
461 // See comment at the top of the file for why an int is used here
462 // instead of a bool.
463 int preventPropagation;
464 } scrollUpdate; 454 } scrollUpdate;
465 455
466 struct { 456 struct {
467 float velocityX; 457 float velocityX;
468 float velocityY; 458 float velocityY;
469 } flingStart; 459 } flingStart;
470 460
471 struct { 461 struct {
472 float scale; 462 float scale;
473 } pinchUpdate; 463 } pinchUpdate;
(...skipping 17 matching lines...) Expand all
491 // Maximum number of simultaneous touches supported on 481 // Maximum number of simultaneous touches supported on
492 // Ash/Aura. 482 // Ash/Aura.
493 enum { touchesLengthCap = 16 }; 483 enum { touchesLengthCap = 16 };
494 484
495 unsigned touchesLength; 485 unsigned touchesLength;
496 // List of all touches, regardless of state. 486 // List of all touches, regardless of state.
497 WebTouchPoint touches[touchesLengthCap]; 487 WebTouchPoint touches[touchesLengthCap];
498 488
499 // Whether the event can be canceled (with preventDefault). If true then the browser 489 // Whether the event can be canceled (with preventDefault). If true then the browser
500 // must wait for an ACK for this event. If false then no ACK IPC is expected . 490 // must wait for an ACK for this event. If false then no ACK IPC is expected .
501 // See comment at the top for why an int is used here instead of a bool. 491 bool cancelable;
502 int cancelable;
503 492
504 // Whether the event will produce scroll-inducing events if uncanceled. This 493 // Whether the event will produce scroll-inducing events if uncanceled. This
505 // will be true for touchmove events after the platform slop region has been 494 // will be true for touchmove events after the platform slop region has been
506 // exceeded and fling-generating touchend events. Note that this doesn't 495 // exceeded and fling-generating touchend events. Note that this doesn't
507 // necessarily mean content will scroll, only that scroll events will be 496 // necessarily mean content will scroll, only that scroll events will be
508 // generated. 497 // generated.
509 // See comment at the top for why an int is used here instead of a bool. 498 bool causesScrollingIfUncanceled;
510 int causesScrollingIfUncanceled;
511 499
512 WebTouchEvent() 500 WebTouchEvent()
513 : WebInputEvent(sizeof(WebTouchEvent)) 501 : WebInputEvent(sizeof(WebTouchEvent))
514 , touchesLength(0) 502 , touchesLength(0)
515 , cancelable(true) 503 , cancelable(true)
516 , causesScrollingIfUncanceled(false) 504 , causesScrollingIfUncanceled(false)
517 { 505 {
518 } 506 }
519 }; 507 };
520 508
521 #pragma pack(pop) 509 #pragma pack(pop)
522 510
523 } // namespace blink 511 } // namespace blink
524 512
525 #endif 513 #endif
OLDNEW
« no previous file with comments | « Source/web/WebInputEvent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698