Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/accessibility_node_serializer.h" | 5 #include "content/renderer/accessibility/accessibility_node_serializer.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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 } | 144 } |
| 145 | 145 |
| 146 if (dst->role == WebKit::WebAXRoleColorWell) { | 146 if (dst->role == WebKit::WebAXRoleColorWell) { |
| 147 int r, g, b; | 147 int r, g, b; |
| 148 src.colorValue(r, g, b); | 148 src.colorValue(r, g, b); |
| 149 dst->AddIntAttribute(dst->ATTR_COLOR_VALUE_RED, r); | 149 dst->AddIntAttribute(dst->ATTR_COLOR_VALUE_RED, r); |
| 150 dst->AddIntAttribute(dst->ATTR_COLOR_VALUE_GREEN, g); | 150 dst->AddIntAttribute(dst->ATTR_COLOR_VALUE_GREEN, g); |
| 151 dst->AddIntAttribute(dst->ATTR_COLOR_VALUE_BLUE, b); | 151 dst->AddIntAttribute(dst->ATTR_COLOR_VALUE_BLUE, b); |
| 152 } | 152 } |
| 153 | 153 |
| 154 if (dst->role == WebKit::WebAXRoleInlineTextBox) { | |
| 155 dst->AddIntAttribute(dst->ATTR_TEXT_DIRECTION, src.textDirection()); | |
| 156 | |
| 157 WebVector<int> src_character_offsets; | |
| 158 src.characterOffsets(src_character_offsets); | |
| 159 std::vector<int32> character_offsets; | |
| 160 character_offsets.reserve(src_character_offsets.size()); | |
| 161 for (size_t i = 0; i < src_character_offsets.size(); ++i) | |
| 162 character_offsets.push_back(src_character_offsets[i]); | |
| 163 dst->AddIntListAttribute(dst->ATTR_CHARACTER_OFFSETS, character_offsets); | |
| 164 | |
| 165 WebVector<int> src_word_starts; | |
| 166 WebVector<int> src_word_ends; | |
| 167 src.wordBoundaries(src_word_starts, src_word_ends); | |
| 168 std::vector<int32> word_starts; | |
| 169 std::vector<int32> word_ends; | |
| 170 word_starts.reserve(src_word_starts.size()); | |
| 171 word_ends.reserve(src_word_starts.size()); | |
| 172 for (size_t i = 0; i < src_word_starts.size(); ++i) { | |
| 173 word_starts.push_back(src_word_starts[i]); | |
| 174 word_ends.push_back(src_word_ends[i]); | |
| 175 } | |
| 176 dst->AddIntListAttribute(dst->ATTR_WORD_STARTS, word_starts); | |
| 177 dst->AddIntListAttribute(dst->ATTR_WORD_ENDS, word_ends); | |
|
David Tseng
2013/10/17 22:56:29
It seems like a good idea to perhaps have a few du
dmazzoni
2013/10/21 17:26:57
Agreed about testing these.
I don't want to use d
| |
| 178 } | |
| 179 | |
| 154 if (src.accessKey().length()) | 180 if (src.accessKey().length()) |
| 155 dst->AddStringAttribute(dst->ATTR_ACCESS_KEY, UTF16ToUTF8(src.accessKey())); | 181 dst->AddStringAttribute(dst->ATTR_ACCESS_KEY, UTF16ToUTF8(src.accessKey())); |
| 156 if (src.actionVerb().length()) | 182 if (src.actionVerb().length()) |
| 157 dst->AddStringAttribute(dst->ATTR_ACTION, UTF16ToUTF8(src.actionVerb())); | 183 dst->AddStringAttribute(dst->ATTR_ACTION, UTF16ToUTF8(src.actionVerb())); |
| 158 if (src.isAriaReadOnly()) | 184 if (src.isAriaReadOnly()) |
| 159 dst->AddBoolAttribute(dst->ATTR_ARIA_READONLY, true); | 185 dst->AddBoolAttribute(dst->ATTR_ARIA_READONLY, true); |
| 160 if (src.isButtonStateMixed()) | 186 if (src.isButtonStateMixed()) |
| 161 dst->AddBoolAttribute(dst->ATTR_BUTTON_MIXED, true); | 187 dst->AddBoolAttribute(dst->ATTR_BUTTON_MIXED, true); |
| 162 if (src.canSetValueAttribute()) | 188 if (src.canSetValueAttribute()) |
| 163 dst->AddBoolAttribute(dst->ATTR_CAN_SET_VALUE, true); | 189 dst->AddBoolAttribute(dst->ATTR_CAN_SET_VALUE, true); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 WebNode node = parent.node(); | 488 WebNode node = parent.node(); |
| 463 if (!node.isNull() && node.isElementNode()) { | 489 if (!node.isNull() && node.isElementNode()) { |
| 464 WebElement element = node.to<WebElement>(); | 490 WebElement element = node.to<WebElement>(); |
| 465 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); | 491 is_iframe = (element.tagName() == ASCIIToUTF16("IFRAME")); |
| 466 } | 492 } |
| 467 | 493 |
| 468 return (is_iframe || IsParentUnignoredOf(parent, child)); | 494 return (is_iframe || IsParentUnignoredOf(parent, child)); |
| 469 } | 495 } |
| 470 | 496 |
| 471 } // namespace content | 497 } // namespace content |
| OLD | NEW |