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

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, 4 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 6f24a81eac32067f86cd91b4fc13107d9a41a103..ee00519645cdd037eff498e799e0127916fd3b65 100644
--- a/content/renderer/accessibility/blink_ax_tree_source.cc
+++ b/content/renderer/accessibility/blink_ax_tree_source.cc
@@ -503,6 +503,19 @@ 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);
+ }
+
// Get the tree ID for this frame and possibly the parent frame.
WebLocalFrame* web_frame = document.frame();
if (web_frame) {

Powered by Google App Engine
This is Rietveld 408576698