OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013, Google Inc. All rights reserved. | 2 * Copyright (C) 2013, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 ASSERT(widths.size() == len); | 94 ASSERT(widths.size() == len); |
95 offsets.resize(len); | 95 offsets.resize(len); |
96 | 96 |
97 float widthSoFar = 0; | 97 float widthSoFar = 0; |
98 for (unsigned i = 0; i < len; i++) { | 98 for (unsigned i = 0; i < len; i++) { |
99 widthSoFar += widths[i]; | 99 widthSoFar += widths[i]; |
100 offsets[i] = roundf(widthSoFar); | 100 offsets[i] = roundf(widthSoFar); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 void AXInlineTextBox::wordBoundaries(Vector<PlainTextRange>& words) const | 104 void AXInlineTextBox::wordBoundaries(Vector<AXRange>& words) const |
105 { | 105 { |
106 if (!m_inlineTextBox) | 106 if (!m_inlineTextBox) |
107 return; | 107 return; |
108 | 108 |
109 Vector<AbstractInlineTextBox::WordBoundaries> wordBoundaries; | 109 Vector<AbstractInlineTextBox::WordBoundaries> wordBoundaries; |
110 m_inlineTextBox->wordBoundaries(wordBoundaries); | 110 m_inlineTextBox->wordBoundaries(wordBoundaries); |
111 words.resize(wordBoundaries.size()); | 111 words.resize(wordBoundaries.size()); |
112 for (unsigned i = 0; i < wordBoundaries.size(); i++) | 112 for (unsigned i = 0; i < wordBoundaries.size(); i++) |
113 words[i] = PlainTextRange(wordBoundaries[i].startIndex, wordBoundaries[i
].endIndex - wordBoundaries[i].startIndex); | 113 words[i] = AXRange(wordBoundaries[i].startIndex, wordBoundaries[i].endIn
dex); |
114 } | 114 } |
115 | 115 |
116 String AXInlineTextBox::stringValue() const | 116 String AXInlineTextBox::stringValue() const |
117 { | 117 { |
118 if (!m_inlineTextBox) | 118 if (!m_inlineTextBox) |
119 return String(); | 119 return String(); |
120 | 120 |
121 return m_inlineTextBox->text(); | 121 return m_inlineTextBox->text(); |
122 } | 122 } |
123 | 123 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 if (previousOnLine) | 169 if (previousOnLine) |
170 return m_axObjectCache->getOrCreate(previousOnLine.get()); | 170 return m_axObjectCache->getOrCreate(previousOnLine.get()); |
171 | 171 |
172 if (!m_inlineTextBox->isFirst()) | 172 if (!m_inlineTextBox->isFirst()) |
173 return 0; | 173 return 0; |
174 | 174 |
175 return parentObject()->previousOnLine(); | 175 return parentObject()->previousOnLine(); |
176 } | 176 } |
177 | 177 |
178 } // namespace blink | 178 } // namespace blink |
OLD | NEW |