Bug 1221256: Implement IAccessible::put_accValue for editable text. r=MarcoZ
authorJames Teh <jteh@mozilla.com>
Mon, 18 Nov 2019 05:38:35 +0000
changeset 502373 cbe50feba8e1ce4deb5b9dac66bd6feb4970b34f
parent 502372 4d4efd40bafa1416175ed5de1816ee0db962251f
child 502374 cbe5a080a2ada0308ff3a8eae088ddd44b79af6d
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ
bugs1221256
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1221256: Implement IAccessible::put_accValue for editable text. r=MarcoZ Differential Revision: https://phabricator.services.mozilla.com/D53378
accessible/ipc/win/handler/AccessibleHandler.cpp
accessible/windows/msaa/AccessibleWrap.cpp
--- a/accessible/ipc/win/handler/AccessibleHandler.cpp
+++ b/accessible/ipc/win/handler/AccessibleHandler.cpp
@@ -909,18 +909,21 @@ AccessibleHandler::accDoDefaultAction(VA
 HRESULT
 AccessibleHandler::put_accName(VARIANT varChild, BSTR szName) {
   // This matches AccessibleWrap
   return E_NOTIMPL;
 }
 
 HRESULT
 AccessibleHandler::put_accValue(VARIANT varChild, BSTR szValue) {
-  // This matches AccessibleWrap
-  return E_NOTIMPL;
+  HRESULT hr = ResolveIA2();
+  if (FAILED(hr)) {
+    return hr;
+  }
+  return mIA2PassThru->put_accValue(varChild, szValue);
 }
 
 /*** IAccessible2 ***/
 
 HRESULT
 AccessibleHandler::get_nRelations(long* nRelations) {
   if (!nRelations) {
     return E_INVALIDARG;
--- a/accessible/windows/msaa/AccessibleWrap.cpp
+++ b/accessible/windows/msaa/AccessibleWrap.cpp
@@ -1011,17 +1011,35 @@ AccessibleWrap::put_accName(
     /* [in] */ BSTR szName) {
   return E_NOTIMPL;
 }
 
 STDMETHODIMP
 AccessibleWrap::put_accValue(
     /* [optional][in] */ VARIANT varChild,
     /* [in] */ BSTR szValue) {
-  return E_NOTIMPL;
+  RefPtr<IAccessible> accessible;
+  HRESULT hr = ResolveChild(varChild, getter_AddRefs(accessible));
+  if (FAILED(hr)) {
+    return hr;
+  }
+
+  if (accessible) {
+    return accessible->put_accValue(kVarChildIdSelf, szValue);
+  }
+
+  HyperTextAccessible* ht = AsHyperText();
+  if (!ht) {
+    return E_NOTIMPL;
+  }
+
+  uint32_t length = ::SysStringLen(szValue);
+  nsAutoString text(szValue, length);
+  ht->ReplaceText(text);
+  return S_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // IDispatch
 
 STDMETHODIMP
 AccessibleWrap::GetTypeInfoCount(UINT* pctinfo) {
   if (!pctinfo) return E_INVALIDARG;