| 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.h" | 7 #include "content/browser/accessibility/browser_accessibility.h" |
| 8 #include "content/browser/accessibility/browser_accessibility_manager.h" | 8 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 9 #include "ui/accessibility/ax_enums.h" | 9 #include "ui/accessibility/ax_enums.h" |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // On some platforms, most objects are represented in the text of their parents | 102 // On some platforms, most objects are represented in the text of their parents |
| 103 // with a special (embedded object) character and not with their actual text | 103 // with a special (embedded object) character and not with their actual text |
| 104 // contents. | 104 // contents. |
| 105 int AXPlatformPosition::MaxTextOffsetInParent() const { | 105 int AXPlatformPosition::MaxTextOffsetInParent() const { |
| 106 #if defined(OS_WIN) || \ | 106 #if defined(OS_WIN) || \ |
| 107 (defined(OS_LINUX) && defined(USE_X11) && !defined(OS_CHROMEOS)) | 107 (defined(OS_LINUX) && defined(USE_X11) && !defined(OS_CHROMEOS)) |
| 108 if (IsNullPosition()) | 108 if (IsNullPosition()) |
| 109 return INVALID_OFFSET; | 109 return INVALID_OFFSET; |
| 110 if (GetAnchor()->IsTextOnlyObject()) | 110 if (GetAnchor()->IsTextOnlyObject()) |
| 111 return MaxTextOffset(); | 111 return MaxTextOffset(); |
| 112 // Not all objects in the internal accessibility tree are exposed to platform | |
| 113 // APIs. | |
| 114 if (GetAnchor()->PlatformIsChildOfLeaf()) | |
| 115 return MaxTextOffset(); | |
| 116 return 1; | 112 return 1; |
| 117 #else | 113 #else |
| 118 return MaxTextOffset(); | 114 return MaxTextOffset(); |
| 119 #endif | 115 #endif |
| 120 } | 116 } |
| 121 | 117 |
| 122 bool AXPlatformPosition::IsInLineBreak() const { | 118 bool AXPlatformPosition::IsInLineBreak() const { |
| 123 if (IsNullPosition()) | 119 if (IsNullPosition()) |
| 124 return false; | 120 return false; |
| 125 | 121 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 int previous_on_line_id; | 156 int previous_on_line_id; |
| 161 if (!node || | 157 if (!node || |
| 162 !node->GetIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID, | 158 !node->GetIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID, |
| 163 &previous_on_line_id)) { | 159 &previous_on_line_id)) { |
| 164 return INVALID_ANCHOR_ID; | 160 return INVALID_ANCHOR_ID; |
| 165 } | 161 } |
| 166 return static_cast<int32_t>(previous_on_line_id); | 162 return static_cast<int32_t>(previous_on_line_id); |
| 167 } | 163 } |
| 168 | 164 |
| 169 } // namespace content | 165 } // namespace content |
| OLD | NEW |