blob: f9f9ba08c1a86f52f7e57dba80db3d1e842dd154 [file] [log] [blame]
darinb9481ed2006-03-20 02:57:59 +00001/*
darinb9481ed2006-03-20 02:57:59 +00002 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org)
darin@apple.com7e131b62009-08-15 06:25:49 +00005 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
darinb9481ed2006-03-20 02:57:59 +00006 *
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
ddkilzerc8eccec2007-09-26 02:29:57 +000019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
darinb9481ed2006-03-20 02:57:59 +000021 *
22 */
23
achristensen@apple.com760090a2016-08-22 15:51:58 +000024#pragma once
darinb9481ed2006-03-20 02:57:59 +000025
26#include "ContainerNode.h"
abarth@webkit.org26dfd172010-06-22 23:43:59 +000027#include "FragmentScriptingPermission.h"
darinb9481ed2006-03-20 02:57:59 +000028
29namespace WebCore {
30
ddkilzer@apple.com9c4dacc2009-07-11 05:36:29 +000031class DocumentFragment : public ContainerNode {
fpizlo@apple.com197cd322018-03-17 06:11:00 +000032 WTF_MAKE_ISO_ALLOCATED(DocumentFragment);
darinb9481ed2006-03-20 02:57:59 +000033public:
akling@apple.comcf2486a2014-12-19 03:11:36 +000034 static Ref<DocumentFragment> create(Document&);
darin@apple.com7e131b62009-08-15 06:25:49 +000035
ggaren@apple.com3a37a142013-03-19 21:51:48 +000036 void parseHTML(const String&, Element* contextElement, ParserContentPolicy = AllowScriptingContent);
37 bool parseXML(const String&, Element* contextElement, ParserContentPolicy = AllowScriptingContent);
rniwa@webkit.org2a3b3f72011-05-14 18:10:14 +000038
darin@apple.com49cc03e2016-03-04 17:20:46 +000039 bool canContainRangeEndPoint() const final { return true; }
adamk@chromium.org0503b9a2013-01-03 21:16:59 +000040 virtual bool isTemplateContent() const { return false; }
abarth@webkit.org26dfd172010-06-22 23:43:59 +000041
weinig@apple.com5f291002015-05-16 18:16:26 +000042 // From the NonElementParentNode interface - https://dom.spec.whatwg.org/#interface-nonelementparentnode
darin@apple.com0ce67df2019-06-17 01:48:13 +000043 WEBCORE_EXPORT Element* getElementById(const AtomString&) const;
weinig@apple.com5f291002015-05-16 18:16:26 +000044
tkent@chromium.org553b1722011-04-08 06:03:31 +000045protected:
antti@apple.comd2c1d0a2014-02-17 22:12:30 +000046 DocumentFragment(Document&, ConstructionType = CreateContainer);
darin@apple.com49cc03e2016-03-04 17:20:46 +000047 String nodeName() const final;
darinb9481ed2006-03-20 02:57:59 +000048
tkent@chromium.org553b1722011-04-08 06:03:31 +000049private:
darin@apple.com49cc03e2016-03-04 17:20:46 +000050 NodeType nodeType() const final;
darin@apple.com11ff47c2016-03-04 16:47:55 +000051 Ref<Node> cloneNodeInternal(Document&, CloningOperation) override;
52 bool childTypeAllowed(NodeType) const override;
darinb9481ed2006-03-20 02:57:59 +000053};
54
cdumez@apple.com3e58f0f2014-09-30 21:32:55 +000055} // namespace WebCore
weinig@apple.com9b9c8932013-10-14 16:52:23 +000056
cdumez@apple.com3e58f0f2014-09-30 21:32:55 +000057SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::DocumentFragment)
58 static bool isType(const WebCore::Node& node) { return node.isDocumentFragment(); }
59SPECIALIZE_TYPE_TRAITS_END()