Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(827)

Side by Side Diff: Source/modules/accessibility/AXInlineTextBox.cpp

Issue 1185343003: Implements the ability to get and set the caret position and the current selection from anywhere in… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed retrieving the selection in text controls. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 ASSERT(widths.size() == len); 101 ASSERT(widths.size() == len);
102 offsets.resize(len); 102 offsets.resize(len);
103 103
104 float widthSoFar = 0; 104 float widthSoFar = 0;
105 for (unsigned i = 0; i < len; i++) { 105 for (unsigned i = 0; i < len; i++) {
106 widthSoFar += widths[i]; 106 widthSoFar += widths[i];
107 offsets[i] = roundf(widthSoFar); 107 offsets[i] = roundf(widthSoFar);
108 } 108 }
109 } 109 }
110 110
111 void AXInlineTextBox::wordBoundaries(Vector<PlainTextRange>& words) const 111 void AXInlineTextBox::wordBoundaries(Vector<AXRange>& words) const
112 { 112 {
113 if (!m_inlineTextBox) 113 if (!m_inlineTextBox)
114 return; 114 return;
115 115
116 Vector<AbstractInlineTextBox::WordBoundaries> wordBoundaries; 116 Vector<AbstractInlineTextBox::WordBoundaries> wordBoundaries;
117 m_inlineTextBox->wordBoundaries(wordBoundaries); 117 m_inlineTextBox->wordBoundaries(wordBoundaries);
118 words.resize(wordBoundaries.size()); 118 words.resize(wordBoundaries.size());
119 for (unsigned i = 0; i < wordBoundaries.size(); i++) 119 for (unsigned i = 0; i < wordBoundaries.size(); i++)
120 words[i] = PlainTextRange(wordBoundaries[i].startIndex, wordBoundaries[i ].endIndex - wordBoundaries[i].startIndex); 120 words[i] = AXRange(wordBoundaries[i].startIndex, wordBoundaries[i].endIn dex);
121 } 121 }
122 122
123 String AXInlineTextBox::stringValue() const 123 String AXInlineTextBox::stringValue() const
124 { 124 {
125 if (!m_inlineTextBox) 125 if (!m_inlineTextBox)
126 return String(); 126 return String();
127 127
128 return m_inlineTextBox->text(); 128 return m_inlineTextBox->text();
129 } 129 }
130 130
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (previousOnLine) 176 if (previousOnLine)
177 return m_axObjectCache->getOrCreate(previousOnLine.get()); 177 return m_axObjectCache->getOrCreate(previousOnLine.get());
178 178
179 if (!m_inlineTextBox->isFirst()) 179 if (!m_inlineTextBox->isFirst())
180 return 0; 180 return 0;
181 181
182 return parentObject()->previousOnLine(); 182 return parentObject()->previousOnLine();
183 } 183 }
184 184
185 } // namespace blink 185 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698