Bug 1936278 - Prevent search mode chiclet from being dismissed when clicking in page...
[gecko.git] / dom / svg / SVGDocument.cpp
blob37ab7b6f637f01041d2d006a0a1e203eeb5a56a1
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 #include "mozilla/dom/SVGDocument.h"
9 #include "mozilla/css/Loader.h"
10 #include "nsNetUtil.h"
11 #include "nsServiceManagerUtils.h"
12 #include "nsString.h"
13 #include "nsLiteralString.h"
14 #include "mozilla/dom/Element.h"
15 #include "SVGElement.h"
16 #include "mozilla/StyleSheet.h"
17 #include "mozilla/StyleSheetInlines.h"
19 using namespace mozilla::css;
20 using namespace mozilla::dom;
22 namespace mozilla::dom {
24 //----------------------------------------------------------------------
25 // Implementation
27 nsresult SVGDocument::Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const {
28 NS_ASSERTION(aNodeInfo->NodeInfoManager() == mNodeInfoManager,
29 "Can't import this document into another document!");
31 RefPtr<SVGDocument> clone = new SVGDocument();
32 nsresult rv = CloneDocHelper(clone.get());
33 NS_ENSURE_SUCCESS(rv, rv);
35 clone.forget(aResult);
36 return NS_OK;
39 } // namespace mozilla::dom
41 ////////////////////////////////////////////////////////////////////////
42 // Exported creation functions
44 nsresult NS_NewSVGDocument(Document** aInstancePtrResult,
45 nsIPrincipal* aPrincipal,
46 nsIPrincipal* aPartitionedPrincipal) {
47 RefPtr<SVGDocument> doc = new SVGDocument();
49 nsresult rv = doc->Init(aPrincipal, aPartitionedPrincipal);
50 if (NS_FAILED(rv)) {
51 return rv;
54 doc.forget(aInstancePtrResult);
55 return rv;