| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef LineLayoutSVGInlineText_h | 5 #ifndef LineLayoutSVGInlineText_h |
| 6 #define LineLayoutSVGInlineText_h | 6 #define LineLayoutSVGInlineText_h |
| 7 | 7 |
| 8 #include "core/layout/api/LineLayoutText.h" | 8 #include "core/layout/api/LineLayoutText.h" |
| 9 #include "core/layout/svg/LayoutSVGInlineText.h" | 9 #include "core/layout/svg/LayoutSVGInlineText.h" |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 unsigned startCharacterOffset) { | 64 unsigned startCharacterOffset) { |
| 65 ASSERT(textLineLayout); | 65 ASSERT(textLineLayout); |
| 66 if (!m_textLineLayout || m_textLineLayout != textLineLayout) { | 66 if (!m_textLineLayout || m_textLineLayout != textLineLayout) { |
| 67 reset(textLineLayout); | 67 reset(textLineLayout); |
| 68 ASSERT(!metricsList().isEmpty()); | 68 ASSERT(!metricsList().isEmpty()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 if (m_characterOffset == startCharacterOffset) | 71 if (m_characterOffset == startCharacterOffset) |
| 72 return; | 72 return; |
| 73 | 73 |
| 74 // TODO(fs): We could walk backwards through the metrics list in these cases
. | 74 // TODO(fs): We could walk backwards through the metrics list in these |
| 75 // cases. |
| 75 if (m_characterOffset > startCharacterOffset) | 76 if (m_characterOffset > startCharacterOffset) |
| 76 reset(textLineLayout); | 77 reset(textLineLayout); |
| 77 | 78 |
| 78 while (m_characterOffset < startCharacterOffset) | 79 while (m_characterOffset < startCharacterOffset) |
| 79 next(); | 80 next(); |
| 80 ASSERT(m_characterOffset == startCharacterOffset); | 81 ASSERT(m_characterOffset == startCharacterOffset); |
| 81 } | 82 } |
| 82 | 83 |
| 83 void next() { | 84 void next() { |
| 84 m_characterOffset += metrics().length(); | 85 m_characterOffset += metrics().length(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 106 } | 107 } |
| 107 | 108 |
| 108 LineLayoutSVGInlineText m_textLineLayout; | 109 LineLayoutSVGInlineText m_textLineLayout; |
| 109 unsigned m_metricsListOffset; | 110 unsigned m_metricsListOffset; |
| 110 unsigned m_characterOffset; | 111 unsigned m_characterOffset; |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 } // namespace blink | 114 } // namespace blink |
| 114 | 115 |
| 115 #endif // LineLayoutSVGInlineText_h | 116 #endif // LineLayoutSVGInlineText_h |
| OLD | NEW |