OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions | |
6 * are met: | |
7 * 1. Redistributions of source code must retain the above copyright | |
8 * notice, this list of conditions and the following disclaimer. | |
9 * 2. Redistributions in binary form must reproduce the above copyright | |
10 * notice, this list of conditions and the following disclaimer in the | |
11 * documentation and/or other materials provided with the distribution. | |
12 * | |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 */ | |
25 | |
26 #ifndef Serialization_h | |
27 #define Serialization_h | |
28 | |
29 #include "core/CSSPropertyNames.h" | |
30 #include "core/CoreExport.h" | |
31 #include "core/dom/ParserContentPolicy.h" | |
32 #include "core/editing/EphemeralRange.h" | |
33 #include "core/editing/HTMLInterchange.h" | |
34 #include "core/editing/Position.h" | |
35 #include "platform/heap/Handle.h" | |
36 #include "wtf/Forward.h" | |
37 | |
38 namespace blink { | |
39 | |
40 class ContainerNode; | |
41 class Document; | |
42 class DocumentFragment; | |
43 class Element; | |
44 class ExceptionState; | |
45 class KURL; | |
46 class Node; | |
47 class Range; | |
48 class StylePropertySet; | |
49 | |
50 enum EChildrenOnly { IncludeNode, ChildrenOnly }; | |
51 enum EAbsoluteURLs { DoNotResolveURLs, ResolveAllURLs, ResolveNonLocalURLs }; | |
52 enum class ConvertBlocksToInlines { NotConvert, Convert }; | |
53 | |
54 PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentFromText(const EphemeralR
ange& context, const String& text); | |
55 // TODO(yosin) We should get rid of |createFragmentFromText()| with |Range| for | |
56 // Oilpan. | |
57 PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentFromText(Range* context,
const String& text); | |
58 PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentFromMarkup(Document&, con
st String& markup, const String& baseURL, ParserContentPolicy = AllowScriptingCo
ntent); | |
59 PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentFromMarkupWithContext(Doc
ument&, const String& markup, unsigned fragmentStart, unsigned fragmentEnd, cons
t String& baseURL, ParserContentPolicy); | |
60 PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentForInnerOuterHTML(const S
tring&, Element*, ParserContentPolicy, const char* method, ExceptionState&); | |
61 PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentForTransformToFragment(co
nst String&, const String& sourceMIMEType, Document& outputDoc); | |
62 PassRefPtrWillBeRawPtr<DocumentFragment> createContextualFragment(const String&,
Element*, ParserContentPolicy, ExceptionState&); | |
63 | |
64 bool isPlainTextMarkup(Node*); | |
65 | |
66 // These methods are used by HTMLElement & ShadowRoot to replace the | |
67 // children with respected fragment/text. | |
68 void replaceChildrenWithFragment(ContainerNode*, PassRefPtrWillBeRawPtr<Document
Fragment>, ExceptionState&); | |
69 void replaceChildrenWithText(ContainerNode*, const String&, ExceptionState&); | |
70 | |
71 CORE_EXPORT String createMarkup(const Node*, EChildrenOnly = IncludeNode, EAbsol
uteURLs = DoNotResolveURLs); | |
72 | |
73 CORE_EXPORT String createMarkup(const Position& start, const Position& end, EAnn
otateForInterchange = DoNotAnnotateForInterchange, ConvertBlocksToInlines = Conv
ertBlocksToInlines::NotConvert, EAbsoluteURLs = DoNotResolveURLs, Node* constrai
ningAncestor = nullptr); | |
74 CORE_EXPORT String createMarkup(const PositionInComposedTree& start, const Posit
ionInComposedTree& end, EAnnotateForInterchange = DoNotAnnotateForInterchange, C
onvertBlocksToInlines = ConvertBlocksToInlines::NotConvert, EAbsoluteURLs = DoNo
tResolveURLs, Node* constrainingAncestor = nullptr); | |
75 | |
76 String urlToMarkup(const KURL&, const String& title); | |
77 void mergeWithNextTextNode(Text*, ExceptionState&); | |
78 | |
79 bool propertyMissingOrEqualToNone(StylePropertySet*, CSSPropertyID); | |
80 | |
81 } | |
82 | |
83 #endif // Serialization_h | |
OLD | NEW |