SVGDocument.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* -*- Mode: C++; tab-width: 8; 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/. */
  5. #ifndef mozilla_dom_SVGDocument_h
  6. #define mozilla_dom_SVGDocument_h
  7. #include "mozilla/Attributes.h"
  8. #include "mozilla/dom/XMLDocument.h"
  9. class nsSVGElement;
  10. namespace mozilla {
  11. namespace dom {
  12. class SVGForeignObjectElement;
  13. class SVGDocument final : public XMLDocument
  14. {
  15. friend class SVGForeignObjectElement; // To call EnsureNonSVGUserAgentStyleSheetsLoaded
  16. public:
  17. SVGDocument()
  18. : XMLDocument("image/svg+xml")
  19. , mHasLoadedNonSVGUserAgentStyleSheets(false)
  20. {
  21. mType = eSVG;
  22. }
  23. virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
  24. bool aNotify) override;
  25. virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
  26. virtual SVGDocument* AsSVGDocument() override {
  27. return this;
  28. }
  29. private:
  30. void EnsureNonSVGUserAgentStyleSheetsLoaded();
  31. bool mHasLoadedNonSVGUserAgentStyleSheets;
  32. };
  33. } // namespace dom
  34. } // namespace mozilla
  35. #endif // mozilla_dom_SVGDocument_h