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

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

Issue 1840193006: Move token gathering into parser Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add file lost with git reset Created 4 years, 8 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 1977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 ASSERT(getInsertionMode() == InHeadMode); 1988 ASSERT(getInsertionMode() == InHeadMode);
1989 // FIXME: This case should be broken out into processEndTagForInHead, 1989 // FIXME: This case should be broken out into processEndTagForInHead,
1990 // because other end tag cases now refer to it ("process the token for u sing the rules of the "in head" insertion mode"). 1990 // because other end tag cases now refer to it ("process the token for u sing the rules of the "in head" insertion mode").
1991 // but because the logic falls through to AfterHeadMode, that gets a lit tle messy. 1991 // but because the logic falls through to AfterHeadMode, that gets a lit tle messy.
1992 if (token->name() == templateTag) { 1992 if (token->name() == templateTag) {
1993 processTemplateEndTag(token); 1993 processTemplateEndTag(token);
1994 return; 1994 return;
1995 } 1995 }
1996 if (token->name() == headTag) { 1996 if (token->name() == headTag) {
1997 m_tree.openElements()->popHTMLHeadElement(); 1997 m_tree.openElements()->popHTMLHeadElement();
1998 // Ensure list of experiments is finalized
1999 m_tree.finalizeExperiments();
1998 setInsertionMode(AfterHeadMode); 2000 setInsertionMode(AfterHeadMode);
1999 return; 2001 return;
2000 } 2002 }
2001 if (token->name() != bodyTag && token->name() != htmlTag && token->name( ) != brTag) { 2003 if (token->name() != bodyTag && token->name() != htmlTag && token->name( ) != brTag) {
2002 parseError(token); 2004 parseError(token);
2003 return; 2005 return;
2004 } 2006 }
2005 defaultForInHead(); 2007 defaultForInHead();
2006 // Fall through. 2008 // Fall through.
2007 case AfterHeadMode: 2009 case AfterHeadMode:
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
2642 m_tree.insertHTMLElement(token); 2644 m_tree.insertHTMLElement(token);
2643 if (m_parser->tokenizer()) 2645 if (m_parser->tokenizer())
2644 m_parser->tokenizer()->setState(HTMLTokenizer::RAWTEXTState); 2646 m_parser->tokenizer()->setState(HTMLTokenizer::RAWTEXTState);
2645 m_originalInsertionMode = m_insertionMode; 2647 m_originalInsertionMode = m_insertionMode;
2646 setInsertionMode(TextMode); 2648 setInsertionMode(TextMode);
2647 } 2649 }
2648 2650
2649 void HTMLTreeBuilder::processScriptStartTag(AtomicHTMLToken* token) 2651 void HTMLTreeBuilder::processScriptStartTag(AtomicHTMLToken* token)
2650 { 2652 {
2651 ASSERT(token->type() == HTMLToken::StartTag); 2653 ASSERT(token->type() == HTMLToken::StartTag);
2654 // Ensure that the list of experiments is finalized here
2655 m_tree.finalizeExperiments();
2652 m_tree.insertScriptElement(token); 2656 m_tree.insertScriptElement(token);
2653 if (m_parser->tokenizer()) 2657 if (m_parser->tokenizer())
2654 m_parser->tokenizer()->setState(HTMLTokenizer::ScriptDataState); 2658 m_parser->tokenizer()->setState(HTMLTokenizer::ScriptDataState);
2655 m_originalInsertionMode = m_insertionMode; 2659 m_originalInsertionMode = m_insertionMode;
2656 2660
2657 TextPosition position = m_parser->textPosition(); 2661 TextPosition position = m_parser->textPosition();
2658 2662
2659 m_scriptToProcessStartPosition = position; 2663 m_scriptToProcessStartPosition = position;
2660 2664
2661 setInsertionMode(TextMode); 2665 setInsertionMode(TextMode);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2819 ASSERT(m_isAttached); 2823 ASSERT(m_isAttached);
2820 // Warning, this may detach the parser. Do not do anything else after this. 2824 // Warning, this may detach the parser. Do not do anything else after this.
2821 m_tree.finishedParsing(); 2825 m_tree.finishedParsing();
2822 } 2826 }
2823 2827
2824 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) 2828 void HTMLTreeBuilder::parseError(AtomicHTMLToken*)
2825 { 2829 {
2826 } 2830 }
2827 2831
2828 } // namespace blink 2832 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.h ('k') | third_party/WebKit/Source/core/loader/HttpEquiv.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698