Bug 1825212 [wpt PR 39266] - [@scope] Propagate proximity from SubResult, a=testonly
[gecko.git] / dom / xul / XULPersist.h
blob3c838c3ecffde346fffe54fe5438cb17e8a3ff44
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_XULPersist_h
8 #define mozilla_dom_XULPersist_h
10 #include "nsStubDocumentObserver.h"
12 #ifndef MOZ_NEW_XULSTORE
13 # include "nsCOMPtr.h"
14 class nsIXULStore;
15 #endif
17 template <typename T>
18 class nsCOMArray;
20 namespace mozilla::dom {
22 class XULPersist final : public nsStubDocumentObserver {
23 public:
24 NS_DECL_ISUPPORTS
26 explicit XULPersist(Document* aDocument);
27 void Init();
28 void DropDocumentReference();
30 NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
32 protected:
33 void Persist(mozilla::dom::Element* aElement, nsAtom* aAttribute);
35 private:
36 ~XULPersist();
37 nsresult ApplyPersistentAttributes();
38 nsresult ApplyPersistentAttributesToElements(const nsAString& aID,
39 const nsAString& aDocURI,
40 nsCOMArray<Element>& aElements);
42 nsCOMPtr<nsIXULStore> mLocalStore;
44 // A weak pointer to our document. Nulled out by DropDocumentReference.
45 Document* MOZ_NON_OWNING_REF mDocument;
48 } // namespace mozilla::dom
50 #endif // mozilla_dom_XULPersist_h