blob: 153f4c4491f8908bc225d832533ebbde28b29029 [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;
35class DocumentType;
Ben Murdochdf957042013-08-06 11:01:27 +010036class ExceptionState;
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010037class Frame;
38class HTMLDocument;
39class KURL;
40
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010041class DOMImplementation : public ScriptWrappable {
42 WTF_MAKE_FAST_ALLOCATED;
43public:
44 static PassOwnPtr<DOMImplementation> create(Document* document) { return adoptPtr(new DOMImplementation(document)); }
Ben Murdoch02772c62013-07-26 10:21:05 +010045
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010046 void ref() { m_document->ref(); }
47 void deref() { m_document->deref(); }
48 Document* document() { return m_document; }
49
50 // DOM methods & attributes for DOMImplementation
51 static bool hasFeature(const String& feature, const String& version);
Ben Murdochdf957042013-08-06 11:01:27 +010052 PassRefPtr<DocumentType> createDocumentType(const String& qualifiedName, const String& publicId, const String& systemId, ExceptionState&);
53 PassRefPtr<Document> createDocument(const String& namespaceURI, const String& qualifiedName, DocumentType*, ExceptionState&);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010054
55 DOMImplementation* getInterface(const String& feature);
56
57 // From the DOMImplementationCSS interface
Torne (Richard Coles)e5249552013-05-15 11:35:13 +010058 static PassRefPtr<CSSStyleSheet> createCSSStyleSheet(const String& title, const String& media);
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010059
60 // From the HTMLDOMImplementation interface
61 PassRefPtr<HTMLDocument> createHTMLDocument(const String& title);
62
63 // Other methods (not part of DOM)
64 static PassRefPtr<Document> createDocument(const String& MIMEType, Frame*, const KURL&, bool inViewSourceMode);
65
66 static bool isXMLMIMEType(const String& MIMEType);
67 static bool isTextMIMEType(const String& MIMEType);
68
69private:
70 explicit DOMImplementation(Document*);
71
72 Document* m_document;
73};
74
75} // namespace WebCore
76
77#endif