accessible/src/base/nsEventShell.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef _nsEventShell_H_
     7 #define _nsEventShell_H_
     9 #include "AccEvent.h"
    11 namespace mozilla {
    12 template<typename T> class StaticRefPtr;
    13 }
    14 class nsIPersistentProperties;
    16 /**
    17  * Used for everything about events.
    18  */
    19 class nsEventShell
    20 {
    21 public:
    23   /**
    24    * Fire the accessible event.
    25    */
    26   static void FireEvent(mozilla::a11y::AccEvent* aEvent);
    28   /**
    29    * Fire accessible event of the given type for the given accessible.
    30    *
    31    * @param  aEventType   [in] the event type
    32    * @param  aAccessible  [in] the event target
    33    */
    34   static void FireEvent(uint32_t aEventType,
    35                         mozilla::a11y::Accessible* aAccessible,
    36                         mozilla::a11y::EIsFromUserInput aIsFromUserInput = mozilla::a11y::eAutoDetect);
    38   /**
    39    * Fire state change event.
    40    */
    41   static void FireEvent(mozilla::a11y::Accessible* aTarget, uint64_t aState,
    42                         bool aIsEnabled, bool aIsFromUserInput)
    43   {
    44     nsRefPtr<mozilla::a11y::AccStateChangeEvent> stateChangeEvent =
    45       new mozilla::a11y::AccStateChangeEvent(aTarget, aState, aIsEnabled,
    46                                              (aIsFromUserInput ?
    47                                                mozilla::a11y::eFromUserInput :
    48                                                mozilla::a11y::eNoUserInput));
    49     FireEvent(stateChangeEvent);
    50   }
    52   /**
    53    * Append 'event-from-input' object attribute if the accessible event has
    54    * been fired just now for the given node.
    55    *
    56    * @param  aNode        [in] the DOM node
    57    * @param  aAttributes  [in, out] the attributes
    58    */
    59   static void GetEventAttributes(nsINode *aNode,
    60                                  nsIPersistentProperties *aAttributes);
    62 private:
    63   static mozilla::StaticRefPtr<nsINode> sEventTargetNode;
    64   static bool sEventFromUserInput;
    65 };
    67 #endif

mercurial