accessible/src/base/EventQueue.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 mozilla_a11y_EventQueue_h_
     7 #define mozilla_a11y_EventQueue_h_
     9 #include "AccEvent.h"
    11 namespace mozilla {
    12 namespace a11y {
    14 class DocAccessible;
    16 /**
    17  * Used to organize and coalesce pending events.
    18  */
    19 class EventQueue
    20 {
    21 protected:
    22   EventQueue(DocAccessible* aDocument) : mDocument(aDocument) { }
    24   /**
    25    * Put an accessible event into the queue to process it later.
    26    */
    27   bool PushEvent(AccEvent* aEvent);
    29   /**
    30    * Process events from the queue and fires events.
    31    */
    32   void ProcessEventQueue();
    34 private:
    35   EventQueue(const EventQueue&) MOZ_DELETE;
    36   EventQueue& operator = (const EventQueue&) MOZ_DELETE;
    38   // Event queue processing
    39   /**
    40    * Coalesce redundant events from the queue.
    41    */
    42   void CoalesceEvents();
    44   /**
    45    * Coalesce events from the same subtree.
    46    */
    47   void CoalesceReorderEvents(AccEvent* aTailEvent);
    49   /**
    50    * Coalesce two selection change events within the same select control.
    51    */
    52   void CoalesceSelChangeEvents(AccSelChangeEvent* aTailEvent,
    53                                AccSelChangeEvent* aThisEvent,
    54                                uint32_t aThisIndex);
    56   /**
    57    * Coalesce text change events caused by sibling hide events.
    58    */
    59   void CoalesceTextChangeEventsFor(AccHideEvent* aTailEvent,
    60                                    AccHideEvent* aThisEvent);
    61   void CoalesceTextChangeEventsFor(AccShowEvent* aTailEvent,
    62                                    AccShowEvent* aThisEvent);
    64   /**
    65     * Create text change event caused by hide or show event. When a node is
    66     * hidden/removed or shown/appended, the text in an ancestor hyper text will
    67     * lose or get new characters.
    68     */
    69    void CreateTextChangeEventFor(AccMutationEvent* aEvent);
    71 protected:
    73   /**
    74    * The document accessible reference owning this queue.
    75    */
    76   DocAccessible* mDocument;
    78   /**
    79    * Pending events array. Don't make this an nsAutoTArray; we use
    80    * SwapElements() on it.
    81    */
    82   nsTArray<nsRefPtr<AccEvent> > mEvents;
    83 };
    85 } // namespace a11y
    86 } // namespace mozilla
    88 #endif // mozilla_a11y_EventQueue_h_

mercurial