ExpectedGeckoMetrics.h (1445B)
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_ExpectedGeckoMetrics_h 8 #define mozilla_layers_ExpectedGeckoMetrics_h 9 10 #include "Units.h" 11 12 namespace mozilla { 13 namespace layers { 14 15 struct FrameMetrics; 16 17 // A class that stores a subset of the FrameMetrics information 18 // than an APZC instance expects Gecko to have (either the 19 // metrics that were most recently sent to Gecko, or the ones 20 // most recently received from Gecko). 21 class ExpectedGeckoMetrics { 22 public: 23 ExpectedGeckoMetrics() = default; 24 void UpdateFrom(const FrameMetrics& aMetrics); 25 void UpdateZoomFrom(const FrameMetrics& aMetrics); 26 27 const CSSPoint& GetVisualScrollOffset() const { return mVisualScrollOffset; } 28 const CSSPoint& GetLayoutScrollOffset() const { return mLayoutScrollOffset; } 29 const CSSToParentLayerScale& GetZoom() const { return mZoom; } 30 const CSSToLayoutDeviceScale& GetDevPixelsPerCSSPixel() const { 31 return mDevPixelsPerCSSPixel; 32 } 33 34 private: 35 CSSPoint mVisualScrollOffset; 36 CSSPoint mLayoutScrollOffset; 37 CSSToParentLayerScale mZoom; 38 CSSToLayoutDeviceScale mDevPixelsPerCSSPixel; 39 }; 40 41 } // namespace layers 42 } // namespace mozilla 43 44 #endif