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

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

Issue 18970003: Introduce isHTMLOptGroupElement and toHTMLOptGroupElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
« no previous file with comments | « Source/core/html/parser/HTMLElementStack.cpp ('k') | Source/core/rendering/RenderListBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 17 matching lines...) Expand all
28 #include "core/html/parser/HTMLTreeBuilder.h" 28 #include "core/html/parser/HTMLTreeBuilder.h"
29 29
30 #include "HTMLNames.h" 30 #include "HTMLNames.h"
31 #include "MathMLNames.h" 31 #include "MathMLNames.h"
32 #include "SVGNames.h" 32 #include "SVGNames.h"
33 #include "XLinkNames.h" 33 #include "XLinkNames.h"
34 #include "XMLNSNames.h" 34 #include "XMLNSNames.h"
35 #include "XMLNames.h" 35 #include "XMLNames.h"
36 #include "core/dom/DocumentFragment.h" 36 #include "core/dom/DocumentFragment.h"
37 #include "core/html/HTMLFormElement.h" 37 #include "core/html/HTMLFormElement.h"
38 #include "core/html/HTMLOptGroupElement.h"
38 #include "core/html/parser/AtomicHTMLToken.h" 39 #include "core/html/parser/AtomicHTMLToken.h"
39 #include "core/html/parser/HTMLDocumentParser.h" 40 #include "core/html/parser/HTMLDocumentParser.h"
40 #include "core/html/parser/HTMLParserIdioms.h" 41 #include "core/html/parser/HTMLParserIdioms.h"
41 #include "core/html/parser/HTMLStackItem.h" 42 #include "core/html/parser/HTMLStackItem.h"
42 #include "core/html/parser/HTMLToken.h" 43 #include "core/html/parser/HTMLToken.h"
43 #include "core/html/parser/HTMLTokenizer.h" 44 #include "core/html/parser/HTMLTokenizer.h"
44 #include "core/platform/LocalizedStrings.h" 45 #include "core/platform/LocalizedStrings.h"
45 #include "core/platform/NotImplemented.h" 46 #include "core/platform/NotImplemented.h"
46 #include "wtf/MainThread.h" 47 #include "wtf/MainThread.h"
47 #include "wtf/unicode/CharacterNames.h" 48 #include "wtf/unicode/CharacterNames.h"
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 processEndTag(&endOption); 1364 processEndTag(&endOption);
1364 } 1365 }
1365 m_tree.insertHTMLElement(token); 1366 m_tree.insertHTMLElement(token);
1366 return; 1367 return;
1367 } 1368 }
1368 if (token->name() == optgroupTag) { 1369 if (token->name() == optgroupTag) {
1369 if (m_tree.currentStackItem()->hasTagName(optionTag)) { 1370 if (m_tree.currentStackItem()->hasTagName(optionTag)) {
1370 AtomicHTMLToken endOption(HTMLToken::EndTag, optionTag.localName ()); 1371 AtomicHTMLToken endOption(HTMLToken::EndTag, optionTag.localName ());
1371 processEndTag(&endOption); 1372 processEndTag(&endOption);
1372 } 1373 }
1373 if (m_tree.currentStackItem()->hasTagName(optgroupTag)) { 1374 if (isHTMLOptGroupElement(m_tree.currentStackItem()->node())) {
1374 AtomicHTMLToken endOptgroup(HTMLToken::EndTag, optgroupTag.local Name()); 1375 AtomicHTMLToken endOptgroup(HTMLToken::EndTag, optgroupTag.local Name());
1375 processEndTag(&endOptgroup); 1376 processEndTag(&endOptgroup);
1376 } 1377 }
1377 m_tree.insertHTMLElement(token); 1378 m_tree.insertHTMLElement(token);
1378 return; 1379 return;
1379 } 1380 }
1380 if (token->name() == selectTag) { 1381 if (token->name() == selectTag) {
1381 parseError(token); 1382 parseError(token);
1382 AtomicHTMLToken endSelect(HTMLToken::EndTag, selectTag.localName()); 1383 AtomicHTMLToken endSelect(HTMLToken::EndTag, selectTag.localName());
1383 processEndTag(&endSelect); 1384 processEndTag(&endSelect);
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 AtomicHTMLToken endSelect(HTMLToken::EndTag, selectTag.localName ()); 2169 AtomicHTMLToken endSelect(HTMLToken::EndTag, selectTag.localName ());
2169 processEndTag(&endSelect); 2170 processEndTag(&endSelect);
2170 processEndTag(token); 2171 processEndTag(token);
2171 } 2172 }
2172 return; 2173 return;
2173 } 2174 }
2174 // Fall through. 2175 // Fall through.
2175 case InSelectMode: 2176 case InSelectMode:
2176 ASSERT(insertionMode() == InSelectMode || insertionMode() == InSelectInT ableMode); 2177 ASSERT(insertionMode() == InSelectMode || insertionMode() == InSelectInT ableMode);
2177 if (token->name() == optgroupTag) { 2178 if (token->name() == optgroupTag) {
2178 if (m_tree.currentStackItem()->hasTagName(optionTag) && m_tree.oneBe lowTop() && m_tree.oneBelowTop()->hasTagName(optgroupTag)) 2179 if (m_tree.currentStackItem()->hasTagName(optionTag) && m_tree.oneBe lowTop() && isHTMLOptGroupElement(m_tree.oneBelowTop()->node()))
2179 processFakeEndTag(optionTag); 2180 processFakeEndTag(optionTag);
2180 if (m_tree.currentStackItem()->hasTagName(optgroupTag)) { 2181 if (isHTMLOptGroupElement(m_tree.currentStackItem()->node())) {
2181 m_tree.openElements()->pop(); 2182 m_tree.openElements()->pop();
2182 return; 2183 return;
2183 } 2184 }
2184 parseError(token); 2185 parseError(token);
2185 return; 2186 return;
2186 } 2187 }
2187 if (token->name() == optionTag) { 2188 if (token->name() == optionTag) {
2188 if (m_tree.currentStackItem()->hasTagName(optionTag)) { 2189 if (m_tree.currentStackItem()->hasTagName(optionTag)) {
2189 m_tree.openElements()->pop(); 2190 m_tree.openElements()->pop();
2190 return; 2191 return;
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2806 ASSERT(m_isAttached); 2807 ASSERT(m_isAttached);
2807 // Warning, this may detach the parser. Do not do anything else after this. 2808 // Warning, this may detach the parser. Do not do anything else after this.
2808 m_tree.finishedParsing(); 2809 m_tree.finishedParsing();
2809 } 2810 }
2810 2811
2811 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) 2812 void HTMLTreeBuilder::parseError(AtomicHTMLToken*)
2812 { 2813 {
2813 } 2814 }
2814 2815
2815 } 2816 }
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLElementStack.cpp ('k') | Source/core/rendering/RenderListBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698