blob: f954c8fd6b9bd489843f83d1a1267b22bec7310a [file] [log] [blame]
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +01001/*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 */
23
24#ifndef DOMImplementation_h
25#define DOMImplementation_h
26
27#include "core/dom/Document.h"
Ben Murdoch591b9582013-07-10 11:41:44 +010028#include "wtf/Forward.h"
29#include "wtf/PassRefPtr.h"
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010030
31namespace WebCore {
32
33class CSSStyleSheet;
34class Document;
Torne (Richard Coles)f79f16f2013-10-31 11:16:44 +000035class DocumentInit;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010036class DocumentType;
Ben Murdochdf957042013-08-06 11:01:27 +010037class ExceptionState;
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +000038class LocalFrame;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010039class HTMLDocument;
40class KURL;
Torne (Richard Coles)09380292014-02-21 12:17:33 +000041class XMLDocument;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010042
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010043class DOMImplementation : public ScriptWrappable {
44 WTF_MAKE_FAST_ALLOCATED;
45public:
Torne (Richard Coles)51b29062013-11-28 11:56:03 +000046 static PassOwnPtr<DOMImplementation> create(Document& document) { return adoptPtr(new DOMImplementation(document)); }
Ben Murdoch02772c62013-07-26 10:21:05 +010047
Torne (Richard Coles)51b29062013-11-28 11:56:03 +000048 void ref() { m_document.ref(); }
49 void deref() { m_document.deref(); }
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +000050 Document& document() const { return m_document; }
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010051
52 // DOM methods & attributes for DOMImplementation
53 static bool hasFeature(const String& feature, const String& version);
Torne (Richard Coles)09380292014-02-21 12:17:33 +000054 bool hasFeatureForBindings(const String& feature, const String& version);
Torne (Richard Coles)a854de02013-12-18 16:25:25 +000055 PassRefPtr<DocumentType> createDocumentType(const AtomicString& qualifiedName, const String& publicId, const String& systemId, ExceptionState&);
Torne (Richard Coles)09380292014-02-21 12:17:33 +000056 PassRefPtr<XMLDocument> createDocument(const AtomicString& namespaceURI, const AtomicString& qualifiedName, DocumentType*, ExceptionState&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010057
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010058 // From the HTMLDOMImplementation interface
59 PassRefPtr<HTMLDocument> createHTMLDocument(const String& title);
60
61 // Other methods (not part of DOM)
Torne (Richard Coles)d5428f32014-03-18 10:21:16 +000062 static PassRefPtr<Document> createDocument(const String& mimeType, LocalFrame*, const KURL&, bool inViewSourceMode);
Torne (Richard Coles)09380292014-02-21 12:17:33 +000063 static PassRefPtr<Document> createDocument(const String& mimeType, const DocumentInit&, bool inViewSourceMode);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010064
Torne (Richard Coles)09380292014-02-21 12:17:33 +000065 static bool isXMLMIMEType(const String&);
66 static bool isTextMIMEType(const String&);
67 static bool isJSONMIMEType(const String&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010068
69private:
Torne (Richard Coles)51b29062013-11-28 11:56:03 +000070 explicit DOMImplementation(Document&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010071
Torne (Richard Coles)51b29062013-11-28 11:56:03 +000072 Document& m_document;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010073};
74
75} // namespace WebCore
76
77#endif