summaryrefslogtreecommitdiffstats
path: root/accessible/windows/ProxyWrappers.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /accessible/windows/ProxyWrappers.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'accessible/windows/ProxyWrappers.h')
-rw-r--r--accessible/windows/ProxyWrappers.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/accessible/windows/ProxyWrappers.h b/accessible/windows/ProxyWrappers.h
new file mode 100644
index 000000000..6e7c84e18
--- /dev/null
+++ b/accessible/windows/ProxyWrappers.h
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. *
+ */
+
+#ifndef MOZILLA_A11Y_ProxyWrappers_h
+#define MOZILLA_A11Y_ProxyWrappers_h
+
+#include "HyperTextAccessible.h"
+
+namespace mozilla {
+namespace a11y {
+
+class ProxyAccessibleWrap : public AccessibleWrap
+{
+public:
+ ProxyAccessibleWrap(ProxyAccessible* aProxy) :
+ AccessibleWrap(nullptr, nullptr)
+ {
+ mType = eProxyType;
+ mBits.proxy = aProxy;
+ }
+
+ virtual void Shutdown() override
+ {
+ mBits.proxy = nullptr;
+ mStateFlags |= eIsDefunct;
+ }
+
+ virtual void GetNativeInterface(void** aOutAccessible) override
+ {
+ mBits.proxy->GetCOMInterface(aOutAccessible);
+ }
+};
+
+class HyperTextProxyAccessibleWrap : public HyperTextAccessibleWrap
+{
+public:
+ HyperTextProxyAccessibleWrap(ProxyAccessible* aProxy) :
+ HyperTextAccessibleWrap(nullptr, nullptr)
+ {
+ mType = eProxyType;
+ mBits.proxy = aProxy;
+ }
+
+ virtual void Shutdown() override
+ {
+ mBits.proxy = nullptr;
+ mStateFlags |= eIsDefunct;
+ }
+
+ virtual void GetNativeInterface(void** aOutAccessible) override
+ {
+ mBits.proxy->GetCOMInterface(aOutAccessible);
+ }
+};
+
+class DocProxyAccessibleWrap : public HyperTextProxyAccessibleWrap
+{
+public:
+ DocProxyAccessibleWrap(ProxyAccessible* aProxy) :
+ HyperTextProxyAccessibleWrap(aProxy)
+ { mGenericTypes |= eDocument; }
+
+ void AddID(uint32_t aID, AccessibleWrap* aAcc)
+ { mIDToAccessibleMap.Put(aID, aAcc); }
+ void RemoveID(uint32_t aID) { mIDToAccessibleMap.Remove(aID); }
+ AccessibleWrap* GetAccessibleByID(uint32_t aID) const
+ { return mIDToAccessibleMap.Get(aID); }
+
+private:
+ /*
+ * This provides a mapping from 32 bit id to accessible objects.
+ */
+ nsDataHashtable<nsUint32HashKey, AccessibleWrap*> mIDToAccessibleMap;
+};
+
+template<typename T>
+inline ProxyAccessible*
+HyperTextProxyFor(T* aWrapper)
+{
+ static_assert(mozilla::IsBaseOf<IUnknown, T>::value, "only IAccessible* should be passed in");
+ auto wrapper = static_cast<HyperTextProxyAccessibleWrap*>(aWrapper);
+ return wrapper->IsProxy() ? wrapper->Proxy() : nullptr;
+}
+
+}
+}
+
+#endif