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/browser/accessibility/browser_accessibility.h" | 5 #include "content/browser/accessibility/browser_accessibility.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "content/browser/accessibility/browser_accessibility_manager.h" | 15 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 16 #include "content/common/accessibility_messages.h" | 16 #include "content/common/accessibility_messages.h" |
| 17 #include "ui/accessibility/ax_text_utils.h" | 17 #include "ui/accessibility/ax_text_utils.h" |
| 18 #include "ui/accessibility/ax_view_state.h" | |
| 18 #include "ui/accessibility/platform/ax_platform_node.h" | 19 #include "ui/accessibility/platform/ax_platform_node.h" |
| 19 #include "ui/gfx/geometry/rect_f.h" | 20 #include "ui/gfx/geometry/rect_f.h" |
| 20 | 21 |
| 21 namespace content { | 22 namespace content { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // Map from unique_id to BrowserAccessibility | 26 // Map from unique_id to BrowserAccessibility |
| 26 using UniqueIDMap = base::hash_map<int32_t, BrowserAccessibility*>; | 27 using UniqueIDMap = base::hash_map<int32_t, BrowserAccessibility*>; |
| 27 base::LazyInstance<UniqueIDMap> g_unique_id_map = LAZY_INSTANCE_INITIALIZER; | 28 base::LazyInstance<UniqueIDMap> g_unique_id_map = LAZY_INSTANCE_INITIALIZER; |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 945 *is_mixed = true; | 946 *is_mixed = true; |
| 946 | 947 |
| 947 return false; // Not set. | 948 return false; // Not set. |
| 948 } | 949 } |
| 949 | 950 |
| 950 base::string16 BrowserAccessibility::GetText() const { | 951 base::string16 BrowserAccessibility::GetText() const { |
| 951 return GetInnerText(); | 952 return GetInnerText(); |
| 952 } | 953 } |
| 953 | 954 |
| 954 bool BrowserAccessibility::HasState(ui::AXState state_enum) const { | 955 bool BrowserAccessibility::HasState(ui::AXState state_enum) const { |
| 955 return (GetState() >> state_enum) & 1; | 956 return ui::AXViewState::IsFlagSet(GetState(), state_enum); |
|
tapted
2016/06/17 03:32:49
Let's move the browser_accessibility* changes to a
Patti Lor
2016/06/17 05:57:35
Done.
| |
| 956 } | 957 } |
| 957 | 958 |
| 958 bool BrowserAccessibility::IsCellOrTableHeaderRole() const { | 959 bool BrowserAccessibility::IsCellOrTableHeaderRole() const { |
| 959 return (GetRole() == ui::AX_ROLE_CELL || | 960 return (GetRole() == ui::AX_ROLE_CELL || |
| 960 GetRole() == ui::AX_ROLE_COLUMN_HEADER || | 961 GetRole() == ui::AX_ROLE_COLUMN_HEADER || |
| 961 GetRole() == ui::AX_ROLE_ROW_HEADER); | 962 GetRole() == ui::AX_ROLE_ROW_HEADER); |
| 962 } | 963 } |
| 963 | 964 |
| 964 bool BrowserAccessibility::HasCaret() const { | 965 bool BrowserAccessibility::HasCaret() const { |
| 965 if (IsSimpleTextControl() && HasIntAttribute(ui::AX_ATTR_TEXT_SEL_START) && | 966 if (IsSimpleTextControl() && HasIntAttribute(ui::AX_ATTR_TEXT_SEL_START) && |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1186 break; | 1187 break; |
| 1187 | 1188 |
| 1188 manager = root->GetParent()->manager(); | 1189 manager = root->GetParent()->manager(); |
| 1189 root = manager->GetRoot(); | 1190 root = manager->GetRoot(); |
| 1190 } | 1191 } |
| 1191 | 1192 |
| 1192 return bounds; | 1193 return bounds; |
| 1193 } | 1194 } |
| 1194 | 1195 |
| 1195 } // namespace content | 1196 } // namespace content |
| OLD | NEW |