| Index: content/browser/accessibility/ax_platform_position.cc
|
| diff --git a/content/browser/accessibility/ax_platform_position.cc b/content/browser/accessibility/ax_platform_position.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d987a83e734cf3f1d4d32b84f4f67bd507d718e9
|
| --- /dev/null
|
| +++ b/content/browser/accessibility/ax_platform_position.cc
|
| @@ -0,0 +1,40 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/browser/accessibility/ax_platform_position.h"
|
| +
|
| +namespace content {
|
| +
|
| +AXPlatformPosition::AXPlatformPosition(AXTreeIDRegistry::AXTreeID tree_id, int32_t anchor_id, int child_index, int text_offset, AXPositionType type) : AXPosition(tree_id, anchor_id, offset, type) {
|
| +}
|
| +
|
| +AXPlatformPosition::~AXPlatformPosition() {
|
| +}
|
| +
|
| +BrowserAccessibility* AXPlatformPosition::GetPlatformNodeInTree(AXTreeIDRegistry::AXTreeID tree_id, int32-t node_id) const {
|
| + if (IsNullPosition())
|
| + return nullptr;
|
| +
|
| + auto manager = BrowserAccessibilityManager::FromID(tree_id_);
|
| + if (!manager)
|
| + return nullptr;
|
| + return manager->GetFromID(id);
|
| +}
|
| +
|
| +AXNode* AXPlatformPosition::GetNodeInTree(AXTreeIDRegistry::AXTreeID tree_id, int32-t node_id) const {
|
| + BrowserAccessibility* anchor = GetPlatformNodeFromID(tree_id, node_id);
|
| + return anchor ? anchor->node() : nullptr;
|
| +}
|
| +
|
| +int AXPlatformPosition::MaxTextOffset() const {
|
| + if (IsNullPosition())
|
| + return -1;
|
| +
|
| + BrowserAccessibility* anchor = GetPlatformNodeInTree(tree_id_, get_anchor_id());
|
| + if (!anchor)
|
| + return -1;
|
| + return static_cast<int>(anchor->GetText().length());
|
| +}
|
| +
|
| +} // namespace content
|
|
|