layout/style/nsStyleTransformMatrix.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/style/nsStyleTransformMatrix.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/*
    1.10 + * A class representing three matrices that can be used for style transforms.
    1.11 + */
    1.12 +
    1.13 +#ifndef nsStyleTransformMatrix_h_
    1.14 +#define nsStyleTransformMatrix_h_
    1.15 +
    1.16 +#include "nsCSSValue.h"
    1.17 +#include "gfx3DMatrix.h"
    1.18 +
    1.19 +class nsStyleContext;
    1.20 +class nsPresContext;
    1.21 +struct nsRect;
    1.22 +
    1.23 +/**
    1.24 + * A helper to generate gfxMatrixes from css transform functions.
    1.25 + */
    1.26 +namespace nsStyleTransformMatrix {
    1.27 +  
    1.28 +  /**
    1.29 +   * Return the transform function, as an nsCSSKeyword, for the given
    1.30 +   * nsCSSValue::Array from a transform list.
    1.31 +   */
    1.32 +  nsCSSKeyword TransformFunctionOf(const nsCSSValue::Array* aData);
    1.33 +
    1.34 +  float ProcessTranslatePart(const nsCSSValue& aValue,
    1.35 +                             nsStyleContext* aContext,
    1.36 +                             nsPresContext* aPresContext,
    1.37 +                             bool& aCanStoreInRuleTree,
    1.38 +                             nscoord aSize,
    1.39 +                             float aAppUnitsPerMatrixUnit);
    1.40 +
    1.41 +  void
    1.42 +  ProcessInterpolateMatrix(gfx3DMatrix& aMatrix,
    1.43 +                            const nsCSSValue::Array* aData,
    1.44 +                            nsStyleContext* aContext,
    1.45 +                            nsPresContext* aPresContext,
    1.46 +                            bool& aCanStoreInRuleTree,
    1.47 +                            nsRect& aBounds, float aAppUnitsPerMatrixUnit);
    1.48 +
    1.49 +  /**
    1.50 +   * Given an nsCSSValueList containing -moz-transform functions,
    1.51 +   * returns a matrix containing the value of those functions.
    1.52 +   *
    1.53 +   * @param aData The nsCSSValueList containing the transform functions
    1.54 +   * @param aContext The style context, used for unit conversion.
    1.55 +   * @param aPresContext The presentation context, used for unit conversion.
    1.56 +   * @param aCanStoreInRuleTree Set to false if the result cannot be cached
    1.57 +   *                            in the rule tree, otherwise untouched.
    1.58 +   * @param aBounds The frame's bounding rectangle.
    1.59 +   * @param aAppUnitsPerMatrixUnit The number of app units per device pixel.
    1.60 +   *
    1.61 +   * aContext and aPresContext may be null if all of the (non-percent)
    1.62 +   * length values in aData are already known to have been converted to
    1.63 +   * eCSSUnit_Pixel (as they are in an nsStyleAnimation::Value)
    1.64 +   */
    1.65 +  gfx3DMatrix ReadTransforms(const nsCSSValueList* aList,
    1.66 +                             nsStyleContext* aContext,
    1.67 +                             nsPresContext* aPresContext,
    1.68 +                             bool &aCanStoreInRuleTree,
    1.69 +                             nsRect& aBounds,
    1.70 +                             float aAppUnitsPerMatrixUnit);
    1.71 +
    1.72 +} // namespace nsStyleTransformMatrix
    1.73 +
    1.74 +#endif

mercurial