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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp

Issue 2126043003: Refactor HTMLTreeBuilder/HTMLConstructionSite ctor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase / add comment Created 4 years, 5 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // re-enters the parser. 306 // re-enters the parser.
307 TaskQueue queue; 307 TaskQueue queue;
308 queue.swap(m_taskQueue); 308 queue.swap(m_taskQueue);
309 309
310 for (size_t i = 0; i < size; ++i) 310 for (size_t i = 0; i < size; ++i)
311 executeTask(queue[i]); 311 executeTask(queue[i]);
312 312
313 // We might be detached now. 313 // We might be detached now.
314 } 314 }
315 315
316 HTMLConstructionSite::HTMLConstructionSite(Document* document, ParserContentPoli cy parserContentPolicy) 316 HTMLConstructionSite::HTMLConstructionSite(Document& document, ParserContentPoli cy parserContentPolicy)
317 : m_document(document) 317 : m_document(&document)
318 , m_attachmentRoot(document) 318 , m_attachmentRoot(document)
319 , m_parserContentPolicy(parserContentPolicy) 319 , m_parserContentPolicy(parserContentPolicy)
320 , m_isParsingFragment(false) 320 , m_isParsingFragment(false)
321 , m_redirectAttachToFosterParent(false) 321 , m_redirectAttachToFosterParent(false)
322 , m_inQuirksMode(document->inQuirksMode()) 322 , m_inQuirksMode(document.inQuirksMode())
323 { 323 {
324 ASSERT(m_document->isHTMLDocument() || m_document->isXHTMLDocument()); 324 ASSERT(m_document->isHTMLDocument() || m_document->isXHTMLDocument());
325 } 325 }
326 326
327 HTMLConstructionSite::HTMLConstructionSite(DocumentFragment* fragment, ParserCon tentPolicy parserContentPolicy) 327 void HTMLConstructionSite::initFragmentParsing(DocumentFragment* fragment)
328 : m_document(&fragment->document())
329 , m_attachmentRoot(fragment)
330 , m_parserContentPolicy(parserContentPolicy)
331 , m_isParsingFragment(true)
332 , m_redirectAttachToFosterParent(false)
333 , m_inQuirksMode(fragment->document().inQuirksMode())
334 { 328 {
335 ASSERT(m_document->isHTMLDocument() || m_document->isXHTMLDocument()); 329 DCHECK_EQ(m_document, &fragment->document());
330 DCHECK_EQ(m_inQuirksMode, fragment->document().inQuirksMode());
331 DCHECK(!m_isParsingFragment);
332
333 m_attachmentRoot = fragment;
334 m_isParsingFragment = true;
336 } 335 }
337 336
338 HTMLConstructionSite::~HTMLConstructionSite() 337 HTMLConstructionSite::~HTMLConstructionSite()
339 { 338 {
340 // Depending on why we're being destroyed it might be OK 339 // Depending on why we're being destroyed it might be OK
341 // to forget queued tasks, but currently we don't expect to. 340 // to forget queued tasks, but currently we don't expect to.
342 ASSERT(m_taskQueue.isEmpty()); 341 ASSERT(m_taskQueue.isEmpty());
343 // Currently we assume that text will never be the last token in the 342 // Currently we assume that text will never be the last token in the
344 // document and that we'll always queue some additional task to cause it to flush. 343 // document and that we'll always queue some additional task to cause it to flush.
345 ASSERT(m_pendingText.isEmpty()); 344 ASSERT(m_pendingText.isEmpty());
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 queueTask(task); 874 queueTask(task);
876 } 875 }
877 876
878 DEFINE_TRACE(HTMLConstructionSite::PendingText) 877 DEFINE_TRACE(HTMLConstructionSite::PendingText)
879 { 878 {
880 visitor->trace(parent); 879 visitor->trace(parent);
881 visitor->trace(nextChild); 880 visitor->trace(nextChild);
882 } 881 }
883 882
884 } // namespace blink 883 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698