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

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

Issue 1365433002: Add setSelection function to automation API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nobrailleautostartintests
Patch Set: Change setDocumentSelection to take named arguments. Created 5 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 | « content/renderer/accessibility/renderer_accessibility.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/accessibility/renderer_accessibility.cc
diff --git a/content/renderer/accessibility/renderer_accessibility.cc b/content/renderer/accessibility/renderer_accessibility.cc
index 7452337f341aed11d7f8c65aae60272294940962..84b8a10823722a0b79d02039d660ffc2bf52b7ab 100644
--- a/content/renderer/accessibility/renderer_accessibility.cc
+++ b/content/renderer/accessibility/renderer_accessibility.cc
@@ -102,7 +102,7 @@ bool RendererAccessibility::OnMessageReceived(const IPC::Message& message) {
OnScrollToMakeVisible)
IPC_MESSAGE_HANDLER(AccessibilityMsg_ScrollToPoint, OnScrollToPoint)
IPC_MESSAGE_HANDLER(AccessibilityMsg_SetScrollOffset, OnSetScrollOffset)
- IPC_MESSAGE_HANDLER(AccessibilityMsg_SetTextSelection, OnSetTextSelection)
+ IPC_MESSAGE_HANDLER(AccessibilityMsg_SetSelection, OnSetSelection)
IPC_MESSAGE_HANDLER(AccessibilityMsg_SetValue, OnSetValue)
IPC_MESSAGE_HANDLER(AccessibilityMsg_ShowContextMenu, OnShowContextMenu)
IPC_MESSAGE_HANDLER(AccessibilityMsg_HitTest, OnHitTest)
@@ -502,21 +502,34 @@ void RendererAccessibility::OnSetFocus(int acc_obj_id) {
obj.setFocused(true);
}
-void RendererAccessibility::OnSetTextSelection(
- int acc_obj_id, int start_offset, int end_offset) {
+void RendererAccessibility::OnSetSelection(int anchor_acc_obj_id,
+ int anchor_offset,
+ int focus_acc_obj_id,
+ int focus_offset) {
const WebDocument& document = GetMainDocument();
if (document.isNull())
return;
- WebAXObject obj = document.accessibilityObjectFromID(acc_obj_id);
- if (obj.isDetached()) {
+ WebAXObject anchor_obj =
+ document.accessibilityObjectFromID(anchor_acc_obj_id);
+ if (anchor_obj.isDetached()) {
#ifndef NDEBUG
- LOG(WARNING) << "SetTextSelection on invalid object id " << acc_obj_id;
+ LOG(WARNING) << "SetTextSelection on invalid object id "
+ << anchor_acc_obj_id;
+#endif
+ return;
+ }
+
+ WebAXObject focus_obj = document.accessibilityObjectFromID(focus_acc_obj_id);
+ if (focus_obj.isDetached()) {
+#ifndef NDEBUG
+ LOG(WARNING) << "SetTextSelection on invalid object id "
+ << focus_acc_obj_id;
#endif
return;
}
- obj.setSelectedTextRange(start_offset, end_offset);
+ anchor_obj.setSelection(anchor_obj, anchor_offset, focus_obj, focus_offset);
WebAXObject root = document.accessibilityObject();
if (root.isDetached()) {
#ifndef NDEBUG
« no previous file with comments | « content/renderer/accessibility/renderer_accessibility.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698