| 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..51459b69bb89775d9798a2184ed3ca0c43c883cd
|
| --- /dev/null
|
| +++ b/content/browser/accessibility/ax_platform_position.cc
|
| @@ -0,0 +1,41 @@
|
| +// 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"
|
| +
|
| +#include "content/browser/accessibility/browser_accessibility_manager.h"
|
| +
|
| +namespace content {
|
| +
|
| +AXPlatformPosition::AXPlatformPosition(AXTreeID tree_id,
|
| + int32_t anchor_id,
|
| + int child_index,
|
| + int text_offset,
|
| + ui::AXPositionType type)
|
| + : AXPosition(tree_id, anchor_id, child_index, text_offset, type) {}
|
| +
|
| +AXPlatformPosition::~AXPlatformPosition() {}
|
| +
|
| +BrowserAccessibility* AXPlatformPosition::GetNodeInTree(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(node_id);
|
| +}
|
| +
|
| +int AXPlatformPosition::MaxTextOffset() const {
|
| + if (IsNullPosition())
|
| + return -1;
|
| +
|
| + BrowserAccessibility* anchor = GetNodeInTree(get_tree_id(), get_anchor_id());
|
| + if (!anchor)
|
| + return -1;
|
| + return static_cast<int>(anchor->GetText().length());
|
| +}
|
| +
|
| +} // namespace content
|
|
|