Bug 1729121 [wpt PR 30345] - Improve media queries JS test, a=testonly
[gecko.git] / dom / xul / XULPersist.h
blobd6cd20eae3ff873a83cfaa56281f04c24d87d6e7
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 class nsIXULStore;
14 #endif
16 template <typename T>
17 class nsCOMArray;
19 namespace mozilla {
20 namespace 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, int32_t aNameSpaceID,
34 nsAtom* aAttribute);
36 private:
37 ~XULPersist();
38 nsresult ApplyPersistentAttributes();
39 nsresult ApplyPersistentAttributesInternal();
40 nsresult ApplyPersistentAttributesToElements(const nsAString& aID,
41 nsCOMArray<Element>& aElements);
43 #ifndef MOZ_NEW_XULSTORE
44 nsCOMPtr<nsIXULStore> mLocalStore;
45 #endif
47 // A weak pointer to our document. Nulled out by DropDocumentReference.
48 Document* MOZ_NON_OWNING_REF mDocument;
51 } // namespace dom
52 } // namespace mozilla
54 #endif // mozilla_dom_XULPersist_h