tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SVGTransformListParser.h (1512B)


      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 DOM_SVG_SVGTRANSFORMLISTPARSER_H_
      8 #define DOM_SVG_SVGTRANSFORMLISTPARSER_H_
      9 
     10 #include "SVGDataParser.h"
     11 #include "nsTArray.h"
     12 
     13 ////////////////////////////////////////////////////////////////////////
     14 // SVGTransformListParser: A simple recursive descent parser that builds
     15 // transform lists from transform attributes. The grammar for path data
     16 // can be found in SVG 1.1,  chapter 7.
     17 // http://www.w3.org/TR/SVG11/coords.html#TransformAttribute
     18 
     19 namespace mozilla {
     20 
     21 class SVGTransform;
     22 
     23 class SVGTransformListParser : public SVGDataParser {
     24 public:
     25  explicit SVGTransformListParser(const nsAString& aValue)
     26      : SVGDataParser(aValue) {}
     27 
     28  bool Parse();
     29 
     30  const nsTArray<SVGTransform>& GetTransformList() const { return mTransforms; }
     31 
     32 private:
     33  // helpers
     34  bool ParseArguments(float* aResult, uint32_t aMaxCount,
     35                      uint32_t* aParsedCount);
     36 
     37  bool ParseTransforms();
     38 
     39  bool ParseTransform();
     40 
     41  bool ParseTranslate();
     42  bool ParseScale();
     43  bool ParseRotate();
     44  bool ParseSkewX();
     45  bool ParseSkewY();
     46  bool ParseMatrix();
     47 
     48  FallibleTArray<SVGTransform> mTransforms;
     49 };
     50 
     51 }  // namespace mozilla
     52 
     53 #endif  // DOM_SVG_SVGTRANSFORMLISTPARSER_H_