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

Unified Diff: content/renderer/accessibility/blink_ax_tree_source.cc

Issue 1195223006: Reports the position of the caret and current selection in content editables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased with master. Created 5 years, 5 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/renderer/accessibility/blink_ax_tree_source.cc
diff --git a/content/renderer/accessibility/blink_ax_tree_source.cc b/content/renderer/accessibility/blink_ax_tree_source.cc
index e72cd6e91faeca13d158ee5c992f0b9167b9fc9e..2ef46bf58cdf87b8d27460d17d02c9e9dc69aaa9 100644
--- a/content/renderer/accessibility/blink_ax_tree_source.cc
+++ b/content/renderer/accessibility/blink_ax_tree_source.cc
@@ -513,6 +513,18 @@ void BlinkAXTreeSource::SerializeNode(blink::WebAXObject src,
UTF16ToUTF8(base::StringPiece16(doctype.name())));
}
+ WebAXObject anchor_object, focus_object;
+ int anchor_offset, focus_offset;
+ src.selection(anchor_object, anchor_offset, focus_object, focus_offset);
+ if (!anchor_object.isNull() && !focus_object.isNull() &&
+ anchor_offset >= 0 && focus_offset >= 0) {
+ int32 anchor_id = anchor_object.axID();
+ int32 focus_id = focus_object.axID();
+ dst->AddIntAttribute(ui::AX_ATTR_ANCHOR_OBJECT_ID, anchor_id);
+ dst->AddIntAttribute(ui::AX_ATTR_ANCHOR_OFFSET, anchor_offset);
+ dst->AddIntAttribute(ui::AX_ATTR_FOCUS_OBJECT_ID, focus_id);
+ dst->AddIntAttribute(ui::AX_ATTR_FOCUS_OFFSET, focus_offset);
+ }
}
if (dst->role == ui::AX_ROLE_TABLE) {

Powered by Google App Engine
This is Rietveld 408576698