nsEventStatus
AccessibleCaretEventHub::HandleKeyboardEvent(WidgetKeyboardEvent* aEvent)
{
  switch (aEvent->mMessage) {
    case eKeyUp:
      AC_LOGV("eKeyUp, state: %s", mState->Name());
      mManager->OnKeyboardEvent();
      break;

    case eKeyDown:
      AC_LOGV("eKeyDown, state: %s", mState->Name());
      mManager->OnKeyboardEvent();
      break;

    case eKeyPress:
      AC_LOGV("eKeyPress, state: %s", mState->Name());
      mManager->OnKeyboardEvent();
      break;

    default:
      break;
  }

  return nsEventStatus_eIgnore;
}
예제 #2
0
nsEventStatus
AccessibleCaretEventHub::HandleWheelEvent(WidgetWheelEvent* aEvent)
{
  switch (aEvent->mMessage) {
  case NS_WHEEL_WHEEL:
    AC_LOGV("NS_WHEEL_WHEEL, isMomentum %d, state: %s", aEvent->isMomentum,
            mState->Name());
    mState->OnScrolling(this);
    break;

  case NS_WHEEL_START:
    AC_LOGV("NS_WHEEL_START, state: %s", mState->Name());
    mState->OnScrollStart(this);
    break;

  case NS_WHEEL_STOP:
    AC_LOGV("NS_WHEEL_STOP, state: %s", mState->Name());
    mState->OnScrollEnd(this);
    break;

  default:
    break;
  }

  // Always ignore this event since we only want to know scroll start and scroll
  // end, not to consume it.
  return nsEventStatus_eIgnore;
}
nsEventStatus
AccessibleCaretEventHub::HandleKeyboardEvent(WidgetKeyboardEvent* aEvent)
{
  mManager->SetLastInputSource(nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD);

  switch (aEvent->mMessage) {
    case eKeyUp:
      AC_LOGV("eKeyUp, state: %s", mState->Name());
      mManager->OnKeyboardEvent();
      break;

    case eKeyDown:
      AC_LOGV("eKeyDown, state: %s", mState->Name());
      mManager->OnKeyboardEvent();
      break;

    case eKeyPress:
      AC_LOGV("eKeyPress, state: %s", mState->Name());
      mManager->OnKeyboardEvent();
      break;

    default:
      break;
  }

  return nsEventStatus_eIgnore;
}
nsEventStatus
AccessibleCaretEventHub::HandleMouseEvent(WidgetMouseEvent* aEvent)
{
  nsEventStatus rv = nsEventStatus_eIgnore;

  if (aEvent->button != WidgetMouseEvent::eLeftButton) {
    return rv;
  }

  int32_t id =
    (mActiveTouchId == kInvalidTouchId ? kDefaultTouchId : mActiveTouchId);
  nsPoint point = GetMouseEventPosition(aEvent);

  if (aEvent->mMessage == eMouseDown ||
      aEvent->mMessage == eMouseUp ||
      aEvent->mMessage == eMouseClick ||
      aEvent->mMessage == eMouseDoubleClick ||
      aEvent->mMessage == eMouseLongTap) {
    // Don't reset the source on mouse movement since that can
    // happen anytime, even randomly during a touch sequence.
    mManager->SetLastInputSource(aEvent->inputSource);
  }

  switch (aEvent->mMessage) {
    case eMouseDown:
      AC_LOGV("Before eMouseDown, state: %s", mState->Name());
      rv = mState->OnPress(this, point, id, eMouseEventClass);
      AC_LOGV("After eMouseDown, state: %s, consume: %d", mState->Name(), rv);
      break;

    case eMouseMove:
      AC_LOGV("Before eMouseMove, state: %s", mState->Name());
      rv = mState->OnMove(this, point);
      AC_LOGV("After eMouseMove, state: %s, consume: %d", mState->Name(), rv);
      break;

    case eMouseUp:
      AC_LOGV("Before eMouseUp, state: %s", mState->Name());
      rv = mState->OnRelease(this);
      AC_LOGV("After eMouseUp, state: %s, consume: %d", mState->Name(), rv);
      break;

    case eMouseLongTap:
      AC_LOGV("Before eMouseLongTap, state: %s", mState->Name());
      rv = mState->OnLongTap(this, point);
      AC_LOGV("After eMouseLongTap, state: %s, consume: %d", mState->Name(),
              rv);
      break;

    default:
      break;
  }

  return rv;
}
예제 #5
0
nsEventStatus
AccessibleCaretEventHub::HandleMouseEvent(WidgetMouseEvent* aEvent)
{
  nsEventStatus rv = nsEventStatus_eIgnore;

  if (aEvent->button != WidgetMouseEvent::eLeftButton) {
    return rv;
  }

  int32_t id = (mActiveTouchId == kInvalidTouchId ?
                kDefaultTouchId : mActiveTouchId);
  nsPoint point = GetMouseEventPosition(aEvent);

  switch (aEvent->mMessage) {
  case eMouseDown:
    AC_LOGV("Before eMouseDown, state: %s", mState->Name());
    rv = mState->OnPress(this, point, id);
    AC_LOGV("After eMouseDown, state: %s, consume: %d",
            mState->Name(), rv);
    break;

  case eMouseMove:
    AC_LOGV("Before eMouseMove, state: %s", mState->Name());
    rv = mState->OnMove(this, point);
    AC_LOGV("After eMouseMove, state: %s, consume: %d", mState->Name(), rv);
    break;

  case eMouseUp:
    AC_LOGV("Before eMouseUp, state: %s", mState->Name());
    rv = mState->OnRelease(this);
    AC_LOGV("After eMouseUp, state: %s, consume: %d", mState->Name(),
            rv);
    break;

  case eMouseLongTap:
    AC_LOGV("Before eMouseLongTap, state: %s", mState->Name());
    rv = mState->OnLongTap(this, point);
    AC_LOGV("After eMouseLongTap, state: %s, consume: %d", mState->Name(),
            rv);
    break;

  default:
    break;
  }

  return rv;
}
nsEventStatus
AccessibleCaretEventHub::HandleTouchEvent(WidgetTouchEvent* aEvent)
{
  if (aEvent->mTouches.IsEmpty()) {
    AC_LOG("%s: Receive a touch event without any touch data!", __FUNCTION__);
    return nsEventStatus_eIgnore;
  }

  nsEventStatus rv = nsEventStatus_eIgnore;

  int32_t id =
    (mActiveTouchId == kInvalidTouchId ? aEvent->mTouches[0]->Identifier()
                                       : mActiveTouchId);
  nsPoint point = GetTouchEventPosition(aEvent, id);

  mManager->SetLastInputSource(nsIDOMMouseEvent::MOZ_SOURCE_TOUCH);

  switch (aEvent->mMessage) {
    case eTouchStart:
      AC_LOGV("Before eTouchStart, state: %s", mState->Name());
      rv = mState->OnPress(this, point, id, eTouchEventClass);
      AC_LOGV("After eTouchStart, state: %s, consume: %d", mState->Name(), rv);
      break;

    case eTouchMove:
      AC_LOGV("Before eTouchMove, state: %s", mState->Name());
      rv = mState->OnMove(this, point);
      AC_LOGV("After eTouchMove, state: %s, consume: %d", mState->Name(), rv);
      break;

    case eTouchEnd:
      AC_LOGV("Before eTouchEnd, state: %s", mState->Name());
      rv = mState->OnRelease(this);
      AC_LOGV("After eTouchEnd, state: %s, consume: %d", mState->Name(), rv);
      break;

    case eTouchCancel:
      AC_LOGV("Got eTouchCancel, state: %s", mState->Name());
      // Do nothing since we don't really care eTouchCancel anyway.
      break;

    default:
      break;
  }

  return rv;
}
예제 #7
0
nsEventStatus
AccessibleCaretEventHub::HandleTouchEvent(WidgetTouchEvent* aEvent)
{
  nsEventStatus rv = nsEventStatus_eIgnore;

  int32_t id = (mActiveTouchId == kInvalidTouchId ?
                aEvent->touches[0]->Identifier() : mActiveTouchId);
  nsPoint point = GetTouchEventPosition(aEvent, id);

  switch (aEvent->mMessage) {
  case NS_TOUCH_START:
    AC_LOGV("Before NS_TOUCH_START, state: %s", mState->Name());
    rv = mState->OnPress(this, point, id);
    AC_LOGV("After NS_TOUCH_START, state: %s, consume: %d", mState->Name(), rv);
    break;

  case NS_TOUCH_MOVE:
    AC_LOGV("Before NS_TOUCH_MOVE, state: %s", mState->Name());
    rv = mState->OnMove(this, point);
    AC_LOGV("After NS_TOUCH_MOVE, state: %s, consume: %d", mState->Name(), rv);
    break;

  case NS_TOUCH_END:
    AC_LOGV("Before NS_TOUCH_END, state: %s", mState->Name());
    rv = mState->OnRelease(this);
    AC_LOGV("After NS_TOUCH_END, state: %s, consume: %d", mState->Name(), rv);
    break;

  case NS_TOUCH_CANCEL:
    AC_LOGV("Before NS_TOUCH_CANCEL, state: %s", mState->Name());
    rv = mState->OnRelease(this);
    AC_LOGV("After NS_TOUCH_CANCEL, state: %s, consume: %d", mState->Name(),
            rv);
    break;

  default:
    break;
  }

  return rv;
}
nsEventStatus
AccessibleCaretEventHub::HandleTouchEvent(WidgetTouchEvent* aEvent)
{
  nsEventStatus rv = nsEventStatus_eIgnore;

  int32_t id = (mActiveTouchId == kInvalidTouchId ?
                aEvent->touches[0]->Identifier() : mActiveTouchId);
  nsPoint point = GetTouchEventPosition(aEvent, id);

  switch (aEvent->mMessage) {
  case eTouchStart:
    AC_LOGV("Before eTouchStart, state: %s", mState->Name());
    rv = mState->OnPress(this, point, id);
    AC_LOGV("After eTouchStart, state: %s, consume: %d", mState->Name(), rv);
    break;

  case eTouchMove:
    AC_LOGV("Before eTouchMove, state: %s", mState->Name());
    rv = mState->OnMove(this, point);
    AC_LOGV("After eTouchMove, state: %s, consume: %d", mState->Name(), rv);
    break;

  case eTouchEnd:
    AC_LOGV("Before eTouchEnd, state: %s", mState->Name());
    rv = mState->OnRelease(this);
    AC_LOGV("After eTouchEnd, state: %s, consume: %d", mState->Name(), rv);
    break;

  case eTouchCancel:
    AC_LOGV("Before eTouchCancel, state: %s", mState->Name());
    rv = mState->OnRelease(this);
    AC_LOGV("After eTouchCancel, state: %s, consume: %d", mState->Name(),
            rv);
    break;

  default:
    break;
  }

  return rv;
}