libcef/browser/osr/motion_event_osr.cc
// Returns true if the touch was valid.
Returns true if the touch was valid.
Returns true if the touch was valid .
bool CefMotionEventOSR::OnTouch(const CefTouchEvent& touch) {
  int id = LookupId(touch.id);
  bool pointer_id_is_active = id != -1;
  if (touch.type == CEF_TET_PRESSED && pointer_id_is_active) {
    return false;
  } else if (touch.type != CEF_TET_PRESSED && !pointer_id_is_active) {
    return false;
  }
  switch (touch.type) {
    case CEF_TET_PRESSED:
      id = AddId(touch.id);
      if (id == -1)
        return false;
      if (!AddTouch(touch, id))
        return false;
      break;
    case CEF_TET_MOVED: {
      int index = FindPointerIndexOfId(id);
      if (IsValidIndex(index) &&
          (touch.x == GetX(index) && touch.y == GetY(index))) {
        return false;
      }
    }
      [[fallthrough]];
    case CEF_TET_RELEASED:
    case CEF_TET_CANCELLED:
      UpdateTouch(touch, id);
      break;
  }
  UpdateCachedAction(touch, id);
  set_unique_event_id(ui::GetNextTouchEventId());
  set_flags(touch.modifiers);
  set_event_time(base::TimeTicks::Now());
  return true;
}
bool CefMotionEventOSR :: OnTouch ( const CefTouchEvent & touch ) { int id = LookupId ( touch . id ) ; bool pointer_id_is_active = id != -1 ; if ( touch . type == CEF_TET_PRESSED && pointer_id_is_active ) { return false ; } else if ( touch . type != CEF_TET_PRESSED && ! pointer_id_is_active ) { return false ; } switch ( touch . type ) { case CEF_TET_PRESSED : id = AddId ( touch . id ) ; if ( id == -1 ) return false ; if ( ! AddTouch ( touch , id ) ) return false ; break ; case CEF_TET_MOVED : { int index = FindPointerIndexOfId ( id ) ; if ( IsValidIndex ( index ) && ( touch . x == GetX ( index ) && touch . y == GetY ( index ) ) ) { return false ; } } [[ fallthrough ]] ; case CEF_TET_RELEASED : case CEF_TET_CANCELLED : UpdateTouch ( touch , id ) ; break ; } UpdateCachedAction ( touch , id ) ; set_unique_event_id ( ui :: GetNextTouchEventId ( ) ) ; set_flags ( touch . modifiers ) ; set_event_time ( base :: TimeTicks :: Now ( ) ) ; return true ; }
Returns true if the touch was valid.
Returns true if the touch was valid .
// Ignore pressed events for already active touches. // When a window begins capturing touch events, we could have an active // touch stream transfered to us, resulting in touch move or touch up // events without associated touch down events. Ignore them. // Discard if touch is stationary. // No break. // Removing these touch points needs to be postponed until after the // MotionEvent has been dispatched. This cleanup occurs in // CleanupRemovedTouchPoints.