Chromium Code Reviews| Index: content/browser/accessibility/ax_platform_position.h |
| diff --git a/content/browser/accessibility/ax_platform_position.h b/content/browser/accessibility/ax_platform_position.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bfe95bfe8b84462a5adbb35287e4e721561495b1 |
| --- /dev/null |
| +++ b/content/browser/accessibility/ax_platform_position.h |
| @@ -0,0 +1,45 @@ |
| +// 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. |
| + |
| +#ifndef CONTENT_BROWSER_ACCESSIBILITY_AX_PLATFORM_POSITION_H_ |
| +#define CONTENT_BROWSER_ACCESSIBILITY_AX_PLATFORM_POSITION_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include "content/browser/accessibility/ax_tree_id_registry.h" |
| +#include "content/browser/accessibility/browser_accessibility.h" |
| +#include "ui/accessibility/ax_position.h" |
| + |
| +namespace content { |
| + |
| +using AXTreeID = content::AXTreeIDRegistry::AXTreeID; |
| + |
| +class AXPlatformPosition : public ui::AXPosition<BrowserAccessibility> { |
| + public: |
| + ~AXPlatformPosition() override; |
| + |
| + protected: |
| + AXPlatformPosition(AXTreeID tree_id, |
| + int32_t anchor_id, |
| + int child_index, |
| + int text_offset, |
|
David Tseng
2016/10/07 21:02:41
Can you think of a way to combine text_offset and
|
| + ui::AXPositionType type); |
| + |
| + int AnchorChildCount() const override { |
|
David Tseng
2016/10/07 21:02:41
AXPosition<BrowserAccessibility> overrides
|
| + return GetAnchor() ? static_cast<int>(GetAnchor()->PlatformChildCount()) |
|
David Tseng
2016/10/07 21:02:41
This isn't a simple getter; put in .cc
|
| + : -1; |
|
David Tseng
2016/10/07 21:02:41
Name this special constant
|
| + } |
| + AXPosition* GetChildPositionAt(int child_index) const override; |
| + AXPosition* GetParentPosition() const override; |
| + int AnchorIndexInParent() const override { |
| + return GetAnchor() ? static_cast<int>(GetAnchor()->GetIndexInParent()) : -1; |
| + } |
| + BrowserAccessibility* GetNodeInTree(AXTreeID tree_id, |
| + int32_t node_id) const override; |
| + int MaxTextOffset() const override; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_ACCESSIBILITY_AX_PLATFORM_POSITION_H_ |