Bug 1825212 [wpt PR 39266] - [@scope] Propagate proximity from SubResult, a=testonly
[gecko.git] / dom / xul / nsXULCommandDispatcher.h
blob1f988c752e8aab92976a96f2a409ee53c8885cf0
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 /*
8 This is the focus manager for XUL documents.
12 #ifndef nsXULCommandDispatcher_h__
13 #define nsXULCommandDispatcher_h__
15 #include "nsCOMPtr.h"
16 #include "nsIDOMXULCommandDispatcher.h"
17 #include "nsWeakReference.h"
18 #include "nsString.h"
19 #include "nsCycleCollectionParticipant.h"
20 #include "nsTArray.h"
21 #include "mozilla/RefPtr.h"
23 class nsPIDOMWindowOuter;
24 class nsPIWindowRoot;
26 namespace mozilla::dom {
27 class Document;
28 class Element;
29 } // namespace mozilla::dom
31 class nsXULCommandDispatcher : public nsIDOMXULCommandDispatcher,
32 public nsSupportsWeakReference {
33 using Document = mozilla::dom::Document;
34 using Element = mozilla::dom::Element;
36 public:
37 explicit nsXULCommandDispatcher(Document* aDocument);
39 // nsISupports
40 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
41 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULCommandDispatcher,
42 nsIDOMXULCommandDispatcher)
44 // nsIDOMXULCommandDispatcher interface
45 NS_DECL_NSIDOMXULCOMMANDDISPATCHER
47 void Disconnect();
49 protected:
50 virtual ~nsXULCommandDispatcher();
52 already_AddRefed<nsPIWindowRoot> GetWindowRoot();
54 Element* GetRootFocusedContentAndWindow(nsPIDOMWindowOuter** aWindow);
55 nsresult MoveFocusIntoSubtree(Element*, bool aForward);
57 RefPtr<Document> mDocument;
59 class Updater {
60 public:
61 Updater(Element* aElement, const nsAString& aEvents,
62 const nsAString& aTargets)
63 : mElement(aElement),
64 mEvents(aEvents),
65 mTargets(aTargets),
66 mNext(nullptr) {}
68 RefPtr<Element> mElement;
69 nsString mEvents;
70 nsString mTargets;
71 Updater* mNext;
74 Updater* mUpdaters;
76 bool Matches(const nsString& aList, const nsAString& aElement);
78 bool mLocked;
79 nsTArray<nsString> mPendingUpdates;
82 #endif // nsXULCommandDispatcher_h__