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

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

Issue 2271893002: Creates AXPosition to uniquely identify a position in the accessibility tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-wrote implementation to include tree_id and platform specific AXPosition. Created 4 years, 2 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/accessibility/ax_platform_position.h"
6
7 namespace content {
8
9 AXPlatformPosition::AXPlatformPosition(AXTreeIDRegistry::AXTreeID tree_id, int32 _t anchor_id, int child_index, int text_offset, AXPositionType type) : AXPositio n(tree_id, anchor_id, offset, type) {
10 }
11
12 AXPlatformPosition::~AXPlatformPosition() {
13 }
14
15 BrowserAccessibility* AXPlatformPosition::GetPlatformNodeInTree(AXTreeIDRegistry ::AXTreeID tree_id, int32-t node_id) const {
16 if (IsNullPosition())
17 return nullptr;
18
19 auto manager = BrowserAccessibilityManager::FromID(tree_id_);
20 if (!manager)
21 return nullptr;
22 return manager->GetFromID(id);
23 }
24
25 AXNode* AXPlatformPosition::GetNodeInTree(AXTreeIDRegistry::AXTreeID tree_id, in t32-t node_id) const {
26 BrowserAccessibility* anchor = GetPlatformNodeFromID(tree_id, node_id);
27 return anchor ? anchor->node() : nullptr;
28 }
29
30 int AXPlatformPosition::MaxTextOffset() const {
31 if (IsNullPosition())
32 return -1;
33
34 BrowserAccessibility* anchor = GetPlatformNodeInTree(tree_id_, get_anchor_id() );
35 if (!anchor)
36 return -1;
37 return static_cast<int>(anchor->GetText().length());
38 }
39
40 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698