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

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

Issue 2628723004: Experiment with restricting form submission with open elements. (Closed)
Patch Set: Rebase. Created 3 years, 11 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 19 matching lines...) Expand all
30 #include "core/HTMLNames.h" 30 #include "core/HTMLNames.h"
31 #include "core/MathMLNames.h" 31 #include "core/MathMLNames.h"
32 #include "core/SVGNames.h" 32 #include "core/SVGNames.h"
33 #include "core/XLinkNames.h" 33 #include "core/XLinkNames.h"
34 #include "core/XMLNSNames.h" 34 #include "core/XMLNSNames.h"
35 #include "core/XMLNames.h" 35 #include "core/XMLNames.h"
36 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
37 #include "core/dom/DocumentFragment.h" 37 #include "core/dom/DocumentFragment.h"
38 #include "core/dom/ElementTraversal.h" 38 #include "core/dom/ElementTraversal.h"
39 #include "core/frame/UseCounter.h" 39 #include "core/frame/UseCounter.h"
40 #include "core/html/HTMLFormControlElement.h"
40 #include "core/html/HTMLFormElement.h" 41 #include "core/html/HTMLFormElement.h"
41 #include "core/html/HTMLTemplateElement.h" 42 #include "core/html/HTMLTemplateElement.h"
42 #include "core/html/parser/AtomicHTMLToken.h" 43 #include "core/html/parser/AtomicHTMLToken.h"
43 #include "core/html/parser/HTMLDocumentParser.h" 44 #include "core/html/parser/HTMLDocumentParser.h"
44 #include "core/html/parser/HTMLParserIdioms.h" 45 #include "core/html/parser/HTMLParserIdioms.h"
45 #include "core/html/parser/HTMLStackItem.h" 46 #include "core/html/parser/HTMLStackItem.h"
46 #include "core/html/parser/HTMLToken.h" 47 #include "core/html/parser/HTMLToken.h"
47 #include "core/html/parser/HTMLTokenizer.h" 48 #include "core/html/parser/HTMLTokenizer.h"
48 #include "platform/text/PlatformLocale.h" 49 #include "platform/text/PlatformLocale.h"
49 #include "wtf/text/CharacterNames.h" 50 #include "wtf/text/CharacterNames.h"
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2423 if (m_tree.currentNode() != m_tree.openElements()->rootNode()) 2424 if (m_tree.currentNode() != m_tree.openElements()->rootNode())
2424 parseError(token); 2425 parseError(token);
2425 if (!m_templateInsertionModes.isEmpty() && 2426 if (!m_templateInsertionModes.isEmpty() &&
2426 processEndOfFileForInTemplateContents(token)) 2427 processEndOfFileForInTemplateContents(token))
2427 return; 2428 return;
2428 break; 2429 break;
2429 case InTableTextMode: 2430 case InTableTextMode:
2430 defaultForInTableText(); 2431 defaultForInTableText();
2431 processEndOfFile(token); 2432 processEndOfFile(token);
2432 return; 2433 return;
2433 case TextMode: 2434 case TextMode: {
2434 parseError(token); 2435 parseError(token);
2435 if (m_tree.currentStackItem()->hasTagName(scriptTag)) { 2436 if (m_tree.currentStackItem()->hasTagName(scriptTag)) {
2436 // Mark the script element as "already started". 2437 // Mark the script element as "already started".
2437 DVLOG(1) << "Not implemented."; 2438 DVLOG(1) << "Not implemented.";
2438 } 2439 }
2440 Element* el = m_tree.openElements()->top();
2441 if (isHTMLTextAreaElement(el))
2442 toHTMLFormControlElement(el)->setBlocksFormSubmission(true);
2439 m_tree.openElements()->pop(); 2443 m_tree.openElements()->pop();
2440 ASSERT(m_originalInsertionMode != TextMode); 2444 ASSERT(m_originalInsertionMode != TextMode);
2441 setInsertionMode(m_originalInsertionMode); 2445 setInsertionMode(m_originalInsertionMode);
2442 processEndOfFile(token); 2446 processEndOfFile(token);
2443 return; 2447 return;
2448 }
2444 case TemplateContentsMode: 2449 case TemplateContentsMode:
2445 if (processEndOfFileForInTemplateContents(token)) 2450 if (processEndOfFileForInTemplateContents(token))
2446 return; 2451 return;
2447 break; 2452 break;
2448 } 2453 }
2449 m_tree.processEndOfFile(); 2454 m_tree.processEndOfFile();
2450 } 2455 }
2451 2456
2452 void HTMLTreeBuilder::defaultForInitial() { 2457 void HTMLTreeBuilder::defaultForInitial() {
2453 DVLOG(1) << "Not implemented."; 2458 DVLOG(1) << "Not implemented.";
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 DEFINE_STRINGIFY(AfterFramesetMode) 2758 DEFINE_STRINGIFY(AfterFramesetMode)
2754 DEFINE_STRINGIFY(AfterAfterBodyMode) 2759 DEFINE_STRINGIFY(AfterAfterBodyMode)
2755 DEFINE_STRINGIFY(AfterAfterFramesetMode) 2760 DEFINE_STRINGIFY(AfterAfterFramesetMode)
2756 #undef DEFINE_STRINGIFY 2761 #undef DEFINE_STRINGIFY
2757 } 2762 }
2758 return "<unknown>"; 2763 return "<unknown>";
2759 } 2764 }
2760 #endif 2765 #endif
2761 2766
2762 } // namespace blink 2767 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698