Chromium Code Reviews| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 return nullptr; | 92 return nullptr; |
| 93 return manager->GetFromID(node_id); | 93 return manager->GetFromID(node_id); |
| 94 } | 94 } |
| 95 | 95 |
| 96 int AXPlatformPosition::MaxTextOffset() const { | 96 int AXPlatformPosition::MaxTextOffset() const { |
| 97 if (IsNullPosition()) | 97 if (IsNullPosition()) |
| 98 return INVALID_OFFSET; | 98 return INVALID_OFFSET; |
| 99 return static_cast<int>(GetInnerText().length()); | 99 return static_cast<int>(GetInnerText().length()); |
| 100 } | 100 } |
| 101 | 101 |
| 102 #if defined(OS_WIN) || \ | |
|
dmazzoni
2017/03/10 19:32:25
Nit: put the #if inside the function, not outside
| |
| 103 (defined(OS_LINUX) && defined(USE_X11) && !defined(OS_CHROMEOS)) | |
| 104 int AXPlatformPosition::MaxTextOffsetInParent() const { | |
| 105 if (IsNullPosition()) | |
| 106 return INVALID_OFFSET; | |
| 107 if (GetAnchor()->IsTextOnlyObject()) | |
| 108 return MaxTextOffset(); | |
| 109 return 1; | |
| 110 } | |
| 111 #else | |
| 112 int AXPlatformPosition::MaxTextOffsetInParent() const { | |
| 113 return MaxTextOffset(); | |
| 114 } | |
| 115 #endif | |
| 116 | |
| 102 bool AXPlatformPosition::IsInLineBreak() const { | 117 bool AXPlatformPosition::IsInLineBreak() const { |
| 103 if (IsNullPosition()) | 118 if (IsNullPosition()) |
| 104 return false; | 119 return false; |
| 105 | 120 |
| 106 DCHECK(GetAnchor()); | 121 DCHECK(GetAnchor()); |
| 107 return GetAnchor()->IsLineBreakObject(); | 122 return GetAnchor()->IsLineBreakObject(); |
| 108 } | 123 } |
| 109 | 124 |
| 110 std::vector<int32_t> AXPlatformPosition::GetWordStartOffsets() const { | 125 std::vector<int32_t> AXPlatformPosition::GetWordStartOffsets() const { |
| 111 if (IsNullPosition()) | 126 if (IsNullPosition()) |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 140 int previous_on_line_id; | 155 int previous_on_line_id; |
| 141 if (!node || | 156 if (!node || |
| 142 !node->GetIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID, | 157 !node->GetIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID, |
| 143 &previous_on_line_id)) { | 158 &previous_on_line_id)) { |
| 144 return INVALID_ANCHOR_ID; | 159 return INVALID_ANCHOR_ID; |
| 145 } | 160 } |
| 146 return static_cast<int32_t>(previous_on_line_id); | 161 return static_cast<int32_t>(previous_on_line_id); |
| 147 } | 162 } |
| 148 | 163 |
| 149 } // namespace content | 164 } // namespace content |
| OLD | NEW |