1/*
2 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#pragma once
21
22#include "SVGTextMetrics.h"
23#include <wtf/HashMap.h>
24#include <wtf/Noncopyable.h>
25#include <wtf/Vector.h>
26
27namespace WebCore {
28
29class RenderSVGInlineText;
30
31struct SVGCharacterData {
32 SVGCharacterData();
33
34 float x;
35 float y;
36 float dx;
37 float dy;
38 float rotate;
39};
40
41typedef HashMap<unsigned, SVGCharacterData> SVGCharacterDataMap;
42
43class SVGTextLayoutAttributes {
44 WTF_MAKE_NONCOPYABLE(SVGTextLayoutAttributes);
45public:
46 explicit SVGTextLayoutAttributes(RenderSVGInlineText&);
47
48 void clear();
49 void dump() const;
50 static float emptyValue();
51
52 RenderSVGInlineText& context() { return m_context; }
53 const RenderSVGInlineText& context() const { return m_context; }
54
55 SVGCharacterDataMap& characterDataMap() { return m_characterDataMap; }
56 const SVGCharacterDataMap& characterDataMap() const { return m_characterDataMap; }
57
58 Vector<SVGTextMetrics>& textMetricsValues() { return m_textMetricsValues; }
59
60private:
61 RenderSVGInlineText& m_context;
62 SVGCharacterDataMap m_characterDataMap;
63 Vector<SVGTextMetrics> m_textMetricsValues;
64};
65
66inline SVGCharacterData::SVGCharacterData()
67 : x(SVGTextLayoutAttributes::emptyValue())
68 , y(SVGTextLayoutAttributes::emptyValue())
69 , dx(SVGTextLayoutAttributes::emptyValue())
70 , dy(SVGTextLayoutAttributes::emptyValue())
71 , rotate(SVGTextLayoutAttributes::emptyValue())
72{
73}
74
75} // namespace WebCore
76