2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-09-14 17:48:36 +04:00
|
|
|
|
2011-09-26 01:04:32 +04:00
|
|
|
#ifndef MOZILLA_SVGTRANSFORMLISTPARSER_H__
|
|
|
|
#define MOZILLA_SVGTRANSFORMLISTPARSER_H__
|
2006-09-14 17:48:36 +04:00
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2018-12-21 23:19:15 +03:00
|
|
|
#include "SVGDataParser.h"
|
2011-09-26 01:04:31 +04:00
|
|
|
#include "nsTArray.h"
|
2006-09-14 17:48:36 +04:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
2013-10-29 21:15:39 +04:00
|
|
|
// SVGTransformListParser: A simple recursive descent parser that builds
|
|
|
|
// transform lists from transform attributes. The grammar for path data
|
2006-09-14 17:48:36 +04:00
|
|
|
// can be found in SVG 1.1, chapter 7.
|
|
|
|
// http://www.w3.org/TR/SVG11/coords.html#TransformAttribute
|
|
|
|
|
2011-09-26 01:04:32 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
2018-12-29 12:15:40 +03:00
|
|
|
class SVGTransform;
|
2011-09-26 01:04:32 +04:00
|
|
|
|
2018-12-21 23:19:15 +03:00
|
|
|
class SVGTransformListParser : public SVGDataParser {
|
2006-09-14 17:48:36 +04:00
|
|
|
public:
|
2014-09-01 05:08:04 +04:00
|
|
|
explicit SVGTransformListParser(const nsAString& aValue)
|
2018-12-21 23:19:15 +03:00
|
|
|
: SVGDataParser(aValue) {}
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2013-10-29 21:15:39 +04:00
|
|
|
bool Parse();
|
|
|
|
|
2018-12-29 12:15:40 +03:00
|
|
|
const nsTArray<SVGTransform>& GetTransformList() const { return mTransforms; }
|
2006-09-14 17:48:36 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
// helpers
|
2013-10-29 21:15:39 +04:00
|
|
|
bool ParseArguments(float* aResult, uint32_t aMaxCount,
|
|
|
|
uint32_t* aParsedCount);
|
2006-09-14 17:48:36 +04:00
|
|
|
|
2013-10-29 21:15:39 +04:00
|
|
|
bool ParseTransforms();
|
2006-09-14 17:48:36 +04:00
|
|
|
|
2013-10-29 21:15:39 +04:00
|
|
|
bool ParseTransform();
|
2006-09-14 17:48:36 +04:00
|
|
|
|
2013-10-29 21:15:39 +04:00
|
|
|
bool ParseTranslate();
|
|
|
|
bool ParseScale();
|
|
|
|
bool ParseRotate();
|
|
|
|
bool ParseSkewX();
|
|
|
|
bool ParseSkewY();
|
|
|
|
bool ParseMatrix();
|
2006-09-14 17:48:36 +04:00
|
|
|
|
2018-12-29 12:15:40 +03:00
|
|
|
FallibleTArray<SVGTransform> mTransforms;
|
2006-09-14 17:48:36 +04:00
|
|
|
};
|
|
|
|
|
2011-09-26 01:04:32 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // MOZILLA_SVGTRANSFORMLISTPARSER_H__
|