• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) Research In Motion Limited 2010. 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 #ifndef SVGTextLayoutAttributes_h
21 #define SVGTextLayoutAttributes_h
22 
23 #if ENABLE(SVG)
24 #include "SVGTextMetrics.h"
25 #include <wtf/Vector.h>
26 #include <wtf/text/WTFString.h>
27 
28 namespace WebCore {
29 
30 class RenderSVGInlineText;
31 
32 class SVGTextLayoutAttributes {
33 public:
34     struct PositioningLists {
35         void fillWithEmptyValues(unsigned length);
36         void appendEmptyValues();
37         void appendValuesFromPosition(const PositioningLists&, unsigned position);
38 
39         Vector<float> xValues;
40         Vector<float> yValues;
41         Vector<float> dxValues;
42         Vector<float> dyValues;
43         Vector<float> rotateValues;
44     };
45 
46     SVGTextLayoutAttributes(RenderSVGInlineText* context = 0);
47 
48     void reserveCapacity(unsigned length);
49     void dump() const;
50 
51     static float emptyValue();
52 
context()53     RenderSVGInlineText* context() const { return m_context; }
54 
positioningLists()55     PositioningLists& positioningLists() { return m_positioningLists; }
positioningLists()56     const PositioningLists& positioningLists() const { return m_positioningLists; }
57 
xValues()58     Vector<float>& xValues() { return m_positioningLists.xValues; }
xValues()59     const Vector<float>& xValues() const { return m_positioningLists.xValues; }
60 
yValues()61     Vector<float>& yValues() { return m_positioningLists.yValues; }
yValues()62     const Vector<float>& yValues() const { return m_positioningLists.yValues; }
63 
dxValues()64     Vector<float>& dxValues() { return m_positioningLists.dxValues; }
dxValues()65     const Vector<float>& dxValues() const { return m_positioningLists.dxValues; }
66 
dyValues()67     Vector<float>& dyValues() { return m_positioningLists.dyValues; }
dyValues()68     const Vector<float>& dyValues() const { return m_positioningLists.dyValues; }
69 
rotateValues()70     Vector<float>& rotateValues() { return m_positioningLists.rotateValues; }
rotateValues()71     const Vector<float>& rotateValues() const { return m_positioningLists.rotateValues; }
72 
textMetricsValues()73     Vector<SVGTextMetrics>& textMetricsValues() { return m_textMetricsValues; }
textMetricsValues()74     const Vector<SVGTextMetrics>& textMetricsValues() const { return m_textMetricsValues; }
75 
76 private:
77     RenderSVGInlineText* m_context;
78     PositioningLists m_positioningLists;
79     Vector<SVGTextMetrics> m_textMetricsValues;
80 };
81 
82 } // namespace WebCore
83 
84 #endif // ENABLE(SVG)
85 #endif
86