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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h

Issue 2386893002: Reformat comments in core/html/parser (Closed)
Patch Set: self review Created 4 years, 2 months 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 class DocumentFragment; 44 class DocumentFragment;
45 class Element; 45 class Element;
46 class HTMLDocument; 46 class HTMLDocument;
47 class HTMLDocumentParser; 47 class HTMLDocumentParser;
48 48
49 class HTMLTreeBuilder final 49 class HTMLTreeBuilder final
50 : public GarbageCollectedFinalized<HTMLTreeBuilder> { 50 : public GarbageCollectedFinalized<HTMLTreeBuilder> {
51 WTF_MAKE_NONCOPYABLE(HTMLTreeBuilder); 51 WTF_MAKE_NONCOPYABLE(HTMLTreeBuilder);
52 52
53 public: 53 public:
54 // HTMLTreeBuilder can be created for non-HTMLDocument (XHTMLDocument) from ed iting code. 54 // HTMLTreeBuilder can be created for non-HTMLDocument (XHTMLDocument) from
55 // TODO(kouhei): Fix editing code to always invoke HTML parser on HTMLDocument . 55 // editing code.
56 // TODO(kouhei): Fix editing code to always invoke HTML parser on
57 // HTMLDocument.
56 static HTMLTreeBuilder* create(HTMLDocumentParser* parser, 58 static HTMLTreeBuilder* create(HTMLDocumentParser* parser,
57 Document& document, 59 Document& document,
58 ParserContentPolicy parserContentPolicy, 60 ParserContentPolicy parserContentPolicy,
59 const HTMLParserOptions& options) { 61 const HTMLParserOptions& options) {
60 return new HTMLTreeBuilder(parser, document, parserContentPolicy, options); 62 return new HTMLTreeBuilder(parser, document, parserContentPolicy, options);
61 } 63 }
62 static HTMLTreeBuilder* create(HTMLDocumentParser* parser, 64 static HTMLTreeBuilder* create(HTMLDocumentParser* parser,
63 DocumentFragment* fragment, 65 DocumentFragment* fragment,
64 Element* contextElement, 66 Element* contextElement,
65 ParserContentPolicy parserContentPolicy, 67 ParserContentPolicy parserContentPolicy,
(...skipping 12 matching lines...) Expand all
78 } 80 }
79 bool isParsingFragmentOrTemplateContents() const { 81 bool isParsingFragmentOrTemplateContents() const {
80 return isParsingFragment() || isParsingTemplateContents(); 82 return isParsingFragment() || isParsingTemplateContents();
81 } 83 }
82 84
83 void detach(); 85 void detach();
84 86
85 void constructTree(AtomicHTMLToken*); 87 void constructTree(AtomicHTMLToken*);
86 88
87 bool hasParserBlockingScript() const { return !!m_scriptToProcess; } 89 bool hasParserBlockingScript() const { return !!m_scriptToProcess; }
88 // Must be called to take the parser-blocking script before calling the parser again. 90 // Must be called to take the parser-blocking script before calling the parser
91 // again.
89 Element* takeScriptToProcess(TextPosition& scriptStartPosition); 92 Element* takeScriptToProcess(TextPosition& scriptStartPosition);
90 93
91 // Done, close any open tags, etc. 94 // Done, close any open tags, etc.
92 void finished(); 95 void finished();
93 96
94 // Synchronously flush pending text and queued tasks, possibly creating more D OM nodes. 97 // Synchronously flush pending text and queued tasks, possibly creating more
95 // Flushing pending text depends on |mode|. 98 // DOM nodes. Flushing pending text depends on |mode|.
96 void flush(FlushMode mode) { m_tree.flush(mode); } 99 void flush(FlushMode mode) { m_tree.flush(mode); }
97 100
98 void setShouldSkipLeadingNewline(bool shouldSkip) { 101 void setShouldSkipLeadingNewline(bool shouldSkip) {
99 m_shouldSkipLeadingNewline = shouldSkip; 102 m_shouldSkipLeadingNewline = shouldSkip;
100 } 103 }
101 104
102 private: 105 private:
103 class CharacterTokenBuffer; 106 class CharacterTokenBuffer;
104 // Represents HTML5 "insertion mode" 107 // Represents HTML5 "insertion mode"
105 // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#in sertion-mode 108 // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#in sertion-mode
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#or iginal-insertion-mode 257 // http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#or iginal-insertion-mode
255 InsertionMode m_originalInsertionMode; 258 InsertionMode m_originalInsertionMode;
256 259
257 Vector<InsertionMode> m_templateInsertionModes; 260 Vector<InsertionMode> m_templateInsertionModes;
258 261
259 // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.ht ml#pending-table-character-tokens 262 // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.ht ml#pending-table-character-tokens
260 StringBuilder m_pendingTableCharacters; 263 StringBuilder m_pendingTableCharacters;
261 264
262 bool m_shouldSkipLeadingNewline; 265 bool m_shouldSkipLeadingNewline;
263 266
264 // We access parser because HTML5 spec requires that we be able to change the state of the tokenizer 267 // We access parser because HTML5 spec requires that we be able to change the
265 // from within parser actions. We also need it to track the current position. 268 // state of the tokenizer from within parser actions. We also need it to track
269 // the current position.
266 Member<HTMLDocumentParser> m_parser; 270 Member<HTMLDocumentParser> m_parser;
267 271
268 Member<Element> 272 // <script> tag which needs processing before resuming the parser.
269 m_scriptToProcess; // <script> tag which needs processing before resuming the parser. 273 Member<Element> m_scriptToProcess;
270 TextPosition 274
271 m_scriptToProcessStartPosition; // Starting line number of the script tag needing processing. 275 // Starting line number of the script tag needing processing.
276 TextPosition m_scriptToProcessStartPosition;
272 277
273 HTMLParserOptions m_options; 278 HTMLParserOptions m_options;
274 }; 279 };
275 280
276 } // namespace blink 281 } // namespace blink
277 282
278 #endif 283 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLToken.h ('k') | third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698