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_MatrixMessage_h 8 #define mozilla_layers_MatrixMessage_h 9 10 #include "mozilla/Maybe.h" 11 #include "mozilla/gfx/Matrix.h" 12 #include "mozilla/layers/LayersTypes.h" 13 #include "Units.h" // for ScreenRect 14 #include "UnitTransforms.h" 15 16 namespace mozilla { 17 namespace layers { 18 class MatrixMessage { 19 public: 20 // Don't use this one directly 21 MatrixMessage() = default; 22 MatrixMessage(const Maybe<LayerToScreenMatrix4x4> & aMatrix,const ScreenRect & aTopLevelViewportVisibleRectInBrowserCoords,const LayersId & aLayersId)23 MatrixMessage(const Maybe<LayerToScreenMatrix4x4>& aMatrix, 24 const ScreenRect& aTopLevelViewportVisibleRectInBrowserCoords, 25 const LayersId& aLayersId) 26 : mMatrix(ToUnknownMatrix(aMatrix)), 27 mTopLevelViewportVisibleRectInBrowserCoords( 28 aTopLevelViewportVisibleRectInBrowserCoords), 29 mLayersId(aLayersId) {} 30 GetMatrix()31 inline Maybe<LayerToScreenMatrix4x4> GetMatrix() const { 32 return LayerToScreenMatrix4x4::FromUnknownMatrix(mMatrix); 33 } 34 GetTopLevelViewportVisibleRectInBrowserCoords()35 inline ScreenRect GetTopLevelViewportVisibleRectInBrowserCoords() const { 36 return mTopLevelViewportVisibleRectInBrowserCoords; 37 } 38 GetLayersId()39 inline const LayersId& GetLayersId() const { return mLayersId; } 40 41 // Fields are public for IPC. Don't access directly 42 // elsewhere. 43 // Transform matrix to convert this layer to screen coordinate. 44 Maybe<gfx::Matrix4x4> mMatrix; // Untyped for IPC 45 // The remote iframe document rectangle corresponding to this layer. 46 // The rectangle is the result of clipped out by ancestor async scrolling so 47 // that the rectangle will be empty if it's completely scrolled out of view. 48 ScreenRect mTopLevelViewportVisibleRectInBrowserCoords; 49 LayersId mLayersId; 50 }; 51 }; // namespace layers 52 }; // namespace mozilla 53 54 #endif // mozilla_layers_MatrixMessage_h 55