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

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

Issue 680583003: Delete ScriptableDocumentParser (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Sort headers Created 6 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, 2014 Apple Inc. All rights reserved. 3 * Copyright (C) 2011, 2014 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 27 matching lines...) Expand all
38 #include "core/html/parser/HTMLToken.h" 38 #include "core/html/parser/HTMLToken.h"
39 #include "core/html/parser/HTMLTokenizer.h" 39 #include "core/html/parser/HTMLTokenizer.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 static TextPosition uninitializedPositionValue1() 43 static TextPosition uninitializedPositionValue1()
44 { 44 {
45 return TextPosition(OrdinalNumber::fromOneBasedInt(-1), OrdinalNumber::first ()); 45 return TextPosition(OrdinalNumber::fromOneBasedInt(-1), OrdinalNumber::first ());
46 } 46 }
47 47
48 HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, HTMLDocument* docum ent, ParserContentPolicy parserContentPolicy, bool, const HTMLParserOptions& opt ions) 48 HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, HTMLDocument* docum ent, bool, const HTMLParserOptions& options)
49 : 49 :
50 #if ENABLE(ASSERT) 50 #if ENABLE(ASSERT)
51 m_isAttached(true), 51 m_isAttached(true),
52 #endif 52 #endif
53 m_tree(document, parserContentPolicy) 53 m_tree(document)
54 , m_insertionMode(HTMLMode) 54 , m_insertionMode(HTMLMode)
55 , m_originalInsertionMode(HTMLMode) 55 , m_originalInsertionMode(HTMLMode)
56 , m_parser(parser) 56 , m_parser(parser)
57 , m_scriptToProcessStartPosition(uninitializedPositionValue1()) 57 , m_scriptToProcessStartPosition(uninitializedPositionValue1())
58 , m_options(options) 58 , m_options(options)
59 { 59 {
60 m_tree.openElements()->pushRootNode(document); 60 m_tree.openElements()->pushRootNode(document);
61 } 61 }
62 62
63 // FIXME: Member variables should be grouped into self-initializing structs to 63 // FIXME: Member variables should be grouped into self-initializing structs to
64 // minimize code duplication between these constructors. 64 // minimize code duplication between these constructors.
65 HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, DocumentFragment* f ragment, Element* contextElement, ParserContentPolicy parserContentPolicy, const HTMLParserOptions& options) 65 HTMLTreeBuilder::HTMLTreeBuilder(HTMLDocumentParser* parser, DocumentFragment* f ragment, Element* contextElement, const HTMLParserOptions& options)
66 : 66 :
67 #if ENABLE(ASSERT) 67 #if ENABLE(ASSERT)
68 m_isAttached(true), 68 m_isAttached(true),
69 #endif 69 #endif
70 m_fragmentContext(fragment, contextElement) 70 m_fragmentContext(fragment, contextElement)
71 , m_tree(fragment, parserContentPolicy) 71 , m_tree(fragment)
72 , m_insertionMode(HTMLMode) 72 , m_insertionMode(HTMLMode)
73 , m_originalInsertionMode(HTMLMode) 73 , m_originalInsertionMode(HTMLMode)
74 , m_parser(parser) 74 , m_parser(parser)
75 , m_scriptToProcessStartPosition(uninitializedPositionValue1()) 75 , m_scriptToProcessStartPosition(uninitializedPositionValue1())
76 , m_options(options) 76 , m_options(options)
77 { 77 {
78 ASSERT(isMainThread()); 78 ASSERT(isMainThread());
79 ASSERT(contextElement); 79 ASSERT(contextElement);
80 80
81 // Steps 4.2-4.6 of the HTML5 Fragment Case parsing algorithm: 81 // Steps 4.2-4.6 of the HTML5 Fragment Case parsing algorithm:
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 202 }
203 record = record->next(); 203 record = record->next();
204 } 204 }
205 return; 205 return;
206 } 206 }
207 207
208 ASSERT(mode == TextMode); 208 ASSERT(mode == TextMode);
209 if (token->name() == HTMLNames::scriptTag) { 209 if (token->name() == HTMLNames::scriptTag) {
210 // Pause ourselves so that parsing stops until the script can be process ed by the caller. 210 // Pause ourselves so that parsing stops until the script can be process ed by the caller.
211 ASSERT(m_tree.currentElement()->hasLocalName(HTMLNames::scriptTag.localN ame())); 211 ASSERT(m_tree.currentElement()->hasLocalName(HTMLNames::scriptTag.localN ame()));
212 if (scriptingContentIsAllowed(m_tree.parserContentPolicy())) 212 m_scriptToProcess = m_tree.currentElement();
213 m_scriptToProcess = m_tree.currentElement();
214 m_tree.openElements()->pop(); 213 m_tree.openElements()->pop();
215 setInsertionMode(m_originalInsertionMode); 214 setInsertionMode(m_originalInsertionMode);
216 215
217 if (m_parser->tokenizer()) { 216 if (m_parser->tokenizer()) {
218 // We must set the tokenizer's state to 217 // We must set the tokenizer's state to
219 // DataState explicitly if the tokenizer didn't have a chance to. 218 // DataState explicitly if the tokenizer didn't have a chance to.
220 ASSERT(m_parser->tokenizer()->state() == HTMLTokenizer::DataState || m_options.useThreading); 219 ASSERT(m_parser->tokenizer()->state() == HTMLTokenizer::DataState || m_options.useThreading);
221 m_parser->tokenizer()->setState(HTMLTokenizer::DataState); 220 m_parser->tokenizer()->setState(HTMLTokenizer::DataState);
222 } 221 }
223 return; 222 return;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 void HTMLTreeBuilder::finished() 262 void HTMLTreeBuilder::finished()
264 { 263 {
265 if (isParsingFragment()) 264 if (isParsingFragment())
266 return; 265 return;
267 ASSERT(m_isAttached); 266 ASSERT(m_isAttached);
268 // Warning, this may detach the parser. Do not do anything else after this. 267 // Warning, this may detach the parser. Do not do anything else after this.
269 m_tree.finishedParsing(); 268 m_tree.finishedParsing();
270 } 269 }
271 270
272 } // namespace blink 271 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/html/parser/HTMLTreeBuilder.h ('k') | sky/engine/core/loader/DocumentWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698