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

Unified Diff: components/test_runner/web_ax_object_proxy.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
« no previous file with comments | « components/test_runner/web_ax_object_proxy.h ('k') | content/browser/accessibility/browser_accessibility.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/web_ax_object_proxy.cc
diff --git a/components/test_runner/web_ax_object_proxy.cc b/components/test_runner/web_ax_object_proxy.cc
index 4ed30f2c44ff2f737e8eacd565882a5ad4a9af0c..958e09ece7540dd90e990ee7bce5769eb060fee4 100644
--- a/components/test_runner/web_ax_object_proxy.cc
+++ b/components/test_runner/web_ax_object_proxy.cc
@@ -492,6 +492,14 @@ WebAXObjectProxy::GetObjectTemplateBuilder(v8::Isolate* isolate) {
.SetProperty("maxValue", &WebAXObjectProxy::MaxValue)
.SetProperty("valueDescription", &WebAXObjectProxy::ValueDescription)
.SetProperty("childrenCount", &WebAXObjectProxy::ChildrenCount)
+ .SetProperty("selectionAnchorObject",
+ &WebAXObjectProxy::SelectionAnchorObject)
+ .SetProperty("selectionAnchorOffset",
+ &WebAXObjectProxy::SelectionAnchorOffset)
+ .SetProperty("selectionFocusObject",
+ &WebAXObjectProxy::SelectionFocusObject)
+ .SetProperty("selectionFocusOffset",
+ &WebAXObjectProxy::SelectionFocusOffset)
.SetProperty("selectionStart", &WebAXObjectProxy::SelectionStart)
.SetProperty("selectionEnd", &WebAXObjectProxy::SelectionEnd)
.SetProperty("selectionStartLineNumber",
@@ -733,6 +741,66 @@ int WebAXObjectProxy::ChildrenCount() {
return count;
}
+v8::Local<v8::Value> WebAXObjectProxy::SelectionAnchorObject() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+
+ blink::WebAXObject anchorObject;
+ int anchorOffset = -1;
+ blink::WebAXObject focusObject;
+ int focusOffset = -1;
+ accessibility_object_.selection(anchorObject, anchorOffset,
+ focusObject, focusOffset);
+ if (anchorObject.isNull())
+ return v8::Null(blink::mainThreadIsolate());
+
+ return factory_->GetOrCreate(anchorObject);
+}
+
+int WebAXObjectProxy::SelectionAnchorOffset() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+
+ blink::WebAXObject anchorObject;
+ int anchorOffset = -1;
+ blink::WebAXObject focusObject;
+ int focusOffset = -1;
+ accessibility_object_.selection(anchorObject, anchorOffset,
+ focusObject, focusOffset);
+ if (anchorOffset < 0)
+ return -1;
+
+ return anchorOffset;
+}
+
+v8::Local<v8::Value> WebAXObjectProxy::SelectionFocusObject() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+
+ blink::WebAXObject anchorObject;
+ int anchorOffset = -1;
+ blink::WebAXObject focusObject;
+ int focusOffset = -1;
+ accessibility_object_.selection(anchorObject, anchorOffset,
+ focusObject, focusOffset);
+ if (focusObject.isNull())
+ return v8::Null(blink::mainThreadIsolate());
+
+ return factory_->GetOrCreate(focusObject);
+}
+
+int WebAXObjectProxy::SelectionFocusOffset() {
+ accessibility_object_.updateLayoutAndCheckValidity();
+
+ blink::WebAXObject anchorObject;
+ int anchorOffset = -1;
+ blink::WebAXObject focusObject;
+ int focusOffset = -1;
+ accessibility_object_.selection(anchorObject, anchorOffset,
+ focusObject, focusOffset);
+ if (focusOffset < 0)
+ return -1;
+
+ return focusOffset;
+}
+
int WebAXObjectProxy::SelectionStart() {
accessibility_object_.updateLayoutAndCheckValidity();
return accessibility_object_.selectionStart();
« no previous file with comments | « components/test_runner/web_ax_object_proxy.h ('k') | content/browser/accessibility/browser_accessibility.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698