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

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

Issue 18313005: Introduce isHTMLTableElement and toHTMLTableElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Retry 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/RenderObject.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 18 matching lines...) Expand all
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/HTMLOptGroupElement.h"
39 #include "core/html/HTMLTableElement.h"
39 #include "core/html/parser/AtomicHTMLToken.h" 40 #include "core/html/parser/AtomicHTMLToken.h"
40 #include "core/html/parser/HTMLDocumentParser.h" 41 #include "core/html/parser/HTMLDocumentParser.h"
41 #include "core/html/parser/HTMLParserIdioms.h" 42 #include "core/html/parser/HTMLParserIdioms.h"
42 #include "core/html/parser/HTMLStackItem.h" 43 #include "core/html/parser/HTMLStackItem.h"
43 #include "core/html/parser/HTMLToken.h" 44 #include "core/html/parser/HTMLToken.h"
44 #include "core/html/parser/HTMLTokenizer.h" 45 #include "core/html/parser/HTMLTokenizer.h"
45 #include "core/platform/LocalizedStrings.h" 46 #include "core/platform/LocalizedStrings.h"
46 #include "core/platform/NotImplemented.h" 47 #include "core/platform/NotImplemented.h"
47 #include "wtf/MainThread.h" 48 #include "wtf/MainThread.h"
48 #include "wtf/unicode/CharacterNames.h" 49 #include "wtf/unicode/CharacterNames.h"
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 return setInsertionMode(InCellMode); 1614 return setInsertionMode(InCellMode);
1614 if (item->hasTagName(trTag)) 1615 if (item->hasTagName(trTag))
1615 return setInsertionMode(InRowMode); 1616 return setInsertionMode(InRowMode);
1616 if (item->hasTagName(tbodyTag) || item->hasTagName(theadTag) || item->ha sTagName(tfootTag)) 1617 if (item->hasTagName(tbodyTag) || item->hasTagName(theadTag) || item->ha sTagName(tfootTag))
1617 return setInsertionMode(InTableBodyMode); 1618 return setInsertionMode(InTableBodyMode);
1618 if (item->hasTagName(captionTag)) 1619 if (item->hasTagName(captionTag))
1619 return setInsertionMode(InCaptionMode); 1620 return setInsertionMode(InCaptionMode);
1620 if (item->hasTagName(colgroupTag)) { 1621 if (item->hasTagName(colgroupTag)) {
1621 return setInsertionMode(InColumnGroupMode); 1622 return setInsertionMode(InColumnGroupMode);
1622 } 1623 }
1623 if (item->hasTagName(tableTag)) 1624 if (isHTMLTableElement(item->node()))
1624 return setInsertionMode(InTableMode); 1625 return setInsertionMode(InTableMode);
1625 if (item->hasTagName(headTag)) { 1626 if (item->hasTagName(headTag)) {
1626 if (!m_fragmentContext.fragment() || m_fragmentContext.contextElemen t() != item->node()) 1627 if (!m_fragmentContext.fragment() || m_fragmentContext.contextElemen t() != item->node())
1627 return setInsertionMode(InHeadMode); 1628 return setInsertionMode(InHeadMode);
1628 return setInsertionMode(InBodyMode); 1629 return setInsertionMode(InBodyMode);
1629 } 1630 }
1630 if (item->hasTagName(bodyTag)) 1631 if (item->hasTagName(bodyTag))
1631 return setInsertionMode(InBodyMode); 1632 return setInsertionMode(InBodyMode);
1632 if (item->hasTagName(framesetTag)) { 1633 if (item->hasTagName(framesetTag)) {
1633 return setInsertionMode(InFramesetMode); 1634 return setInsertionMode(InFramesetMode);
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 ASSERT(insertionMode() == InBodyMode || insertionMode() == InCaptionMode || insertionMode() == InCellMode || insertionMode() == TemplateContentsMode); 2324 ASSERT(insertionMode() == InBodyMode || insertionMode() == InCaptionMode || insertionMode() == InCellMode || insertionMode() == TemplateContentsMode);
2324 processCharacterBufferForInBody(buffer); 2325 processCharacterBufferForInBody(buffer);
2325 break; 2326 break;
2326 } 2327 }
2327 case InTableMode: 2328 case InTableMode:
2328 case InTableBodyMode: 2329 case InTableBodyMode:
2329 case InRowMode: { 2330 case InRowMode: {
2330 ASSERT(insertionMode() == InTableMode || insertionMode() == InTableBodyM ode || insertionMode() == InRowMode); 2331 ASSERT(insertionMode() == InTableMode || insertionMode() == InTableBodyM ode || insertionMode() == InRowMode);
2331 ASSERT(m_pendingTableCharacters.isEmpty()); 2332 ASSERT(m_pendingTableCharacters.isEmpty());
2332 if (m_tree.currentStackItem()->isElementNode() 2333 if (m_tree.currentStackItem()->isElementNode()
2333 && (m_tree.currentStackItem()->hasTagName(HTMLNames::tableTag) 2334 && (isHTMLTableElement(m_tree.currentStackItem()->node())
2334 || m_tree.currentStackItem()->hasTagName(HTMLNames::tbodyTag) 2335 || m_tree.currentStackItem()->hasTagName(HTMLNames::tbodyTag)
2335 || m_tree.currentStackItem()->hasTagName(HTMLNames::tfootTag) 2336 || m_tree.currentStackItem()->hasTagName(HTMLNames::tfootTag)
2336 || m_tree.currentStackItem()->hasTagName(HTMLNames::theadTag) 2337 || m_tree.currentStackItem()->hasTagName(HTMLNames::theadTag)
2337 || m_tree.currentStackItem()->hasTagName(HTMLNames::trTag))) { 2338 || m_tree.currentStackItem()->hasTagName(HTMLNames::trTag))) {
2338 m_originalInsertionMode = m_insertionMode; 2339 m_originalInsertionMode = m_insertionMode;
2339 setInsertionMode(InTableTextMode); 2340 setInsertionMode(InTableTextMode);
2340 // Note that we fall through to the InTableTextMode case below. 2341 // Note that we fall through to the InTableTextMode case below.
2341 } else { 2342 } else {
2342 HTMLConstructionSite::RedirectToFosterParentGuard redirecter(m_tree) ; 2343 HTMLConstructionSite::RedirectToFosterParentGuard redirecter(m_tree) ;
2343 processCharacterBufferForInBody(buffer); 2344 processCharacterBufferForInBody(buffer);
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2807 ASSERT(m_isAttached); 2808 ASSERT(m_isAttached);
2808 // Warning, this may detach the parser. Do not do anything else after this. 2809 // Warning, this may detach the parser. Do not do anything else after this.
2809 m_tree.finishedParsing(); 2810 m_tree.finishedParsing();
2810 } 2811 }
2811 2812
2812 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) 2813 void HTMLTreeBuilder::parseError(AtomicHTMLToken*)
2813 { 2814 {
2814 } 2815 }
2815 2816
2816 } 2817 }
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLElementStack.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698