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

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

Issue 2745713002: WIP: Modified AXPosition to work with objects with both embedded object characters and text. (Closed)
Patch Set: Simplified and cleaned up selection code in Blink > Accessibility. Created 3 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 offsets[i] = roundf(width_so_far); 111 offsets[i] = roundf(width_so_far);
112 } 112 }
113 } 113 }
114 114
115 void AXInlineTextBox::GetWordBoundaries(Vector<AXRange>& words) const { 115 void AXInlineTextBox::GetWordBoundaries(Vector<AXRange>& words) const {
116 if (!inline_text_box_) 116 if (!inline_text_box_)
117 return; 117 return;
118 118
119 Vector<AbstractInlineTextBox::WordBoundaries> word_boundaries; 119 Vector<AbstractInlineTextBox::WordBoundaries> word_boundaries;
120 inline_text_box_->GetWordBoundaries(word_boundaries); 120 inline_text_box_->GetWordBoundaries(word_boundaries);
121 words.resize(word_boundaries.size()); 121 for (unsigned i = 0; i < word_boundaries.size(); i++) {
122 for (unsigned i = 0; i < word_boundaries.size(); i++) 122 words.emplace_back(
123 words[i] = 123 const_cast<AXInlineTextBox*>(this), word_boundaries[i].start_index,
124 AXRange(word_boundaries[i].start_index, word_boundaries[i].end_index); 124 const_cast<AXInlineTextBox*>(this), word_boundaries[i].end_index);
125 }
125 } 126 }
126 127
127 String AXInlineTextBox::GetName( 128 String AXInlineTextBox::GetName(
128 AXNameFrom& name_from, 129 AXNameFrom& name_from,
129 AXObjectImpl::AXObjectVector* name_objects) const { 130 AXObjectImpl::AXObjectVector* name_objects) const {
130 if (!inline_text_box_) 131 if (!inline_text_box_)
131 return String(); 132 return String();
132 133
133 name_from = kAXNameFromContents; 134 name_from = kAXNameFromContents;
134 return inline_text_box_->GetText(); 135 return inline_text_box_->GetText();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (previous_on_line) 182 if (previous_on_line)
182 return ax_object_cache_->GetOrCreate(previous_on_line.Get()); 183 return ax_object_cache_->GetOrCreate(previous_on_line.Get());
183 184
184 if (!inline_text_box_->IsFirst()) 185 if (!inline_text_box_->IsFirst())
185 return 0; 186 return 0;
186 187
187 return ParentObject()->PreviousOnLine(); 188 return ParentObject()->PreviousOnLine();
188 } 189 }
189 190
190 } // namespace blink 191 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698