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

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

Issue 1826283004: Revert NotImplemented() changes in r383029 and r383047. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 26 matching lines...) Expand all
37 #include "core/dom/ElementTraversal.h" 37 #include "core/dom/ElementTraversal.h"
38 #include "core/frame/UseCounter.h" 38 #include "core/frame/UseCounter.h"
39 #include "core/html/HTMLDocument.h" 39 #include "core/html/HTMLDocument.h"
40 #include "core/html/HTMLFormElement.h" 40 #include "core/html/HTMLFormElement.h"
41 #include "core/html/parser/AtomicHTMLToken.h" 41 #include "core/html/parser/AtomicHTMLToken.h"
42 #include "core/html/parser/HTMLDocumentParser.h" 42 #include "core/html/parser/HTMLDocumentParser.h"
43 #include "core/html/parser/HTMLParserIdioms.h" 43 #include "core/html/parser/HTMLParserIdioms.h"
44 #include "core/html/parser/HTMLStackItem.h" 44 #include "core/html/parser/HTMLStackItem.h"
45 #include "core/html/parser/HTMLToken.h" 45 #include "core/html/parser/HTMLToken.h"
46 #include "core/html/parser/HTMLTokenizer.h" 46 #include "core/html/parser/HTMLTokenizer.h"
47 #include "platform/NotImplemented.h"
47 #include "platform/text/PlatformLocale.h" 48 #include "platform/text/PlatformLocale.h"
48 #include "wtf/text/CharacterNames.h" 49 #include "wtf/text/CharacterNames.h"
49 50
50 namespace blink { 51 namespace blink {
51 52
52 using namespace HTMLNames; 53 using namespace HTMLNames;
53 54
54 namespace { 55 namespace {
55 56
56 inline bool isHTMLSpaceOrReplacementCharacter(UChar character) 57 inline bool isHTMLSpaceOrReplacementCharacter(UChar character)
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 } 1457 }
1457 1458
1458 bool HTMLTreeBuilder::processBodyEndTagForInBody(AtomicHTMLToken* token) 1459 bool HTMLTreeBuilder::processBodyEndTagForInBody(AtomicHTMLToken* token)
1459 { 1460 {
1460 ASSERT(token->type() == HTMLToken::EndTag); 1461 ASSERT(token->type() == HTMLToken::EndTag);
1461 ASSERT(token->name() == bodyTag); 1462 ASSERT(token->name() == bodyTag);
1462 if (!m_tree.openElements()->inScope(bodyTag.localName())) { 1463 if (!m_tree.openElements()->inScope(bodyTag.localName())) {
1463 parseError(token); 1464 parseError(token);
1464 return false; 1465 return false;
1465 } 1466 }
1466 NOTIMPLEMENTED(); // Emit a more specific parse error based on stack content s. 1467 notImplemented(); // Emit a more specific parse error based on stack content s.
1467 setInsertionMode(AfterBodyMode); 1468 setInsertionMode(AfterBodyMode);
1468 return true; 1469 return true;
1469 } 1470 }
1470 1471
1471 void HTMLTreeBuilder::processAnyOtherEndTagForInBody(AtomicHTMLToken* token) 1472 void HTMLTreeBuilder::processAnyOtherEndTagForInBody(AtomicHTMLToken* token)
1472 { 1473 {
1473 ASSERT(token->type() == HTMLToken::EndTag); 1474 ASSERT(token->type() == HTMLToken::EndTag);
1474 if (token->name() == menuitemTag) 1475 if (token->name() == menuitemTag)
1475 UseCounter::count(m_tree.currentNode()->document(), UseCounter::MenuItem CloseTag); 1476 UseCounter::count(m_tree.currentNode()->document(), UseCounter::MenuItem CloseTag);
1476 HTMLElementStack::ElementRecord* record = m_tree.openElements()->topRecord() ; 1477 HTMLElementStack::ElementRecord* record = m_tree.openElements()->topRecord() ;
(...skipping 27 matching lines...) Expand all
1504 // 1, 2, 3 and 16 are covered by the for() loop. 1505 // 1, 2, 3 and 16 are covered by the for() loop.
1505 for (int i = 0; i < outerIterationLimit; ++i) { 1506 for (int i = 0; i < outerIterationLimit; ++i) {
1506 // 4. 1507 // 4.
1507 Element* formattingElement = m_tree.activeFormattingElements()->closestE lementInScopeWithName(token->name()); 1508 Element* formattingElement = m_tree.activeFormattingElements()->closestE lementInScopeWithName(token->name());
1508 // 4.a 1509 // 4.a
1509 if (!formattingElement) 1510 if (!formattingElement)
1510 return processAnyOtherEndTagForInBody(token); 1511 return processAnyOtherEndTagForInBody(token);
1511 // 4.c 1512 // 4.c
1512 if ((m_tree.openElements()->contains(formattingElement)) && !m_tree.open Elements()->inScope(formattingElement)) { 1513 if ((m_tree.openElements()->contains(formattingElement)) && !m_tree.open Elements()->inScope(formattingElement)) {
1513 parseError(token); 1514 parseError(token);
1514 NOTIMPLEMENTED(); // Check the stack of open elements for a more spe cific parse error. 1515 notImplemented(); // Check the stack of open elements for a more spe cific parse error.
1515 return; 1516 return;
1516 } 1517 }
1517 // 4.b 1518 // 4.b
1518 HTMLElementStack::ElementRecord* formattingElementRecord = m_tree.openEl ements()->find(formattingElement); 1519 HTMLElementStack::ElementRecord* formattingElementRecord = m_tree.openEl ements()->find(formattingElement);
1519 if (!formattingElementRecord) { 1520 if (!formattingElementRecord) {
1520 parseError(token); 1521 parseError(token);
1521 m_tree.activeFormattingElements()->remove(formattingElement); 1522 m_tree.activeFormattingElements()->remove(formattingElement);
1522 return; 1523 return;
1523 } 1524 }
1524 // 4.d 1525 // 4.d
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 // Fall through. 2457 // Fall through.
2457 case AfterHeadMode: 2458 case AfterHeadMode:
2458 ASSERT(getInsertionMode() == AfterHeadMode); 2459 ASSERT(getInsertionMode() == AfterHeadMode);
2459 defaultForAfterHead(); 2460 defaultForAfterHead();
2460 // Fall through 2461 // Fall through
2461 case InBodyMode: 2462 case InBodyMode:
2462 case InCellMode: 2463 case InCellMode:
2463 case InCaptionMode: 2464 case InCaptionMode:
2464 case InRowMode: 2465 case InRowMode:
2465 ASSERT(getInsertionMode() == InBodyMode || getInsertionMode() == InCellM ode || getInsertionMode() == InCaptionMode || getInsertionMode() == InRowMode || getInsertionMode() == TemplateContentsMode); 2466 ASSERT(getInsertionMode() == InBodyMode || getInsertionMode() == InCellM ode || getInsertionMode() == InCaptionMode || getInsertionMode() == InRowMode || getInsertionMode() == TemplateContentsMode);
2466 NOTIMPLEMENTED(); // Emit parse error based on what elements are still o pen. 2467 notImplemented(); // Emit parse error based on what elements are still o pen.
2467 if (!m_templateInsertionModes.isEmpty() && processEndOfFileForInTemplate Contents(token)) 2468 if (!m_templateInsertionModes.isEmpty() && processEndOfFileForInTemplate Contents(token))
2468 return; 2469 return;
2469 break; 2470 break;
2470 case AfterBodyMode: 2471 case AfterBodyMode:
2471 case AfterAfterBodyMode: 2472 case AfterAfterBodyMode:
2472 ASSERT(getInsertionMode() == AfterBodyMode || getInsertionMode() == Afte rAfterBodyMode); 2473 ASSERT(getInsertionMode() == AfterBodyMode || getInsertionMode() == Afte rAfterBodyMode);
2473 break; 2474 break;
2474 case InHeadNoscriptMode: 2475 case InHeadNoscriptMode:
2475 ASSERT(getInsertionMode() == InHeadNoscriptMode); 2476 ASSERT(getInsertionMode() == InHeadNoscriptMode);
2476 defaultForInHeadNoscript(); 2477 defaultForInHeadNoscript();
(...skipping 22 matching lines...) Expand all
2499 if (!m_templateInsertionModes.isEmpty() && processEndOfFileForInTemplate Contents(token)) 2500 if (!m_templateInsertionModes.isEmpty() && processEndOfFileForInTemplate Contents(token))
2500 return; 2501 return;
2501 break; 2502 break;
2502 case InTableTextMode: 2503 case InTableTextMode:
2503 defaultForInTableText(); 2504 defaultForInTableText();
2504 processEndOfFile(token); 2505 processEndOfFile(token);
2505 return; 2506 return;
2506 case TextMode: 2507 case TextMode:
2507 parseError(token); 2508 parseError(token);
2508 if (m_tree.currentStackItem()->hasTagName(scriptTag)) 2509 if (m_tree.currentStackItem()->hasTagName(scriptTag))
2509 NOTIMPLEMENTED(); // mark the script element as "already started". 2510 notImplemented(); // mark the script element as "already started".
2510 m_tree.openElements()->pop(); 2511 m_tree.openElements()->pop();
2511 ASSERT(m_originalInsertionMode != TextMode); 2512 ASSERT(m_originalInsertionMode != TextMode);
2512 setInsertionMode(m_originalInsertionMode); 2513 setInsertionMode(m_originalInsertionMode);
2513 processEndOfFile(token); 2514 processEndOfFile(token);
2514 return; 2515 return;
2515 case TemplateContentsMode: 2516 case TemplateContentsMode:
2516 if (processEndOfFileForInTemplateContents(token)) 2517 if (processEndOfFileForInTemplateContents(token))
2517 return; 2518 return;
2518 break; 2519 break;
2519 } 2520 }
2520 m_tree.processEndOfFile(); 2521 m_tree.processEndOfFile();
2521 } 2522 }
2522 2523
2523 void HTMLTreeBuilder::defaultForInitial() 2524 void HTMLTreeBuilder::defaultForInitial()
2524 { 2525 {
2525 NOTIMPLEMENTED(); 2526 notImplemented();
2526 m_tree.setDefaultCompatibilityMode(); 2527 m_tree.setDefaultCompatibilityMode();
2527 // FIXME: parse error 2528 // FIXME: parse error
2528 setInsertionMode(BeforeHTMLMode); 2529 setInsertionMode(BeforeHTMLMode);
2529 } 2530 }
2530 2531
2531 void HTMLTreeBuilder::defaultForBeforeHTML() 2532 void HTMLTreeBuilder::defaultForBeforeHTML()
2532 { 2533 {
2533 AtomicHTMLToken startHTML(HTMLToken::StartTag, htmlTag.localName()); 2534 AtomicHTMLToken startHTML(HTMLToken::StartTag, htmlTag.localName());
2534 m_tree.insertHTMLHtmlStartTagBeforeHTML(&startHTML); 2535 m_tree.insertHTMLHtmlStartTagBeforeHTML(&startHTML);
2535 setInsertionMode(BeforeHeadMode); 2536 setInsertionMode(BeforeHeadMode);
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2819 ASSERT(m_isAttached); 2820 ASSERT(m_isAttached);
2820 // Warning, this may detach the parser. Do not do anything else after this. 2821 // Warning, this may detach the parser. Do not do anything else after this.
2821 m_tree.finishedParsing(); 2822 m_tree.finishedParsing();
2822 } 2823 }
2823 2824
2824 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) 2825 void HTMLTreeBuilder::parseError(AtomicHTMLToken*)
2825 { 2826 {
2826 } 2827 }
2827 2828
2828 } // namespace blink 2829 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLTokenizer.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutRubyBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698