Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: content/browser/accessibility/ax_platform_position.cc

Issue 2745713002: WIP: Modified AXPosition to work with objects with both embedded object characters and text. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/accessibility/ax_platform_position.h ('k') | ui/accessibility/ax_node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/accessibility/ax_platform_position.h ('k') | ui/accessibility/ax_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698