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

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

Issue 666913005: Delete HTMLStackItem (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 18 matching lines...) Expand all
29 29
30 #include "core/HTMLElementFactory.h" 30 #include "core/HTMLElementFactory.h"
31 #include "core/dom/DocumentFragment.h" 31 #include "core/dom/DocumentFragment.h"
32 #include "core/dom/Element.h" 32 #include "core/dom/Element.h"
33 #include "core/dom/Text.h" 33 #include "core/dom/Text.h"
34 #include "core/frame/LocalFrame.h" 34 #include "core/frame/LocalFrame.h"
35 #include "core/html/HTMLScriptElement.h" 35 #include "core/html/HTMLScriptElement.h"
36 #include "core/html/HTMLTemplateElement.h" 36 #include "core/html/HTMLTemplateElement.h"
37 #include "core/html/parser/AtomicHTMLToken.h" 37 #include "core/html/parser/AtomicHTMLToken.h"
38 #include "core/html/parser/HTMLParserIdioms.h" 38 #include "core/html/parser/HTMLParserIdioms.h"
39 #include "core/html/parser/HTMLStackItem.h"
40 #include "core/html/parser/HTMLToken.h" 39 #include "core/html/parser/HTMLToken.h"
41 #include "core/loader/FrameLoaderClient.h" 40 #include "core/loader/FrameLoaderClient.h"
42 #include "platform/NotImplemented.h" 41 #include "platform/NotImplemented.h"
43 #include "platform/text/TextBreakIterator.h" 42 #include "platform/text/TextBreakIterator.h"
44 #include <limits> 43 #include <limits>
45 44
46 namespace blink { 45 namespace blink {
47 46
48 static const unsigned maximumHTMLParserDOMTreeDepth = 512; 47 static const unsigned maximumHTMLParserDOMTreeDepth = 512;
49 48
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 ASSERT(m_taskQueue.isEmpty()); 266 ASSERT(m_taskQueue.isEmpty());
268 // Currently we assume that text will never be the last token in the 267 // Currently we assume that text will never be the last token in the
269 // document and that we'll always queue some additional task to cause it to flush. 268 // document and that we'll always queue some additional task to cause it to flush.
270 ASSERT(m_pendingText.isEmpty()); 269 ASSERT(m_pendingText.isEmpty());
271 } 270 }
272 271
273 void HTMLConstructionSite::trace(Visitor* visitor) 272 void HTMLConstructionSite::trace(Visitor* visitor)
274 { 273 {
275 visitor->trace(m_document); 274 visitor->trace(m_document);
276 visitor->trace(m_attachmentRoot); 275 visitor->trace(m_attachmentRoot);
277 visitor->trace(m_head);
278 visitor->trace(m_openElements);
279 visitor->trace(m_taskQueue); 276 visitor->trace(m_taskQueue);
280 visitor->trace(m_pendingText); 277 visitor->trace(m_pendingText);
281 } 278 }
282 279
283 void HTMLConstructionSite::detach() 280 void HTMLConstructionSite::detach()
284 { 281 {
285 // FIXME: We'd like to ASSERT here that we're canceling and not just discard ing 282 // FIXME: We'd like to ASSERT here that we're canceling and not just discard ing
286 // text that really should have made it into the DOM earlier, but there 283 // text that really should have made it into the DOM earlier, but there
287 // doesn't seem to be a nice way to do that. 284 // doesn't seem to be a nice way to do that.
288 m_pendingText.discard(); 285 m_pendingText.discard();
(...skipping 12 matching lines...) Expand all
301 // We shouldn't have any queued tasks but we might have pending text which w e need to promote to tasks and execute. 298 // We shouldn't have any queued tasks but we might have pending text which w e need to promote to tasks and execute.
302 ASSERT(m_taskQueue.isEmpty()); 299 ASSERT(m_taskQueue.isEmpty());
303 flush(); 300 flush();
304 m_document->finishedParsing(); 301 m_document->finishedParsing();
305 } 302 }
306 303
307 void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken* token) 304 void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken* token)
308 { 305 {
309 RefPtrWillBeRawPtr<HTMLElement> element = createHTMLElement(token); 306 RefPtrWillBeRawPtr<HTMLElement> element = createHTMLElement(token);
310 attachLater(currentNode(), element); 307 attachLater(currentNode(), element);
311 m_openElements.push(HTMLStackItem::create(element.release(), token)); 308 m_openElements.push(element.release());
312 } 309 }
313 310
314 void HTMLConstructionSite::insertSelfClosingHTMLElement(AtomicHTMLToken* token) 311 void HTMLConstructionSite::insertSelfClosingHTMLElement(AtomicHTMLToken* token)
315 { 312 {
316 ASSERT(token->type() == HTMLToken::StartTag); 313 ASSERT(token->type() == HTMLToken::StartTag);
317 // Normally HTMLElementStack is responsible for calling finishParsingChildre n, 314 // Normally HTMLElementStack is responsible for calling finishParsingChildre n,
318 // but self-closing elements are never in the element stack so the stack 315 // but self-closing elements are never in the element stack so the stack
319 // doesn't get a chance to tell them that we're done parsing their children. 316 // doesn't get a chance to tell them that we're done parsing their children.
320 attachLater(currentNode(), createHTMLElement(token), true); 317 attachLater(currentNode(), createHTMLElement(token), true);
321 // FIXME: Do we want to acknowledge the token's self-closing flag? 318 // FIXME: Do we want to acknowledge the token's self-closing flag?
322 // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization. html#acknowledge-self-closing-flag 319 // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization. html#acknowledge-self-closing-flag
323 } 320 }
324 321
325 void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken* token) 322 void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken* token)
326 { 323 {
327 RefPtrWillBeRawPtr<HTMLScriptElement> element = HTMLScriptElement::create(ow nerDocumentForCurrentNode()); 324 RefPtrWillBeRawPtr<HTMLScriptElement> element = HTMLScriptElement::create(ow nerDocumentForCurrentNode());
328 setAttributes(element.get(), token, m_parserContentPolicy); 325 setAttributes(element.get(), token, m_parserContentPolicy);
329 if (scriptingContentIsAllowed(m_parserContentPolicy)) 326 if (scriptingContentIsAllowed(m_parserContentPolicy))
330 attachLater(currentNode(), element); 327 attachLater(currentNode(), element);
331 m_openElements.push(HTMLStackItem::create(element.release(), token)); 328 m_openElements.push(element.release());
332 } 329 }
333 330
334 void HTMLConstructionSite::insertTextNode(const String& string, WhitespaceMode w hitespaceMode) 331 void HTMLConstructionSite::insertTextNode(const String& string, WhitespaceMode w hitespaceMode)
335 { 332 {
336 HTMLConstructionSiteTask dummyTask(HTMLConstructionSiteTask::Insert); 333 HTMLConstructionSiteTask dummyTask(HTMLConstructionSiteTask::Insert);
337 dummyTask.parent = currentNode(); 334 dummyTask.parent = currentNode();
338 335
339 // FIXME: This probably doesn't need to be done both here and in insert(Task ). 336 // FIXME: This probably doesn't need to be done both here and in insert(Task ).
340 if (isHTMLTemplateElement(*dummyTask.parent)) 337 if (isHTMLTemplateElement(*dummyTask.parent))
341 dummyTask.parent = toHTMLTemplateElement(dummyTask.parent.get())->conten t(); 338 dummyTask.parent = toHTMLTemplateElement(dummyTask.parent.get())->conten t();
(...skipping 29 matching lines...) Expand all
371 return element.release(); 368 return element.release();
372 } 369 }
373 370
374 void HTMLConstructionSite::PendingText::trace(Visitor* visitor) 371 void HTMLConstructionSite::PendingText::trace(Visitor* visitor)
375 { 372 {
376 visitor->trace(parent); 373 visitor->trace(parent);
377 visitor->trace(nextChild); 374 visitor->trace(nextChild);
378 } 375 }
379 376
380 } 377 }
OLDNEW
« no previous file with comments | « sky/engine/core/html/parser/HTMLConstructionSite.h ('k') | sky/engine/core/html/parser/HTMLElementStack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698