michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * A class representing three matrices that can be used for style transforms. michael@0: */ michael@0: michael@0: #ifndef nsStyleTransformMatrix_h_ michael@0: #define nsStyleTransformMatrix_h_ michael@0: michael@0: #include "nsCSSValue.h" michael@0: #include "gfx3DMatrix.h" michael@0: michael@0: class nsStyleContext; michael@0: class nsPresContext; michael@0: struct nsRect; michael@0: michael@0: /** michael@0: * A helper to generate gfxMatrixes from css transform functions. michael@0: */ michael@0: namespace nsStyleTransformMatrix { michael@0: michael@0: /** michael@0: * Return the transform function, as an nsCSSKeyword, for the given michael@0: * nsCSSValue::Array from a transform list. michael@0: */ michael@0: nsCSSKeyword TransformFunctionOf(const nsCSSValue::Array* aData); michael@0: michael@0: float ProcessTranslatePart(const nsCSSValue& aValue, michael@0: nsStyleContext* aContext, michael@0: nsPresContext* aPresContext, michael@0: bool& aCanStoreInRuleTree, michael@0: nscoord aSize, michael@0: float aAppUnitsPerMatrixUnit); michael@0: michael@0: void michael@0: ProcessInterpolateMatrix(gfx3DMatrix& aMatrix, michael@0: const nsCSSValue::Array* aData, michael@0: nsStyleContext* aContext, michael@0: nsPresContext* aPresContext, michael@0: bool& aCanStoreInRuleTree, michael@0: nsRect& aBounds, float aAppUnitsPerMatrixUnit); michael@0: michael@0: /** michael@0: * Given an nsCSSValueList containing -moz-transform functions, michael@0: * returns a matrix containing the value of those functions. michael@0: * michael@0: * @param aData The nsCSSValueList containing the transform functions michael@0: * @param aContext The style context, used for unit conversion. michael@0: * @param aPresContext The presentation context, used for unit conversion. michael@0: * @param aCanStoreInRuleTree Set to false if the result cannot be cached michael@0: * in the rule tree, otherwise untouched. michael@0: * @param aBounds The frame's bounding rectangle. michael@0: * @param aAppUnitsPerMatrixUnit The number of app units per device pixel. michael@0: * michael@0: * aContext and aPresContext may be null if all of the (non-percent) michael@0: * length values in aData are already known to have been converted to michael@0: * eCSSUnit_Pixel (as they are in an nsStyleAnimation::Value) michael@0: */ michael@0: gfx3DMatrix ReadTransforms(const nsCSSValueList* aList, michael@0: nsStyleContext* aContext, michael@0: nsPresContext* aPresContext, michael@0: bool &aCanStoreInRuleTree, michael@0: nsRect& aBounds, michael@0: float aAppUnitsPerMatrixUnit); michael@0: michael@0: } // namespace nsStyleTransformMatrix michael@0: michael@0: #endif