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 // Objects in the shadow DOM are not visible to platform APIs and thus should | |
dmazzoni
2017/04/10 22:39:49
Shadow DOM isn't necessarily the correct term here
| |
113 // be excluded. | |
114 if (GetAnchor()->PlatformIsChildOfLeaf()) | |
115 return MaxTextOffset(); | |
112 return 1; | 116 return 1; |
113 #else | 117 #else |
114 return MaxTextOffset(); | 118 return MaxTextOffset(); |
115 #endif | 119 #endif |
116 } | 120 } |
117 | 121 |
118 bool AXPlatformPosition::IsInLineBreak() const { | 122 bool AXPlatformPosition::IsInLineBreak() const { |
119 if (IsNullPosition()) | 123 if (IsNullPosition()) |
120 return false; | 124 return false; |
121 | 125 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 int previous_on_line_id; | 160 int previous_on_line_id; |
157 if (!node || | 161 if (!node || |
158 !node->GetIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID, | 162 !node->GetIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID, |
159 &previous_on_line_id)) { | 163 &previous_on_line_id)) { |
160 return INVALID_ANCHOR_ID; | 164 return INVALID_ANCHOR_ID; |
161 } | 165 } |
162 return static_cast<int32_t>(previous_on_line_id); | 166 return static_cast<int32_t>(previous_on_line_id); |
163 } | 167 } |
164 | 168 |
165 } // namespace content | 169 } // namespace content |
OLD | NEW |