2018-11-07 00:45:20 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_XULPersist_h
|
|
|
|
#define mozilla_dom_XULPersist_h
|
|
|
|
|
2020-11-17 12:28:10 +03:00
|
|
|
#include "nsStubDocumentObserver.h"
|
|
|
|
|
2019-05-03 02:01:57 +03:00
|
|
|
#ifndef MOZ_NEW_XULSTORE
|
|
|
|
class nsIXULStore;
|
|
|
|
#endif
|
|
|
|
|
2020-11-23 19:21:38 +03:00
|
|
|
template <typename T>
|
|
|
|
class nsCOMArray;
|
|
|
|
|
2018-11-07 00:45:20 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class XULPersist final : public nsStubDocumentObserver {
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
explicit XULPersist(Document* aDocument);
|
2018-11-07 00:45:20 +03:00
|
|
|
void Init();
|
|
|
|
void DropDocumentReference();
|
|
|
|
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void Persist(mozilla::dom::Element* aElement, int32_t aNameSpaceID,
|
|
|
|
nsAtom* aAttribute);
|
|
|
|
|
|
|
|
private:
|
|
|
|
~XULPersist();
|
|
|
|
nsresult ApplyPersistentAttributes();
|
|
|
|
nsresult ApplyPersistentAttributesInternal();
|
|
|
|
nsresult ApplyPersistentAttributesToElements(const nsAString& aID,
|
|
|
|
nsCOMArray<Element>& aElements);
|
|
|
|
|
2019-05-03 02:01:57 +03:00
|
|
|
#ifndef MOZ_NEW_XULSTORE
|
|
|
|
nsCOMPtr<nsIXULStore> mLocalStore;
|
|
|
|
#endif
|
|
|
|
|
2018-11-07 00:45:20 +03:00
|
|
|
// A weak pointer to our document. Nulled out by DropDocumentReference.
|
2019-01-02 16:05:23 +03:00
|
|
|
Document* MOZ_NON_OWNING_REF mDocument;
|
2018-11-07 00:45:20 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_XULPersist_h
|