Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef mozilla_a11y_AccessibleWrap_h_ |
michael@0 | 8 | #define mozilla_a11y_AccessibleWrap_h_ |
michael@0 | 9 | |
michael@0 | 10 | #include "nsCOMPtr.h" |
michael@0 | 11 | #include "Accessible.h" |
michael@0 | 12 | #include "Accessible2.h" |
michael@0 | 13 | #include "ia2Accessible.h" |
michael@0 | 14 | #include "ia2AccessibleComponent.h" |
michael@0 | 15 | #include "ia2AccessibleHyperlink.h" |
michael@0 | 16 | #include "ia2AccessibleValue.h" |
michael@0 | 17 | |
michael@0 | 18 | #ifdef __GNUC__ |
michael@0 | 19 | // Inheriting from both XPCOM and MSCOM interfaces causes a lot of warnings |
michael@0 | 20 | // about virtual functions being hidden by each other. This is done by |
michael@0 | 21 | // design, so silence the warning. |
michael@0 | 22 | #pragma GCC diagnostic ignored "-Woverloaded-virtual" |
michael@0 | 23 | #endif |
michael@0 | 24 | |
michael@0 | 25 | namespace mozilla { |
michael@0 | 26 | namespace a11y { |
michael@0 | 27 | |
michael@0 | 28 | class AccessibleWrap : public Accessible, |
michael@0 | 29 | public ia2Accessible, |
michael@0 | 30 | public ia2AccessibleComponent, |
michael@0 | 31 | public ia2AccessibleHyperlink, |
michael@0 | 32 | public ia2AccessibleValue |
michael@0 | 33 | { |
michael@0 | 34 | public: // construction, destruction |
michael@0 | 35 | AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : |
michael@0 | 36 | Accessible(aContent, aDoc) { } |
michael@0 | 37 | virtual ~AccessibleWrap() { } |
michael@0 | 38 | |
michael@0 | 39 | // nsISupports |
michael@0 | 40 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 41 | |
michael@0 | 42 | public: // IUnknown methods - see iunknown.h for documentation |
michael@0 | 43 | STDMETHODIMP QueryInterface(REFIID, void**); |
michael@0 | 44 | |
michael@0 | 45 | // Return the registered OLE class ID of this object's CfDataObj. |
michael@0 | 46 | CLSID GetClassID() const; |
michael@0 | 47 | |
michael@0 | 48 | public: // COM interface IAccessible |
michael@0 | 49 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent( |
michael@0 | 50 | /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispParent); |
michael@0 | 51 | |
michael@0 | 52 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChildCount( |
michael@0 | 53 | /* [retval][out] */ long __RPC_FAR *pcountChildren); |
michael@0 | 54 | |
michael@0 | 55 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChild( |
michael@0 | 56 | /* [in] */ VARIANT varChild, |
michael@0 | 57 | /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild); |
michael@0 | 58 | |
michael@0 | 59 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accName( |
michael@0 | 60 | /* [optional][in] */ VARIANT varChild, |
michael@0 | 61 | /* [retval][out] */ BSTR __RPC_FAR *pszName); |
michael@0 | 62 | |
michael@0 | 63 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue( |
michael@0 | 64 | /* [optional][in] */ VARIANT varChild, |
michael@0 | 65 | /* [retval][out] */ BSTR __RPC_FAR *pszValue); |
michael@0 | 66 | |
michael@0 | 67 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accDescription( |
michael@0 | 68 | /* [optional][in] */ VARIANT varChild, |
michael@0 | 69 | /* [retval][out] */ BSTR __RPC_FAR *pszDescription); |
michael@0 | 70 | |
michael@0 | 71 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accRole( |
michael@0 | 72 | /* [optional][in] */ VARIANT varChild, |
michael@0 | 73 | /* [retval][out] */ VARIANT __RPC_FAR *pvarRole); |
michael@0 | 74 | |
michael@0 | 75 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accState( |
michael@0 | 76 | /* [optional][in] */ VARIANT varChild, |
michael@0 | 77 | /* [retval][out] */ VARIANT __RPC_FAR *pvarState); |
michael@0 | 78 | |
michael@0 | 79 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accHelp( |
michael@0 | 80 | /* [optional][in] */ VARIANT varChild, |
michael@0 | 81 | /* [retval][out] */ BSTR __RPC_FAR *pszHelp); |
michael@0 | 82 | |
michael@0 | 83 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accHelpTopic( |
michael@0 | 84 | /* [out] */ BSTR __RPC_FAR *pszHelpFile, |
michael@0 | 85 | /* [optional][in] */ VARIANT varChild, |
michael@0 | 86 | /* [retval][out] */ long __RPC_FAR *pidTopic); |
michael@0 | 87 | |
michael@0 | 88 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accKeyboardShortcut( |
michael@0 | 89 | /* [optional][in] */ VARIANT varChild, |
michael@0 | 90 | /* [retval][out] */ BSTR __RPC_FAR *pszKeyboardShortcut); |
michael@0 | 91 | |
michael@0 | 92 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accFocus( |
michael@0 | 93 | /* [retval][out] */ VARIANT __RPC_FAR *pvarChild); |
michael@0 | 94 | |
michael@0 | 95 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accSelection( |
michael@0 | 96 | /* [retval][out] */ VARIANT __RPC_FAR *pvarChildren); |
michael@0 | 97 | |
michael@0 | 98 | virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accDefaultAction( |
michael@0 | 99 | /* [optional][in] */ VARIANT varChild, |
michael@0 | 100 | /* [retval][out] */ BSTR __RPC_FAR *pszDefaultAction); |
michael@0 | 101 | |
michael@0 | 102 | virtual /* [id] */ HRESULT STDMETHODCALLTYPE accSelect( |
michael@0 | 103 | /* [in] */ long flagsSelect, |
michael@0 | 104 | /* [optional][in] */ VARIANT varChild); |
michael@0 | 105 | |
michael@0 | 106 | virtual /* [id] */ HRESULT STDMETHODCALLTYPE accLocation( |
michael@0 | 107 | /* [out] */ long __RPC_FAR *pxLeft, |
michael@0 | 108 | /* [out] */ long __RPC_FAR *pyTop, |
michael@0 | 109 | /* [out] */ long __RPC_FAR *pcxWidth, |
michael@0 | 110 | /* [out] */ long __RPC_FAR *pcyHeight, |
michael@0 | 111 | /* [optional][in] */ VARIANT varChild); |
michael@0 | 112 | |
michael@0 | 113 | virtual /* [id] */ HRESULT STDMETHODCALLTYPE accNavigate( |
michael@0 | 114 | /* [in] */ long navDir, |
michael@0 | 115 | /* [optional][in] */ VARIANT varStart, |
michael@0 | 116 | /* [retval][out] */ VARIANT __RPC_FAR *pvarEndUpAt); |
michael@0 | 117 | |
michael@0 | 118 | virtual /* [id] */ HRESULT STDMETHODCALLTYPE accHitTest( |
michael@0 | 119 | /* [in] */ long xLeft, |
michael@0 | 120 | /* [in] */ long yTop, |
michael@0 | 121 | /* [retval][out] */ VARIANT __RPC_FAR *pvarChild); |
michael@0 | 122 | |
michael@0 | 123 | virtual /* [id] */ HRESULT STDMETHODCALLTYPE accDoDefaultAction( |
michael@0 | 124 | /* [optional][in] */ VARIANT varChild); |
michael@0 | 125 | |
michael@0 | 126 | virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_accName( |
michael@0 | 127 | /* [optional][in] */ VARIANT varChild, |
michael@0 | 128 | /* [in] */ BSTR szName); |
michael@0 | 129 | |
michael@0 | 130 | virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_accValue( |
michael@0 | 131 | /* [optional][in] */ VARIANT varChild, |
michael@0 | 132 | /* [in] */ BSTR szValue); |
michael@0 | 133 | |
michael@0 | 134 | // IDispatch (support of scripting languages like VB) |
michael@0 | 135 | virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo); |
michael@0 | 136 | |
michael@0 | 137 | virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, |
michael@0 | 138 | ITypeInfo **ppTInfo); |
michael@0 | 139 | |
michael@0 | 140 | virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, |
michael@0 | 141 | LPOLESTR *rgszNames, |
michael@0 | 142 | UINT cNames, |
michael@0 | 143 | LCID lcid, |
michael@0 | 144 | DISPID *rgDispId); |
michael@0 | 145 | |
michael@0 | 146 | virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, |
michael@0 | 147 | LCID lcid, WORD wFlags, |
michael@0 | 148 | DISPPARAMS *pDispParams, |
michael@0 | 149 | VARIANT *pVarResult, |
michael@0 | 150 | EXCEPINFO *pExcepInfo, |
michael@0 | 151 | UINT *puArgErr); |
michael@0 | 152 | |
michael@0 | 153 | // Accessible |
michael@0 | 154 | virtual nsresult HandleAccEvent(AccEvent* aEvent); |
michael@0 | 155 | |
michael@0 | 156 | // Helper methods |
michael@0 | 157 | static int32_t GetChildIDFor(Accessible* aAccessible); |
michael@0 | 158 | static HWND GetHWNDFor(Accessible* aAccessible); |
michael@0 | 159 | |
michael@0 | 160 | /** |
michael@0 | 161 | * System caret support: update the Windows caret position. |
michael@0 | 162 | * The system caret works more universally than the MSAA caret |
michael@0 | 163 | * For example, Window-Eyes, JAWS, ZoomText and Windows Tablet Edition use it |
michael@0 | 164 | * We will use an invisible system caret. |
michael@0 | 165 | * Gecko is still responsible for drawing its own caret |
michael@0 | 166 | */ |
michael@0 | 167 | void UpdateSystemCaretFor(Accessible* aAccessible); |
michael@0 | 168 | |
michael@0 | 169 | /** |
michael@0 | 170 | * Find an accessible by the given child ID in cached documents. |
michael@0 | 171 | */ |
michael@0 | 172 | Accessible* GetXPAccessibleFor(const VARIANT& aVarChild); |
michael@0 | 173 | |
michael@0 | 174 | NS_IMETHOD GetNativeInterface(void **aOutAccessible); |
michael@0 | 175 | |
michael@0 | 176 | static IDispatch *NativeAccessible(nsIAccessible *aXPAccessible); |
michael@0 | 177 | |
michael@0 | 178 | protected: |
michael@0 | 179 | |
michael@0 | 180 | /** |
michael@0 | 181 | * Creates ITypeInfo for LIBID_Accessibility if it's needed and returns it. |
michael@0 | 182 | */ |
michael@0 | 183 | static ITypeInfo* GetTI(LCID lcid); |
michael@0 | 184 | |
michael@0 | 185 | static ITypeInfo* gTypeInfo; |
michael@0 | 186 | |
michael@0 | 187 | |
michael@0 | 188 | enum navRelations { |
michael@0 | 189 | NAVRELATION_CONTROLLED_BY = 0x1000, |
michael@0 | 190 | NAVRELATION_CONTROLLER_FOR = 0x1001, |
michael@0 | 191 | NAVRELATION_LABEL_FOR = 0x1002, |
michael@0 | 192 | NAVRELATION_LABELLED_BY = 0x1003, |
michael@0 | 193 | NAVRELATION_MEMBER_OF = 0x1004, |
michael@0 | 194 | NAVRELATION_NODE_CHILD_OF = 0x1005, |
michael@0 | 195 | NAVRELATION_FLOWS_TO = 0x1006, |
michael@0 | 196 | NAVRELATION_FLOWS_FROM = 0x1007, |
michael@0 | 197 | NAVRELATION_SUBWINDOW_OF = 0x1008, |
michael@0 | 198 | NAVRELATION_EMBEDS = 0x1009, |
michael@0 | 199 | NAVRELATION_EMBEDDED_BY = 0x100a, |
michael@0 | 200 | NAVRELATION_POPUP_FOR = 0x100b, |
michael@0 | 201 | NAVRELATION_PARENT_WINDOW_OF = 0x100c, |
michael@0 | 202 | NAVRELATION_DEFAULT_BUTTON = 0x100d, |
michael@0 | 203 | NAVRELATION_DESCRIBED_BY = 0x100e, |
michael@0 | 204 | NAVRELATION_DESCRIPTION_FOR = 0x100f, |
michael@0 | 205 | NAVRELATION_NODE_PARENT_OF = 0x1010, |
michael@0 | 206 | NAVRELATION_CONTAINING_DOCUMENT = 0x1011, |
michael@0 | 207 | NAVRELATION_CONTAINING_TAB_PANE = 0x1012, |
michael@0 | 208 | NAVRELATION_CONTAINING_APPLICATION = 0x1014 |
michael@0 | 209 | }; |
michael@0 | 210 | }; |
michael@0 | 211 | |
michael@0 | 212 | } // namespace a11y |
michael@0 | 213 | } // namespace mozilla |
michael@0 | 214 | |
michael@0 | 215 | #ifdef XP_WIN |
michael@0 | 216 | // Undo the windows.h damage |
michael@0 | 217 | #undef GetMessage |
michael@0 | 218 | #undef CreateEvent |
michael@0 | 219 | #undef GetClassName |
michael@0 | 220 | #undef GetBinaryType |
michael@0 | 221 | #endif |
michael@0 | 222 | |
michael@0 | 223 | #endif |