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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 } | 229 } |
230 | 230 |
231 if (dst->role == ui::AX_ROLE_COLOR_WELL) { | 231 if (dst->role == ui::AX_ROLE_COLOR_WELL) { |
232 int r, g, b; | 232 int r, g, b; |
233 src.colorValue(r, g, b); | 233 src.colorValue(r, g, b); |
234 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_RED, r); | 234 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_RED, r); |
235 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_GREEN, g); | 235 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_GREEN, g); |
236 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_BLUE, b); | 236 dst->AddIntAttribute(ui::AX_ATTR_COLOR_VALUE_BLUE, b); |
237 } | 237 } |
238 | 238 |
| 239 if (src.invalidState()) { |
| 240 dst->AddIntAttribute(ui::AX_ATTR_INVALID_STATE, |
| 241 AXInvalidStateFromBlink(src.invalidState())); |
| 242 } |
| 243 if (src.invalidState() == blink::WebAXInvalidStateOther) { |
| 244 dst->AddStringAttribute(ui::AX_ATTR_ARIA_INVALID_VALUE, |
| 245 UTF16ToUTF8(src.ariaInvalidValue())); |
| 246 } |
| 247 |
239 if (dst->role == ui::AX_ROLE_INLINE_TEXT_BOX) { | 248 if (dst->role == ui::AX_ROLE_INLINE_TEXT_BOX) { |
240 dst->AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, | 249 dst->AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, |
241 AXTextDirectionFromBlink(src.textDirection())); | 250 AXTextDirectionFromBlink(src.textDirection())); |
242 | 251 |
243 WebVector<int> src_character_offsets; | 252 WebVector<int> src_character_offsets; |
244 src.characterOffsets(src_character_offsets); | 253 src.characterOffsets(src_character_offsets); |
245 std::vector<int32> character_offsets; | 254 std::vector<int32> character_offsets; |
246 character_offsets.reserve(src_character_offsets.size()); | 255 character_offsets.reserve(src_character_offsets.size()); |
247 for (size_t i = 0; i < src_character_offsets.size(); ++i) | 256 for (size_t i = 0; i < src_character_offsets.size(); ++i) |
248 character_offsets.push_back(src_character_offsets[i]); | 257 character_offsets.push_back(src_character_offsets[i]); |
(...skipping 11 matching lines...) Expand all Loading... |
260 word_ends.push_back(src_word_ends[i]); | 269 word_ends.push_back(src_word_ends[i]); |
261 } | 270 } |
262 dst->AddIntListAttribute(ui::AX_ATTR_WORD_STARTS, word_starts); | 271 dst->AddIntListAttribute(ui::AX_ATTR_WORD_STARTS, word_starts); |
263 dst->AddIntListAttribute(ui::AX_ATTR_WORD_ENDS, word_ends); | 272 dst->AddIntListAttribute(ui::AX_ATTR_WORD_ENDS, word_ends); |
264 } | 273 } |
265 | 274 |
266 if (src.accessKey().length()) { | 275 if (src.accessKey().length()) { |
267 dst->AddStringAttribute(ui::AX_ATTR_ACCESS_KEY, | 276 dst->AddStringAttribute(ui::AX_ATTR_ACCESS_KEY, |
268 UTF16ToUTF8(src.accessKey())); | 277 UTF16ToUTF8(src.accessKey())); |
269 } | 278 } |
| 279 |
270 if (src.actionVerb().length()) | 280 if (src.actionVerb().length()) |
271 dst->AddStringAttribute(ui::AX_ATTR_ACTION, UTF16ToUTF8(src.actionVerb())); | 281 dst->AddStringAttribute(ui::AX_ATTR_ACTION, UTF16ToUTF8(src.actionVerb())); |
272 if (src.ariaAutoComplete().length()) | 282 if (src.ariaAutoComplete().length()) |
273 dst->AddStringAttribute(ui::AX_ATTR_AUTO_COMPLETE, | 283 dst->AddStringAttribute(ui::AX_ATTR_AUTO_COMPLETE, |
274 UTF16ToUTF8(src.ariaAutoComplete())); | 284 UTF16ToUTF8(src.ariaAutoComplete())); |
275 if (src.isAriaReadOnly()) | 285 if (src.isAriaReadOnly()) |
276 dst->AddBoolAttribute(ui::AX_ATTR_ARIA_READONLY, true); | 286 dst->AddBoolAttribute(ui::AX_ATTR_ARIA_READONLY, true); |
277 if (src.isButtonStateMixed()) | 287 if (src.isButtonStateMixed()) |
278 dst->AddBoolAttribute(ui::AX_ATTR_BUTTON_MIXED, true); | 288 dst->AddBoolAttribute(ui::AX_ATTR_BUTTON_MIXED, true); |
279 if (src.canSetValueAttribute()) | 289 if (src.canSetValueAttribute()) |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); | 583 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); |
574 } | 584 } |
575 | 585 |
576 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { | 586 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { |
577 if (render_frame_ && render_frame_->GetWebFrame()) | 587 if (render_frame_ && render_frame_->GetWebFrame()) |
578 return render_frame_->GetWebFrame()->document(); | 588 return render_frame_->GetWebFrame()->document(); |
579 return WebDocument(); | 589 return WebDocument(); |
580 } | 590 } |
581 | 591 |
582 } // namespace content | 592 } // namespace content |
OLD | NEW |