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

Unified Diff: content/browser/accessibility/browser_accessibility.cc

Issue 1941463002: Removes the restriction placed on the role of the accessibility object when calling the next/previo… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment and discovered that images don't work. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/accessibility/blink_ax_tree_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/accessibility/browser_accessibility.cc
diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc
index e77833cf60232bd30b93cc46828ab943579808dc..57cccab906decfc867bc1e9eba68f8386080d964 100644
--- a/content/browser/accessibility/browser_accessibility.cc
+++ b/content/browser/accessibility/browser_accessibility.cc
@@ -191,22 +191,19 @@ bool BrowserAccessibility::IsPreviousSiblingOnSameLine() const {
if (!previous_sibling)
return false;
- const BrowserAccessibility* text_object = this;
- while (!text_object->IsTextOnlyObject()) {
- // If we don't find a text object, then sibling cannot be on the same line.
- if (!text_object->InternalChildCount())
- return false;
- text_object = text_object->InternalGetChild(0);
- }
+ // Line linkage information might not be provided on non-leaf objects.
+ const BrowserAccessibility* leaf_object = PlatformDeepestFirstChild();
+ if (!leaf_object)
+ leaf_object = this;
int32_t previous_on_line_id;
- if (text_object->GetIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID,
+ if (leaf_object->GetIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID,
&previous_on_line_id)) {
const BrowserAccessibility* previous_on_line =
manager()->GetFromID(previous_on_line_id);
- // In the case of static text objects, the object designated to be the
- // previous object on this line might be a child of the previous sibling,
- // i.e. the last inline text box of the previous static text object.
+ // In the case of a static text sibling, the object designated to be the
+ // previous object on this line might be one of its children, i.e. the last
+ // inline text box.
return previous_on_line &&
previous_on_line->IsDescendantOf(previous_sibling);
}
@@ -218,22 +215,19 @@ bool BrowserAccessibility::IsNextSiblingOnSameLine() const {
if (!next_sibling)
return false;
- const BrowserAccessibility* text_object = this;
- while (!text_object->IsTextOnlyObject()) {
- // If we don't find a text object, then sibling cannot be on the same line.
- if (!text_object->InternalChildCount())
- return false;
- text_object = text_object->InternalGetChild(0);
- }
+ // Line linkage information might not be provided on non-leaf objects.
+ const BrowserAccessibility* leaf_object = PlatformDeepestLastChild();
+ if (!leaf_object)
+ leaf_object = this;
int32_t next_on_line_id;
- if (text_object->GetIntAttribute(ui::AX_ATTR_NEXT_ON_LINE_ID,
+ if (leaf_object->GetIntAttribute(ui::AX_ATTR_NEXT_ON_LINE_ID,
&next_on_line_id)) {
const BrowserAccessibility* next_on_line =
manager()->GetFromID(next_on_line_id);
- // In the case of static text objects, the object designated to be the next
- // object on this line might be a child of the next sibling, i.e. the first
- // inline text box of the next static text object.
+ // In the case of a static text sibling, the object designated to be the
+ // next object on this line might be one of its children, i.e. the last
+ // inline text box.
return next_on_line && next_on_line->IsDescendantOf(next_sibling);
}
return false;
« no previous file with comments | « no previous file | content/renderer/accessibility/blink_ax_tree_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698