tor-browser

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

MockHitTester.h (1596B)


      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 #ifndef mozilla_layers_MockHitTester_h
      8 #define mozilla_layers_MockHitTester_h
      9 
     10 #include "apz/src/IAPZHitTester.h"
     11 #include "mozilla/gfx/CompositorHitTestInfo.h"
     12 #include "mozilla/layers/LayersTypes.h"
     13 
     14 #include <queue>
     15 
     16 namespace mozilla::layers {
     17 
     18 // IAPZHitTester implementation for APZ gtests.
     19 // This does not actually perform hit-testing, it just allows
     20 // the test code to specify the expected hit test results.
     21 class MockHitTester final : public IAPZHitTester {
     22 public:
     23  HitTestResult GetAPZCAtPoint(
     24      const ScreenPoint& aHitTestPoint,
     25      const RecursiveMutexAutoLock& aProofOfTreeLock) override;
     26 
     27  // Queue a hit test result whose target APZC is the APZC
     28  // with guid |aGuid|, and the provided hit test flags.
     29  void QueueHitResult(ScrollableLayerGuid aGuid,
     30                      gfx::CompositorHitTestInfo aHitInfo);
     31 
     32  // Queue a hit test result whose target is the scrollbar of the APZC
     33  // with scroll id |aScrollId| in the direction specified by |aDirection|.
     34  void QueueScrollbarThumbHitResult(ScrollableLayerGuid::ViewID aScrollId,
     35                                    ScrollDirection aDirection);
     36 
     37 private:
     38  std::queue<HitTestResult> mQueuedResults;
     39 };
     40 
     41 }  // namespace mozilla::layers
     42 
     43 #endif  // define mozilla_layers_MockHitTester_h