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

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

Issue 2301833005: Get rid of AX_LINE_BREAKS attribute to improve performance. (Closed)
Patch Set: Re-worded comment. Created 4 years, 3 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
Index: content/browser/accessibility/browser_accessibility.cc
diff --git a/content/browser/accessibility/browser_accessibility.cc b/content/browser/accessibility/browser_accessibility.cc
index 0797a36a0fc0c8af0e8faa15f4e5189615321aa3..26e5b487c702235980102a9fe6f4e253e2b8f7b4 100644
--- a/content/browser/accessibility/browser_accessibility.cc
+++ b/content/browser/accessibility/browser_accessibility.cc
@@ -229,7 +229,7 @@ bool BrowserAccessibility::IsNextSiblingOnSameLine() const {
const BrowserAccessibility* next_on_line =
manager()->GetFromID(next_on_line_id);
// 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
+ // next object on this line might be one of its children, i.e. the first
// inline text box.
return next_on_line && next_on_line->IsDescendantOf(next_sibling);
}
@@ -533,9 +533,7 @@ int BrowserAccessibility::GetLineStartBoundary(
DCHECK_LE(start, static_cast<int>(GetText().length()));
if (IsSimpleTextControl()) {
- const std::vector<int32_t>& line_breaks =
- GetIntListAttribute(ui::AX_ATTR_LINE_BREAKS);
- return ui::FindAccessibleTextBoundary(GetText(), line_breaks,
+ return ui::FindAccessibleTextBoundary(GetText(), GetLineStartOffsets(),
ui::LINE_BOUNDARY, start, direction,
affinity);
}
@@ -1142,6 +1140,12 @@ std::string BrowserAccessibility::ComputeAccessibleNameFromDescendants() {
return name;
}
+std::vector<int> BrowserAccessibility::GetLineStartOffsets() const {
+ if (!instance_active())
+ return std::vector<int>();
+ return node()->GetOrComputeLineStartOffsets();
+}
+
base::string16 BrowserAccessibility::GetInnerText() const {
if (IsTextOnlyObject())
return GetString16Attribute(ui::AX_ATTR_NAME);

Powered by Google App Engine
This is Rietveld 408576698