Chromium Code Reviews| Index: Source/core/layout/svg/SVGTextMetrics.h |
| diff --git a/Source/core/layout/svg/SVGTextMetrics.h b/Source/core/layout/svg/SVGTextMetrics.h |
| index cbddde0a789de8d820c0126cb091b7911c6558d2..0fb8de219a2b9b74339ca9adb0dfcb1e4b994d30 100644 |
| --- a/Source/core/layout/svg/SVGTextMetrics.h |
| +++ b/Source/core/layout/svg/SVGTextMetrics.h |
| @@ -21,6 +21,7 @@ |
| #define SVGTextMetrics_h |
| #include "platform/text/TextDirection.h" |
| +#include "wtf/Vector.h" |
| namespace blink { |
| @@ -56,6 +57,34 @@ private: |
| unsigned m_length; |
| }; |
| +class SVGTextMetricsIterator { |
|
f(malita)
2015/05/27 01:53:49
nit: can this be a private nested class in SVGText
fs
2015/05/27 12:53:14
I have other possible uses in mind for this (SVGTe
|
| +public: |
| + SVGTextMetricsIterator() { reset(nullptr); } |
| + |
| + void reset(const Vector<SVGTextMetrics>* metricsList) |
|
pdr.
2015/05/27 03:11:18
I think this can be an internal detail of the iter
fs
2015/05/27 12:53:13
I wanted to keep the interface of the iterator fai
|
| + { |
| + m_metricsList = metricsList; |
| + m_characterOffset = 0; |
| + m_metricsListOffset = 0; |
| + } |
| + |
| + void next() |
| + { |
| + m_characterOffset += metrics().length(); |
| + ++m_metricsListOffset; |
| + } |
| + |
| + const SVGTextMetrics& metrics() const { return metricsList()[m_metricsListOffset]; } |
|
f(malita)
2015/05/27 01:53:49
nit: ASSERT(m_metricsList && m_metricsListOffset <
fs
2015/05/27 12:53:14
I've sort of been relying on the RELEASE_ASSERT in
|
| + const Vector<SVGTextMetrics>& metricsList() const { return *m_metricsList; } |
| + unsigned metricsListOffset() const { return m_metricsListOffset; } |
| + unsigned characterOffset() const { return m_characterOffset; } |
| + |
| +private: |
| + const Vector<SVGTextMetrics>* m_metricsList; |
| + unsigned m_metricsListOffset; |
| + unsigned m_characterOffset; |
| +}; |
| + |
| } // namespace blink |
| #endif |