| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ax_platform_position.h" | 5 #include "content/browser/accessibility/ax_platform_position.h" |
| 6 | 6 |
| 7 #include "content/browser/accessibility/browser_accessibility_manager.h" | 7 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 8 #include "ui/accessibility/ax_enums.h" | 8 #include "ui/accessibility/ax_enums.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 *parent_id = parent->GetId(); | 79 *parent_id = parent->GetId(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 BrowserAccessibility* AXPlatformPosition::GetNodeInTree(AXTreeID tree_id, | 82 BrowserAccessibility* AXPlatformPosition::GetNodeInTree(AXTreeID tree_id, |
| 83 int32_t node_id) const { | 83 int32_t node_id) const { |
| 84 if (tree_id == AXPosition::INVALID_TREE_ID || | 84 if (tree_id == AXPosition::INVALID_TREE_ID || |
| 85 node_id == AXPosition::INVALID_ANCHOR_ID) { | 85 node_id == AXPosition::INVALID_ANCHOR_ID) { |
| 86 return nullptr; | 86 return nullptr; |
| 87 } | 87 } |
| 88 | 88 |
| 89 auto manager = BrowserAccessibilityManager::FromID(tree_id); | 89 auto* manager = BrowserAccessibilityManager::FromID(tree_id); |
| 90 if (!manager) | 90 if (!manager) |
| 91 return nullptr; | 91 return nullptr; |
| 92 return manager->GetFromID(node_id); | 92 return manager->GetFromID(node_id); |
| 93 } | 93 } |
| 94 | 94 |
| 95 int AXPlatformPosition::MaxTextOffset() const { | 95 int AXPlatformPosition::MaxTextOffset() const { |
| 96 if (IsNullPosition()) | 96 if (IsNullPosition()) |
| 97 return INVALID_OFFSET; | 97 return INVALID_OFFSET; |
| 98 return static_cast<int>(GetInnerText().length()); | 98 return static_cast<int>(GetInnerText().length()); |
| 99 } | 99 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 int previous_on_line_id; | 139 int previous_on_line_id; |
| 140 if (!node || | 140 if (!node || |
| 141 !node->GetIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID, | 141 !node->GetIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID, |
| 142 &previous_on_line_id)) { | 142 &previous_on_line_id)) { |
| 143 return INVALID_ANCHOR_ID; | 143 return INVALID_ANCHOR_ID; |
| 144 } | 144 } |
| 145 return static_cast<int32_t>(previous_on_line_id); | 145 return static_cast<int32_t>(previous_on_line_id); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace content | 148 } // namespace content |
| OLD | NEW |