|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 /* |
|
7 * A class representing three matrices that can be used for style transforms. |
|
8 */ |
|
9 |
|
10 #ifndef nsStyleTransformMatrix_h_ |
|
11 #define nsStyleTransformMatrix_h_ |
|
12 |
|
13 #include "nsCSSValue.h" |
|
14 #include "gfx3DMatrix.h" |
|
15 |
|
16 class nsStyleContext; |
|
17 class nsPresContext; |
|
18 struct nsRect; |
|
19 |
|
20 /** |
|
21 * A helper to generate gfxMatrixes from css transform functions. |
|
22 */ |
|
23 namespace nsStyleTransformMatrix { |
|
24 |
|
25 /** |
|
26 * Return the transform function, as an nsCSSKeyword, for the given |
|
27 * nsCSSValue::Array from a transform list. |
|
28 */ |
|
29 nsCSSKeyword TransformFunctionOf(const nsCSSValue::Array* aData); |
|
30 |
|
31 float ProcessTranslatePart(const nsCSSValue& aValue, |
|
32 nsStyleContext* aContext, |
|
33 nsPresContext* aPresContext, |
|
34 bool& aCanStoreInRuleTree, |
|
35 nscoord aSize, |
|
36 float aAppUnitsPerMatrixUnit); |
|
37 |
|
38 void |
|
39 ProcessInterpolateMatrix(gfx3DMatrix& aMatrix, |
|
40 const nsCSSValue::Array* aData, |
|
41 nsStyleContext* aContext, |
|
42 nsPresContext* aPresContext, |
|
43 bool& aCanStoreInRuleTree, |
|
44 nsRect& aBounds, float aAppUnitsPerMatrixUnit); |
|
45 |
|
46 /** |
|
47 * Given an nsCSSValueList containing -moz-transform functions, |
|
48 * returns a matrix containing the value of those functions. |
|
49 * |
|
50 * @param aData The nsCSSValueList containing the transform functions |
|
51 * @param aContext The style context, used for unit conversion. |
|
52 * @param aPresContext The presentation context, used for unit conversion. |
|
53 * @param aCanStoreInRuleTree Set to false if the result cannot be cached |
|
54 * in the rule tree, otherwise untouched. |
|
55 * @param aBounds The frame's bounding rectangle. |
|
56 * @param aAppUnitsPerMatrixUnit The number of app units per device pixel. |
|
57 * |
|
58 * aContext and aPresContext may be null if all of the (non-percent) |
|
59 * length values in aData are already known to have been converted to |
|
60 * eCSSUnit_Pixel (as they are in an nsStyleAnimation::Value) |
|
61 */ |
|
62 gfx3DMatrix ReadTransforms(const nsCSSValueList* aList, |
|
63 nsStyleContext* aContext, |
|
64 nsPresContext* aPresContext, |
|
65 bool &aCanStoreInRuleTree, |
|
66 nsRect& aBounds, |
|
67 float aAppUnitsPerMatrixUnit); |
|
68 |
|
69 } // namespace nsStyleTransformMatrix |
|
70 |
|
71 #endif |