コード例 #1
0
nsresult
DOMWheelEvent::InitFromCtor(const nsAString& aType,
                            JSContext* aCx, jsval* aVal)
{
  WheelEventInit d;
  nsresult rv = d.Init(aCx, aVal);
  NS_ENSURE_SUCCESS(rv, rv);

  nsAutoString modifierList;
  if (d.ctrlKey) {
    modifierList.AppendLiteral(NS_DOM_KEYNAME_CONTROL);
  }
  if (d.shiftKey) {
    if (!modifierList.IsEmpty()) {
      modifierList.AppendLiteral(" ");
    }
    modifierList.AppendLiteral(NS_DOM_KEYNAME_SHIFT);
  }
  if (d.altKey) {
    if (!modifierList.IsEmpty()) {
      modifierList.AppendLiteral(" ");
    }
    modifierList.AppendLiteral(NS_DOM_KEYNAME_ALT);
  }
  if (d.metaKey) {
    if (!modifierList.IsEmpty()) {
      modifierList.AppendLiteral(" ");
    }
    modifierList.AppendLiteral(NS_DOM_KEYNAME_META);
  }

  rv = InitWheelEvent(aType, d.bubbles, d.cancelable,
                      d.view, d.detail, d.screenX, d.screenY,
                      d.clientX, d.clientY, d.button, d.relatedTarget,
                      modifierList, d.deltaX, d.deltaY, d.deltaZ, d.deltaMode);
  NS_ENSURE_SUCCESS(rv, rv);

  static_cast<widget::WheelEvent*>(mEvent)->buttons = d.buttons;

  return NS_OK;
}
コード例 #2
0
nsresult
DOMWheelEvent::InitFromCtor(const nsAString& aType,
                            JSContext* aCx, JS::Value* aVal)
{
  mozilla::idl::WheelEventInit d;
  nsresult rv = d.Init(aCx, aVal);
  NS_ENSURE_SUCCESS(rv, rv);

  nsAutoString modifierList;
  GetModifierList(d.ctrlKey, d.shiftKey, d.altKey, d.metaKey, modifierList);

  rv = InitWheelEvent(aType, d.bubbles, d.cancelable,
                      d.view, d.detail, d.screenX, d.screenY,
                      d.clientX, d.clientY, d.button, d.relatedTarget,
                      modifierList, d.deltaX, d.deltaY, d.deltaZ, d.deltaMode);
  NS_ENSURE_SUCCESS(rv, rv);

  static_cast<widget::WheelEvent*>(mEvent)->buttons = d.buttons;

  return NS_OK;
}