Coverage Report

Created: 2018-09-25 14:53

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