tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

EventTree.h (1513B)


      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/. */
      5 
      6 #ifndef mozilla_a11y_EventTree_h_
      7 #define mozilla_a11y_EventTree_h_
      8 
      9 #include "AccEvent.h"
     10 #include "LocalAccessible.h"
     11 
     12 #include "mozilla/a11y/DocAccessible.h"
     13 
     14 namespace mozilla {
     15 namespace a11y {
     16 
     17 class NotificationController;
     18 
     19 /**
     20 * This class makes sure required tasks are done before and after tree
     21 * mutations. Currently this only includes group info invalidation. You must
     22 * have an object of this class on the stack when calling methods that mutate
     23 * the accessible tree.
     24 */
     25 class TreeMutation final {
     26 public:
     27  static const bool kNoEvents = true;
     28  static const bool kNoShutdown = true;
     29 
     30  explicit TreeMutation(LocalAccessible* aParent, bool aNoEvents = false);
     31  ~TreeMutation();
     32 
     33  void AfterInsertion(LocalAccessible* aChild);
     34  void BeforeRemoval(LocalAccessible* aChild, bool aNoShutdown = false);
     35  void Done();
     36 
     37 private:
     38  NotificationController* Controller() const {
     39    return mParent->Document()->Controller();
     40  }
     41 
     42  LocalAccessible* mParent;
     43  uint32_t mStartIdx;
     44  uint32_t mStateFlagsCopy;
     45 
     46  /*
     47   * True if mutation events should be queued.
     48   */
     49  bool mQueueEvents;
     50 
     51 #ifdef DEBUG
     52  bool mIsDone;
     53 #endif
     54 };
     55 
     56 }  // namespace a11y
     57 }  // namespace mozilla
     58 
     59 #endif  // mozilla_a11y_EventQueue_h_