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

Unified Diff: ui/accessibility/ax_node.cc

Issue 2437473003: Fixed line start offsets. (Closed)
Patch Set: Created 4 years, 2 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 | « ui/accessibility/ax_node.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/ax_node.cc
diff --git a/ui/accessibility/ax_node.cc b/ui/accessibility/ax_node.cc
index 459095eef929ad0b4aa66e1e92efda852674b993..36f47269ab4980b1b908f395b5e6a42ad60a1db9 100644
--- a/ui/accessibility/ax_node.cc
+++ b/ui/accessibility/ax_node.cc
@@ -60,27 +60,27 @@ std::vector<int> AXNode::GetOrComputeLineStartOffsets() {
if (data().GetIntListAttribute(AX_ATTR_CACHED_LINE_STARTS, &line_offsets))
return line_offsets;
- int end_offset = 0;
- ComputeLineStartOffsets(&line_offsets, &end_offset);
+ int start_offset = 0;
+ ComputeLineStartOffsets(&line_offsets, &start_offset);
data_.AddIntListAttribute(AX_ATTR_CACHED_LINE_STARTS, line_offsets);
return line_offsets;
}
void AXNode::ComputeLineStartOffsets(std::vector<int>* line_offsets,
- int* end_offset) const {
+ int* start_offset) const {
DCHECK(line_offsets);
- DCHECK(end_offset);
+ DCHECK(start_offset);
for (const AXNode* child : children()) {
DCHECK(child);
if (child->child_count()) {
- child->ComputeLineStartOffsets(line_offsets, end_offset);
+ child->ComputeLineStartOffsets(line_offsets, start_offset);
continue;
}
+ if (!child->data().HasIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID))
David Tseng 2016/10/19 17:39:42 This is still wrong... - this would include 0; th
+ line_offsets->push_back(*start_offset);
base::string16 text = child->data().GetString16Attribute(ui::AX_ATTR_NAME);
- *end_offset += static_cast<int>(text.length());
- if (!child->data().HasIntAttribute(ui::AX_ATTR_NEXT_ON_LINE_ID))
- line_offsets->push_back(*end_offset);
+ *start_offset += static_cast<int>(text.length());
}
}
« no previous file with comments | « ui/accessibility/ax_node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698