accessible/src/windows/msaa/AccessibleWrap.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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.

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

mercurial