summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg/SVGPathTraversalStateBuilder.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/svg/SVGPathTraversalStateBuilder.h')
-rw-r--r--Source/WebCore/svg/SVGPathTraversalStateBuilder.h52
1 files changed, 23 insertions, 29 deletions
diff --git a/Source/WebCore/svg/SVGPathTraversalStateBuilder.h b/Source/WebCore/svg/SVGPathTraversalStateBuilder.h
index 744e33b4d..6bd24d5d7 100644
--- a/Source/WebCore/svg/SVGPathTraversalStateBuilder.h
+++ b/Source/WebCore/svg/SVGPathTraversalStateBuilder.h
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2007 Eric Seidel <eric@webkit.org>
* Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -18,51 +19,44 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef SVGPathTraversalStateBuilder_h
-#define SVGPathTraversalStateBuilder_h
+#pragma once
-#if ENABLE(SVG)
#include "SVGPathConsumer.h"
-#include "SVGPoint.h"
namespace WebCore {
+class FloatPoint;
class PathTraversalState;
-class SVGPathTraversalStateBuilder : public SVGPathConsumer {
+class SVGPathTraversalStateBuilder final : public SVGPathConsumer {
public:
- SVGPathTraversalStateBuilder();
+ SVGPathTraversalStateBuilder(PathTraversalState&, float desiredLength = 0);
- unsigned pathSegmentIndex();
- float totalLength();
- SVGPoint currentPoint();
+ unsigned pathSegmentIndex() const { return m_segmentIndex; }
+ float totalLength() const;
+ FloatPoint currentPoint() const;
- void setCurrentTraversalState(PathTraversalState* traversalState) { m_traversalState = traversalState; }
- void setDesiredLength(float);
- virtual void incrementPathSegmentCount() override;
- virtual bool continueConsuming() override;
- virtual void cleanup() override { m_traversalState = 0; }
+ void incrementPathSegmentCount() final { ++m_segmentIndex; }
+ bool continueConsuming() final;
private:
// Used in UnalteredParsing/NormalizedParsing modes.
- virtual void moveTo(const FloatPoint&, bool closed, PathCoordinateMode) override;
- virtual void lineTo(const FloatPoint&, PathCoordinateMode) override;
- virtual void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode) override;
- virtual void closePath() override;
+ void moveTo(const FloatPoint&, bool closed, PathCoordinateMode) final;
+ void lineTo(const FloatPoint&, PathCoordinateMode) final;
+ void curveToCubic(const FloatPoint&, const FloatPoint&, const FloatPoint&, PathCoordinateMode) final;
+ void closePath() final;
private:
// Not used for PathTraversalState.
- virtual void lineToHorizontal(float, PathCoordinateMode) override { ASSERT_NOT_REACHED(); }
- virtual void lineToVertical(float, PathCoordinateMode) override { ASSERT_NOT_REACHED(); }
- virtual void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) override { ASSERT_NOT_REACHED(); }
- virtual void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) override { ASSERT_NOT_REACHED(); }
- virtual void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) override { ASSERT_NOT_REACHED(); }
- virtual void arcTo(float, float, float, bool, bool, const FloatPoint&, PathCoordinateMode) override { ASSERT_NOT_REACHED(); }
-
- PathTraversalState* m_traversalState;
+ void lineToHorizontal(float, PathCoordinateMode) final { ASSERT_NOT_REACHED(); }
+ void lineToVertical(float, PathCoordinateMode) final { ASSERT_NOT_REACHED(); }
+ void curveToCubicSmooth(const FloatPoint&, const FloatPoint&, PathCoordinateMode) final { ASSERT_NOT_REACHED(); }
+ void curveToQuadratic(const FloatPoint&, const FloatPoint&, PathCoordinateMode) final { ASSERT_NOT_REACHED(); }
+ void curveToQuadraticSmooth(const FloatPoint&, PathCoordinateMode) final { ASSERT_NOT_REACHED(); }
+ void arcTo(float, float, float, bool, bool, const FloatPoint&, PathCoordinateMode) final { ASSERT_NOT_REACHED(); }
+
+ PathTraversalState& m_traversalState;
+ unsigned m_segmentIndex { 0 };
};
} // namespace WebCore
-
-#endif // ENABLE(SVG)
-#endif // SVGPathTraversalStateBuilder_h