Commit 175ae973 authored by Nektarios Paisios's avatar Nektarios Paisios Committed by Commit Bot

Uses the same definition of an embedded object in both implementations of AXPosition

This is the first step in the process of merging BrowserAccessibilityPosition and AXNodePosition into one class.
We need to adopt the same definition of an embedded object in both places.
This is the definition used by IA2 and ATK hypertext, which makes all non-textual nodes that are exposed to the platform APIs
into embedded objects.
Additionally, we include the definition used by UIA, which makes all empty leaf objects (objects with ignored descendants)
as embedded objects.

AX-Relnotes: n/a.

R=dmazzoni@chromium.org, aleventhal@chromium.org

Change-Id: I19bbc26f40d37a07b7dd6436fb0025505a0cfd89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2346653Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796893}
parent 25a182e0
...@@ -261,6 +261,19 @@ int AXNodePosition::MaxTextOffset() const { ...@@ -261,6 +261,19 @@ int AXNodePosition::MaxTextOffset() const {
return text_length; return text_length;
} }
bool AXNodePosition::IsEmbeddedObjectInParent() const {
switch (g_ax_embedded_object_behavior) {
case AXEmbeddedObjectBehavior::kSuppressCharacter:
return false;
case AXEmbeddedObjectBehavior::kExposeCharacter:
// We don't need to expose an "embedded object character" for textual
// nodes and nodes that are invisible to platform APIs. Textual nodes are
// represented by their actual text.
return !IsNullPosition() && !GetAnchor()->IsText() &&
GetAnchor()->IsChildOfLeaf();
}
}
bool AXNodePosition::IsInLineBreakingObject() const { bool AXNodePosition::IsInLineBreakingObject() const {
if (IsNullPosition()) if (IsNullPosition())
return false; return false;
......
...@@ -56,6 +56,7 @@ class AX_EXPORT AXNodePosition : public AXPosition<AXNodePosition, AXNode> { ...@@ -56,6 +56,7 @@ class AX_EXPORT AXNodePosition : public AXPosition<AXNodePosition, AXNode> {
AXNode::AXID GetAnchorID(AXNode* node) const override; AXNode::AXID GetAnchorID(AXNode* node) const override;
AXTreeID GetTreeID(AXNode* node) const override; AXTreeID GetTreeID(AXNode* node) const override;
bool IsEmbeddedObjectInParent() const override;
bool IsInLineBreakingObject() const override; bool IsInLineBreakingObject() const override;
ax::mojom::Role GetRole() const override; ax::mojom::Role GetRole() const override;
AXNodeTextStyles GetTextStyles() const override; AXNodeTextStyles GetTextStyles() const override;
......
...@@ -3360,7 +3360,7 @@ class AXPosition { ...@@ -3360,7 +3360,7 @@ class AXPosition {
// Returns whether or not this anchor is represented in their parent with a // Returns whether or not this anchor is represented in their parent with a
// single embedded object character. // single embedded object character.
virtual bool IsEmbeddedObjectInParent() const { return false; } virtual bool IsEmbeddedObjectInParent() const = 0;
// Determines if the anchor containing this position produces a hard line // Determines if the anchor containing this position produces a hard line
// break in the text representation, e.g. a block level element or a <br>. // break in the text representation, e.g. a block level element or a <br>.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment