| Index: ui/accessibility/ax_node.cc
|
| diff --git a/ui/accessibility/ax_node.cc b/ui/accessibility/ax_node.cc
|
| index 459095eef929ad0b4aa66e1e92efda852674b993..c55bf97fa92a48784c74d52520f18744d2d702ac 100644
|
| --- a/ui/accessibility/ax_node.cc
|
| +++ b/ui/accessibility/ax_node.cc
|
| @@ -60,27 +60,34 @@ 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;
|
| }
|
|
|
| + // Don't report if the first piece of text starts a new line or not.
|
| + if (*start_offset &&
|
| + !child->data().HasIntAttribute(ui::AX_ATTR_PREVIOUS_ON_LINE_ID)) {
|
| + // If there are multiple objects with an empty accessible label at the
|
| + // start of a line, only include a single line start offset.
|
| + if (line_offsets->empty() || line_offsets->back() != *start_offset)
|
| + 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());
|
| }
|
| }
|
|
|
|
|