summaryrefslogtreecommitdiffstats
path: root/views/accessibility
diff options
context:
space:
mode:
Diffstat (limited to 'views/accessibility')
-rw-r--r--views/accessibility/view_accessibility.cc41
-rw-r--r--views/accessibility/view_accessibility.h6
2 files changed, 37 insertions, 10 deletions
diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc
index f8bf516..32239d1 100644
--- a/views/accessibility/view_accessibility.cc
+++ b/views/accessibility/view_accessibility.cc
@@ -479,7 +479,7 @@ STDMETHODIMP ViewAccessibility::get_accName(VARIANT var_id, BSTR* name) {
std::wstring temp_name;
if (var_id.lVal == CHILDID_SELF) {
- // Retrieve the parent view's name.
+ // Retrieve the current view's name.
view_->GetAccessibleName(&temp_name);
} else {
if (!IsValidChild((var_id.lVal - 1), view_)) {
@@ -600,6 +600,39 @@ STDMETHODIMP ViewAccessibility::get_accState(VARIANT var_id, VARIANT* state) {
return S_OK;
}
+STDMETHODIMP ViewAccessibility::get_accValue(VARIANT var_id, BSTR* value) {
+ if (var_id.vt != VT_I4 || !value) {
+ return E_INVALIDARG;
+ }
+
+ if (!view_) {
+ return E_FAIL;
+ }
+
+ std::wstring temp_value;
+
+ if (var_id.lVal == CHILDID_SELF) {
+ // Retrieve the current view's value.
+ view_->GetAccessibleValue(&temp_value);
+ } else {
+ if (!IsValidChild((var_id.lVal - 1), view_)) {
+ return E_INVALIDARG;
+ }
+ // Retrieve the child view's value.
+ view_->GetChildViewAt(var_id.lVal - 1)->GetAccessibleValue(&temp_value);
+ }
+ if (!temp_value.empty()) {
+ // Return value retrieved.
+ *value = SysAllocString(temp_value.c_str());
+ } else {
+ // If view has no value, fall back into the default implementation.
+ *value = NULL;
+ return E_NOTIMPL;
+ }
+
+ return S_OK;
+}
+
// Helper functions.
bool ViewAccessibility::IsValidChild(int child_id, views::View* view) const {
@@ -725,12 +758,6 @@ HRESULT ViewAccessibility::accDoDefaultAction(VARIANT var_id) {
return E_NOTIMPL;
}
-STDMETHODIMP ViewAccessibility::get_accValue(VARIANT var_id, BSTR* value) {
- if (value)
- *value = NULL;
- return E_NOTIMPL;
-}
-
STDMETHODIMP ViewAccessibility::get_accSelection(VARIANT* selected) {
if (selected)
selected->vt = VT_EMPTY;
diff --git a/views/accessibility/view_accessibility.h b/views/accessibility/view_accessibility.h
index 003ce7a..7d95794 100644
--- a/views/accessibility/view_accessibility.h
+++ b/views/accessibility/view_accessibility.h
@@ -81,14 +81,14 @@ class ATL_NO_VTABLE ViewAccessibility
// Retrieves the current state of the specified object.
STDMETHODIMP get_accState(VARIANT var_id, VARIANT* state);
+ // Retrieves the current value associated with the specified object.
+ STDMETHODIMP get_accValue(VARIANT var_id, BSTR* value);
+
// Non-supported IAccessible methods.
// Out-dated and can be safely said to be very rarely used.
STDMETHODIMP accDoDefaultAction(VARIANT var_id);
- // No value associated with views.
- STDMETHODIMP get_accValue(VARIANT var_id, BSTR* value);
-
// Selections not applicable to views.
STDMETHODIMP get_accSelection(VARIANT* selected);
STDMETHODIMP accSelect(LONG flags_sel, VARIANT var_id);