Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: sky/engine/core/html/parser/HTMLTreeBuilder.h

Issue 676133002: Remove HTMLParserOptions (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fixup Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 11 matching lines...) Expand all
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #ifndef HTMLTreeBuilder_h 27 #ifndef HTMLTreeBuilder_h
28 #define HTMLTreeBuilder_h 28 #define HTMLTreeBuilder_h
29 29
30 #include "core/html/parser/HTMLConstructionSite.h" 30 #include "core/html/parser/HTMLConstructionSite.h"
31 #include "core/html/parser/HTMLElementStack.h" 31 #include "core/html/parser/HTMLElementStack.h"
32 #include "core/html/parser/HTMLParserOptions.h"
33 #include "platform/heap/Handle.h" 32 #include "platform/heap/Handle.h"
34 #include "wtf/Noncopyable.h" 33 #include "wtf/Noncopyable.h"
35 #include "wtf/PassOwnPtr.h" 34 #include "wtf/PassOwnPtr.h"
36 #include "wtf/PassRefPtr.h" 35 #include "wtf/PassRefPtr.h"
37 #include "wtf/RefPtr.h" 36 #include "wtf/RefPtr.h"
38 #include "wtf/Vector.h" 37 #include "wtf/Vector.h"
39 #include "wtf/text/StringBuilder.h" 38 #include "wtf/text/StringBuilder.h"
40 #include "wtf/text/TextPosition.h" 39 #include "wtf/text/TextPosition.h"
41 40
42 namespace blink { 41 namespace blink {
43 42
44 class AtomicHTMLToken; 43 class AtomicHTMLToken;
45 class Document; 44 class Document;
46 class DocumentFragment; 45 class DocumentFragment;
47 class Element; 46 class Element;
48 class LocalFrame; 47 class LocalFrame;
49 class HTMLToken; 48 class HTMLToken;
50 class HTMLDocument; 49 class HTMLDocument;
51 class Node; 50 class Node;
52 class HTMLDocumentParser; 51 class HTMLDocumentParser;
53 52
54 class HTMLTreeBuilder final : public NoBaseWillBeGarbageCollectedFinalized<HTMLT reeBuilder> { 53 class HTMLTreeBuilder final : public NoBaseWillBeGarbageCollectedFinalized<HTMLT reeBuilder> {
55 WTF_MAKE_NONCOPYABLE(HTMLTreeBuilder); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOV ED; 54 WTF_MAKE_NONCOPYABLE(HTMLTreeBuilder); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOV ED;
56 public: 55 public:
57 static PassOwnPtrWillBeRawPtr<HTMLTreeBuilder> create(HTMLDocumentParser* pa rser, HTMLDocument* document, bool reportErrors, const HTMLParserOptions& option s) 56 static PassOwnPtrWillBeRawPtr<HTMLTreeBuilder> create(HTMLDocumentParser* pa rser, HTMLDocument* document, bool reportErrors)
58 { 57 {
59 return adoptPtrWillBeNoop(new HTMLTreeBuilder(parser, document, reportEr rors, options)); 58 return adoptPtrWillBeNoop(new HTMLTreeBuilder(parser, document, reportEr rors));
60 }
61 static PassOwnPtrWillBeRawPtr<HTMLTreeBuilder> create(HTMLDocumentParser* pa rser, DocumentFragment* fragment, Element* contextElement, const HTMLParserOptio ns& options)
62 {
63 return adoptPtrWillBeNoop(new HTMLTreeBuilder(parser, fragment, contextE lement, options));
64 } 59 }
65 ~HTMLTreeBuilder(); 60 ~HTMLTreeBuilder();
66 void trace(Visitor*);
67 61
68 const HTMLElementStack* openElements() const { return m_tree.openElements(); } 62 const HTMLElementStack* openElements() const { return m_tree.openElements(); }
69 63
70 bool isParsingFragment() const { return !!m_fragmentContext.fragment(); } 64 bool isParsingFragment() const { return !!m_fragmentContext.fragment(); }
71 65
72 void detach(); 66 void detach();
73 67
74 void constructTree(AtomicHTMLToken*); 68 void constructTree(AtomicHTMLToken*);
75 69
76 bool hasParserBlockingScript() const { return !!m_scriptToProcess; } 70 bool hasParserBlockingScript() const { return !!m_scriptToProcess; }
77 // Must be called to take the parser-blocking script before calling the pars er again. 71 // Must be called to take the parser-blocking script before calling the pars er again.
78 PassRefPtrWillBeRawPtr<Element> takeScriptToProcess(TextPosition& scriptStar tPosition); 72 PassRefPtrWillBeRawPtr<Element> takeScriptToProcess(TextPosition& scriptStar tPosition);
79 73
80 // Done, close any open tags, etc. 74 // Done, close any open tags, etc.
81 void finished(); 75 void finished();
82 76
83 // Synchronously empty any queues, possibly creating more DOM nodes. 77 // Synchronously empty any queues, possibly creating more DOM nodes.
84 void flush() { m_tree.flush(); } 78 void flush() { m_tree.flush(); }
85 79
86 private: 80 private:
87 class CharacterTokenBuffer; 81 class CharacterTokenBuffer;
88 // Represents HTML5 "insertion mode" 82 // Represents HTML5 "insertion mode"
89 // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html# insertion-mode 83 // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html# insertion-mode
90 enum InsertionMode { 84 enum InsertionMode {
91 HTMLMode, 85 HTMLMode,
92 TextMode, 86 TextMode,
93 }; 87 };
94 88
95 HTMLTreeBuilder(HTMLDocumentParser*, HTMLDocument*, bool reportErrors, const HTMLParserOptions&); 89 HTMLTreeBuilder(HTMLDocumentParser*, HTMLDocument*, bool reportErrors);
96 HTMLTreeBuilder(HTMLDocumentParser*, DocumentFragment*, Element* contextElem ent, const HTMLParserOptions&);
97 90
98 void processStartTag(AtomicHTMLToken*); 91 void processStartTag(AtomicHTMLToken*);
99 void processEndTag(AtomicHTMLToken*); 92 void processEndTag(AtomicHTMLToken*);
100 void processCharacter(AtomicHTMLToken*); 93 void processCharacter(AtomicHTMLToken*);
101 void processEndOfFile(AtomicHTMLToken*); 94 void processEndOfFile(AtomicHTMLToken*);
102 95
103 void processGenericRawTextStartTag(AtomicHTMLToken*); 96 void processGenericRawTextStartTag(AtomicHTMLToken*);
104 void processScriptStartTag(AtomicHTMLToken*); 97 void processScriptStartTag(AtomicHTMLToken*);
105 98
106 InsertionMode insertionMode() const { return m_insertionMode; } 99 InsertionMode insertionMode() const { return m_insertionMode; }
(...skipping 26 matching lines...) Expand all
133 126
134 // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html# original-insertion-mode 127 // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html# original-insertion-mode
135 InsertionMode m_originalInsertionMode; 128 InsertionMode m_originalInsertionMode;
136 129
137 // We access parser because HTML5 spec requires that we be able to change th e state of the tokenizer 130 // We access parser because HTML5 spec requires that we be able to change th e state of the tokenizer
138 // from within parser actions. We also need it to track the current position . 131 // from within parser actions. We also need it to track the current position .
139 RawPtrWillBeMember<HTMLDocumentParser> m_parser; 132 RawPtrWillBeMember<HTMLDocumentParser> m_parser;
140 133
141 RefPtrWillBeMember<Element> m_scriptToProcess; // <script> tag which needs p rocessing before resuming the parser. 134 RefPtrWillBeMember<Element> m_scriptToProcess; // <script> tag which needs p rocessing before resuming the parser.
142 TextPosition m_scriptToProcessStartPosition; // Starting line number of the script tag needing processing. 135 TextPosition m_scriptToProcessStartPosition; // Starting line number of the script tag needing processing.
143
144 HTMLParserOptions m_options;
145 }; 136 };
146 137
147 } 138 }
148 139
149 #endif 140 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/html/parser/HTMLTokenizer.cpp ('k') | sky/engine/core/html/parser/HTMLTreeBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698