accessible/src/atk/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 __NS_ACCESSIBLE_WRAP_H__
     8 #define __NS_ACCESSIBLE_WRAP_H__
    10 #include "nsCOMPtr.h"
    11 #include "Accessible.h"
    13 struct _AtkObject;
    14 typedef struct _AtkObject AtkObject;
    16 enum AtkProperty {
    17   PROP_0,           // gobject convention
    18   PROP_NAME,
    19   PROP_DESCRIPTION,
    20   PROP_PARENT,      // ancestry has changed
    21   PROP_ROLE,
    22   PROP_LAYER,
    23   PROP_MDI_ZORDER,
    24   PROP_TABLE_CAPTION,
    25   PROP_TABLE_COLUMN_DESCRIPTION,
    26   PROP_TABLE_COLUMN_HEADER,
    27   PROP_TABLE_ROW_DESCRIPTION,
    28   PROP_TABLE_ROW_HEADER,
    29   PROP_TABLE_SUMMARY,
    30   PROP_LAST         // gobject convention
    31 };
    33 struct AtkPropertyChange {
    34   int32_t type;     // property type as listed above
    35   void *oldvalue;
    36   void *newvalue;
    37 };
    39 namespace mozilla {
    40 namespace a11y {
    42 class MaiHyperlink;
    44 /**
    45  * AccessibleWrap, and its descendents in atk directory provide the
    46  * implementation of AtkObject.
    47  */
    48 class AccessibleWrap : public Accessible
    49 {
    50 public:
    51   AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc);
    52   virtual ~AccessibleWrap();
    53   void ShutdownAtkObject();
    55   virtual void Shutdown();
    57   // return the atk object for this AccessibleWrap
    58   NS_IMETHOD GetNativeInterface(void **aOutAccessible);
    59   virtual nsresult HandleAccEvent(AccEvent* aEvent);
    61   AtkObject * GetAtkObject(void);
    62   static AtkObject * GetAtkObject(nsIAccessible * acc);
    64   bool IsValidObject();
    66   // get/set the MaiHyperlink object for this AccessibleWrap
    67   MaiHyperlink* GetMaiHyperlink(bool aCreate = true);
    68   void SetMaiHyperlink(MaiHyperlink* aMaiHyperlink);
    70   static const char * ReturnString(nsAString &aString) {
    71     static nsCString returnedString;
    72     returnedString = NS_ConvertUTF16toUTF8(aString);
    73     return returnedString.get();
    74   }
    76 protected:
    78   nsresult FireAtkStateChangeEvent(AccEvent* aEvent, AtkObject *aObject);
    79   nsresult FireAtkTextChangedEvent(AccEvent* aEvent, AtkObject *aObject);
    80   nsresult FireAtkShowHideEvent(AccEvent* aEvent, AtkObject *aObject,
    81                                 bool aIsAdded);
    83   AtkObject *mAtkObject;
    85 private:
    87   /*
    88    * do we have text-remove and text-insert signals if not we need to use
    89    * text-changed see AccessibleWrap::FireAtkTextChangedEvent() and
    90    * bug 619002
    91    */
    92   enum EAvailableAtkSignals {
    93     eUnknown,
    94     eHaveNewAtkTextSignals,
    95     eNoNewAtkSignals
    96   };
    98   static EAvailableAtkSignals gAvailableAtkSignals;
   100   uint16_t CreateMaiInterfaces(void);
   101 };
   103 } // namespace a11y
   104 } // namespace mozilla
   106 #endif /* __NS_ACCESSIBLE_WRAP_H__ */

mercurial