tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

KeyboardScrollAction.cpp (1293B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #include "mozilla/layers/KeyboardScrollAction.h"
      8 
      9 namespace mozilla {
     10 namespace layers {
     11 
     12 /* static */ ScrollUnit KeyboardScrollAction::GetScrollUnit(
     13    KeyboardScrollAction::KeyboardScrollActionType aDeltaType) {
     14  switch (aDeltaType) {
     15    case KeyboardScrollAction::eScrollCharacter:
     16      return ScrollUnit::LINES;
     17    case KeyboardScrollAction::eScrollLine:
     18      return ScrollUnit::LINES;
     19    case KeyboardScrollAction::eScrollPage:
     20      return ScrollUnit::PAGES;
     21    case KeyboardScrollAction::eScrollComplete:
     22      return ScrollUnit::WHOLE;
     23  }
     24 
     25  // Silence an overzealous warning
     26  return ScrollUnit::WHOLE;
     27 }
     28 
     29 KeyboardScrollAction::KeyboardScrollAction()
     30    : mType(KeyboardScrollAction::eScrollCharacter), mForward(false) {}
     31 
     32 KeyboardScrollAction::KeyboardScrollAction(KeyboardScrollActionType aType,
     33                                           bool aForward)
     34    : mType(aType), mForward(aForward) {}
     35 
     36 }  // namespace layers
     37 }  // namespace mozilla