tor-browser

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

InputAPZContext.cpp (2332B)


      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 "InputAPZContext.h"
      8 
      9 namespace mozilla {
     10 namespace layers {
     11 
     12 MOZ_RUNINIT ScrollableLayerGuid InputAPZContext::sGuid;
     13 uint64_t InputAPZContext::sBlockId = 0;
     14 nsEventStatus InputAPZContext::sApzResponse = nsEventStatus_eSentinel;
     15 bool InputAPZContext::sPendingLayerization = false;
     16 bool InputAPZContext::sRoutedToChildProcess = false;
     17 bool InputAPZContext::sDropped = false;
     18 
     19 /*static*/
     20 ScrollableLayerGuid InputAPZContext::GetTargetLayerGuid() { return sGuid; }
     21 
     22 /*static*/
     23 uint64_t InputAPZContext::GetInputBlockId() { return sBlockId; }
     24 
     25 /*static*/
     26 nsEventStatus InputAPZContext::GetApzResponse() { return sApzResponse; }
     27 
     28 /*static*/
     29 bool InputAPZContext::HavePendingLayerization() { return sPendingLayerization; }
     30 
     31 /*static*/
     32 bool InputAPZContext::WasRoutedToChildProcess() {
     33  return sRoutedToChildProcess;
     34 }
     35 
     36 /*static*/
     37 bool InputAPZContext::WasDropped() { return sDropped; }
     38 
     39 InputAPZContext::InputAPZContext(const ScrollableLayerGuid& aGuid,
     40                                 const uint64_t& aBlockId,
     41                                 const nsEventStatus& aApzResponse,
     42                                 bool aPendingLayerization)
     43    : mOldGuid(sGuid),
     44      mOldBlockId(sBlockId),
     45      mOldApzResponse(sApzResponse),
     46      mOldPendingLayerization(sPendingLayerization),
     47      mOldRoutedToChildProcess(sRoutedToChildProcess),
     48      mOldDropped(sDropped) {
     49  sGuid = aGuid;
     50  sBlockId = aBlockId;
     51  sApzResponse = aApzResponse;
     52  sPendingLayerization = aPendingLayerization;
     53  sRoutedToChildProcess = false;
     54  sDropped = false;
     55 }
     56 
     57 InputAPZContext::~InputAPZContext() {
     58  sGuid = mOldGuid;
     59  sBlockId = mOldBlockId;
     60  sApzResponse = mOldApzResponse;
     61  sPendingLayerization = mOldPendingLayerization;
     62  sRoutedToChildProcess = mOldRoutedToChildProcess;
     63  sDropped = mOldDropped;
     64 }
     65 
     66 /*static*/
     67 void InputAPZContext::SetRoutedToChildProcess() {
     68  sRoutedToChildProcess = true;
     69 }
     70 
     71 /*static*/
     72 void InputAPZContext::SetDropped() { sDropped = true; }
     73 
     74 }  // namespace layers
     75 }  // namespace mozilla