Wed, 31 Dec 2014 06:09:35 +0100
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: 4; 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_SelectionManager_h__
7 #define mozilla_a11y_SelectionManager_h__
9 #include "nsIFrame.h"
10 #include "nsISelectionListener.h"
12 class nsIPresShell;
14 namespace mozilla {
16 namespace dom {
17 class Element;
18 }
20 namespace a11y {
22 class AccEvent;
24 /**
25 * This special accessibility class is for the caret and selection management.
26 * There is only 1 visible caret per top level window. However, there may be
27 * several visible selections.
28 *
29 * The important selections are the one owned by each document, and the one in
30 * the currently focused control.
31 *
32 * On Windows this class is used to move an invisible system caret that
33 * shadows the Mozilla caret. Windows will also automatically map this to
34 * the MSAA caret accessible object (via OBJID_CARET) (as opposed to the root
35 * accessible tree for a window which is retrieved with OBJID_CLIENT).
36 *
37 * For ATK and IAccessible2, this class is used to fire caret move and
38 * selection change events.
39 */
41 struct SelData;
43 class SelectionManager : public nsISelectionListener
44 {
45 public:
46 // nsISupports
47 // implemented by derived nsAccessibilityService
49 // nsISelectionListener
50 NS_DECL_NSISELECTIONLISTENER
52 // SelectionManager
53 void Shutdown() { ClearControlSelectionListener(); }
55 /**
56 * Listen to selection events on the focused control.
57 *
58 * Note: only one control's selection events are listened to at a time. This
59 * will remove the previous control's selection listener.
60 */
61 void SetControlSelectionListener(dom::Element* aFocusedElm);
63 /**
64 * Stop listening to selection events on the control.
65 */
66 void ClearControlSelectionListener();
68 /**
69 * Listen to selection events on the document.
70 */
71 void AddDocSelectionListener(nsIPresShell* aPresShell);
73 /**
74 * Stop listening to selection events for a given document
75 */
76 void RemoveDocSelectionListener(nsIPresShell* aShell);
78 /**
79 * Process delayed event, results in caret move and text selection change
80 * events.
81 */
82 void ProcessTextSelChangeEvent(AccEvent* aEvent);
84 protected:
85 /**
86 * Process DOM selection change. Fire selection and caret move events.
87 */
88 void ProcessSelectionChanged(SelData* aSelData);
90 private:
91 // Currently focused control.
92 nsWeakFrame mCurrCtrlFrame;
93 };
95 } // namespace a11y
96 } // namespace mozilla
98 #endif