OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 22 matching lines...) Expand all Loading... |
33 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 33 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
34 public: | 34 public: |
35 enum MetricsType { | 35 enum MetricsType { |
36 SkippedSpaceMetrics | 36 SkippedSpaceMetrics |
37 }; | 37 }; |
38 | 38 |
39 SVGTextMetrics(); | 39 SVGTextMetrics(); |
40 SVGTextMetrics(MetricsType); | 40 SVGTextMetrics(MetricsType); |
41 SVGTextMetrics(LineLayoutSVGInlineText, unsigned length, float width); | 41 SVGTextMetrics(LineLayoutSVGInlineText, unsigned length, float width); |
42 | 42 |
43 static SVGTextMetrics measureCharacterRange(LineLayoutSVGInlineText, unsigne
d position, unsigned length, TextDirection); | |
44 static TextRun constructTextRun(LineLayoutSVGInlineText, unsigned position,
unsigned length, TextDirection); | 43 static TextRun constructTextRun(LineLayoutSVGInlineText, unsigned position,
unsigned length, TextDirection); |
45 | 44 |
46 bool isEmpty() const { return !m_width && !m_height && m_length <= 1; } | 45 bool isEmpty() const { return !m_width && !m_height && m_length <= 1; } |
47 | 46 |
48 float width() const { return m_width; } | 47 float width() const { return m_width; } |
49 void setWidth(float width) { m_width = width; } | 48 void setWidth(float width) { m_width = width; } |
50 | 49 |
51 float height() const { return m_height; } | 50 float height() const { return m_height; } |
52 | 51 |
53 // TODO(kojii): We should store logical width (advance) and height instead | 52 // TODO(kojii): We should store logical width (advance) and height instead |
54 // of storing physical and calculate logical. crbug.com/544767 | 53 // of storing physical and calculate logical. crbug.com/544767 |
55 float advance(FontOrientation) const; | 54 float advance(FontOrientation) const; |
56 unsigned length() const { return m_length; } | 55 unsigned length() const { return m_length; } |
57 | 56 |
58 private: | 57 private: |
59 SVGTextMetrics(LineLayoutSVGInlineText, const TextRun&); | 58 SVGTextMetrics(LineLayoutSVGInlineText, const TextRun&); |
60 | 59 |
61 float m_width; | 60 float m_width; |
62 float m_height; | 61 float m_height; |
63 unsigned m_length; | 62 unsigned m_length; |
64 }; | 63 }; |
65 | 64 |
66 } // namespace blink | 65 } // namespace blink |
67 | 66 |
68 #endif | 67 #endif |
OLD | NEW |