OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/renderer/accessibility/blink_ax_tree_source.h" | 5 #include "content/renderer/accessibility/blink_ax_tree_source.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 } | 227 } |
228 | 228 |
229 if (dst->role == ui::AX_ROLE_COLOR_WELL) { | 229 if (dst->role == ui::AX_ROLE_COLOR_WELL) { |
230 int r, g, b; | 230 int r, g, b; |
231 src.colorValue(r, g, b); | 231 src.colorValue(r, g, b); |
232 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_RED, r); | 232 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_RED, r); |
233 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_GREEN, g); | 233 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_GREEN, g); |
234 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_BLUE, b); | 234 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_BLUE, b); |
235 } | 235 } |
236 | 236 |
237 if (src.invalidState()) | |
238 dst->AddIntAttribute(ui::AX_ATTR_INVALID_STATE, | |
dmazzoni
2014/12/19 17:30:34
nit: indent 2 less, and use braces because this sp
| |
239 AXInvalidStateFromBlink(src.invalidState())); | |
240 if (src.invalidState() == blink::WebAXInvalidStateOther) | |
241 dst->AddStringAttribute(ui::AX_ATTR_ARIA_INVALID_VALUE, | |
dmazzoni
2014/12/19 17:30:34
same
| |
242 UTF16ToUTF8(src.ariaInvalidValue())); | |
243 | |
237 if (dst->role == ui::AX_ROLE_INLINE_TEXT_BOX) { | 244 if (dst->role == ui::AX_ROLE_INLINE_TEXT_BOX) { |
238 dst->AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, | 245 dst->AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, |
239 AXTextDirectionFromBlink(src.textDirection())); | 246 AXTextDirectionFromBlink(src.textDirection())); |
240 | 247 |
241 WebVector<int> src_character_offsets; | 248 WebVector<int> src_character_offsets; |
242 src.characterOffsets(src_character_offsets); | 249 src.characterOffsets(src_character_offsets); |
243 std::vector<int32> character_offsets; | 250 std::vector<int32> character_offsets; |
244 character_offsets.reserve(src_character_offsets.size()); | 251 character_offsets.reserve(src_character_offsets.size()); |
245 for (size_t i = 0; i < src_character_offsets.size(); ++i) | 252 for (size_t i = 0; i < src_character_offsets.size(); ++i) |
246 character_offsets.push_back(src_character_offsets[i]); | 253 character_offsets.push_back(src_character_offsets[i]); |
(...skipping 11 matching lines...) Expand all Loading... | |
258 word_ends.push_back(src_word_ends[i]); | 265 word_ends.push_back(src_word_ends[i]); |
259 } | 266 } |
260 dst->AddIntListAttribute(ui::AX_ATTR_WORD_STARTS, word_starts); | 267 dst->AddIntListAttribute(ui::AX_ATTR_WORD_STARTS, word_starts); |
261 dst->AddIntListAttribute(ui::AX_ATTR_WORD_ENDS, word_ends); | 268 dst->AddIntListAttribute(ui::AX_ATTR_WORD_ENDS, word_ends); |
262 } | 269 } |
263 | 270 |
264 if (src.accessKey().length()) { | 271 if (src.accessKey().length()) { |
265 dst->AddStringAttribute(ui::AX_ATTR_ACCESS_KEY, | 272 dst->AddStringAttribute(ui::AX_ATTR_ACCESS_KEY, |
266 UTF16ToUTF8(src.accessKey())); | 273 UTF16ToUTF8(src.accessKey())); |
267 } | 274 } |
275 | |
268 if (src.actionVerb().length()) | 276 if (src.actionVerb().length()) |
269 dst->AddStringAttribute(ui::AX_ATTR_ACTION, UTF16ToUTF8(src.actionVerb())); | 277 dst->AddStringAttribute(ui::AX_ATTR_ACTION, UTF16ToUTF8(src.actionVerb())); |
270 if (src.ariaAutoComplete().length()) | 278 if (src.ariaAutoComplete().length()) |
271 dst->AddStringAttribute(ui::AX_ATTR_AUTO_COMPLETE, | 279 dst->AddStringAttribute(ui::AX_ATTR_AUTO_COMPLETE, |
272 UTF16ToUTF8(src.ariaAutoComplete())); | 280 UTF16ToUTF8(src.ariaAutoComplete())); |
273 if (src.isAriaReadOnly()) | 281 if (src.isAriaReadOnly()) |
274 dst->AddBoolAttribute(ui::AX_ATTR_ARIA_READONLY, true); | 282 dst->AddBoolAttribute(ui::AX_ATTR_ARIA_READONLY, true); |
275 if (src.isButtonStateMixed()) | 283 if (src.isButtonStateMixed()) |
276 dst->AddBoolAttribute(ui::AX_ATTR_BUTTON_MIXED, true); | 284 dst->AddBoolAttribute(ui::AX_ATTR_BUTTON_MIXED, true); |
277 if (src.canSetValueAttribute()) | 285 if (src.canSetValueAttribute()) |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); | 575 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); |
568 } | 576 } |
569 | 577 |
570 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 578 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
571 if (render_frame_ && render_frame_->GetWebFrame()) | 579 if (render_frame_ && render_frame_->GetWebFrame()) |
572 return render_frame_->GetWebFrame()->document(); | 580 return render_frame_->GetWebFrame()->document(); |
573 return WebDocument(); | 581 return WebDocument(); |
574 } | 582 } |
575 | 583 |
576 } // namespace content | 584 } // namespace content |
OLD | NEW |