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

Side by Side Diff: Source/core/html/parser/HTMLElementStack.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
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 14 matching lines...) Expand all
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/html/parser/HTMLElementStack.h" 28 #include "core/html/parser/HTMLElementStack.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 "core/dom/Element.h" 33 #include "core/dom/Element.h"
34 #include "core/html/HTMLOptGroupElement.h" 34 #include "core/html/HTMLOptGroupElement.h"
35 #include "core/html/HTMLTableElement.h"
35 #include <wtf/PassOwnPtr.h> 36 #include <wtf/PassOwnPtr.h>
36 37
37 namespace WebCore { 38 namespace WebCore {
38 39
39 using namespace HTMLNames; 40 using namespace HTMLNames;
40 41
41 42
42 namespace { 43 namespace {
43 44
44 inline bool isRootNode(HTMLStackItem* item) 45 inline bool isRootNode(HTMLStackItem* item)
45 { 46 {
46 return item->isDocumentFragmentNode() 47 return item->isDocumentFragmentNode()
47 || item->hasTagName(htmlTag); 48 || item->hasTagName(htmlTag);
48 } 49 }
49 50
50 inline bool isScopeMarker(HTMLStackItem* item) 51 inline bool isScopeMarker(HTMLStackItem* item)
51 { 52 {
52 return item->hasTagName(appletTag) 53 return item->hasTagName(appletTag)
53 || item->hasTagName(captionTag) 54 || item->hasTagName(captionTag)
54 || item->hasTagName(marqueeTag) 55 || item->hasTagName(marqueeTag)
55 || item->hasTagName(objectTag) 56 || item->hasTagName(objectTag)
56 || item->hasTagName(tableTag) 57 || isHTMLTableElement(item->node())
57 || item->hasTagName(tdTag) 58 || item->hasTagName(tdTag)
58 || item->hasTagName(thTag) 59 || item->hasTagName(thTag)
59 || item->hasTagName(MathMLNames::miTag) 60 || item->hasTagName(MathMLNames::miTag)
60 || item->hasTagName(MathMLNames::moTag) 61 || item->hasTagName(MathMLNames::moTag)
61 || item->hasTagName(MathMLNames::mnTag) 62 || item->hasTagName(MathMLNames::mnTag)
62 || item->hasTagName(MathMLNames::msTag) 63 || item->hasTagName(MathMLNames::msTag)
63 || item->hasTagName(MathMLNames::mtextTag) 64 || item->hasTagName(MathMLNames::mtextTag)
64 || item->hasTagName(MathMLNames::annotation_xmlTag) 65 || item->hasTagName(MathMLNames::annotation_xmlTag)
65 || item->hasTagName(SVGNames::foreignObjectTag) 66 || item->hasTagName(SVGNames::foreignObjectTag)
66 || item->hasTagName(SVGNames::descTag) 67 || item->hasTagName(SVGNames::descTag)
67 || item->hasTagName(SVGNames::titleTag) 68 || item->hasTagName(SVGNames::titleTag)
68 || item->hasTagName(templateTag) 69 || item->hasTagName(templateTag)
69 || isRootNode(item); 70 || isRootNode(item);
70 } 71 }
71 72
72 inline bool isListItemScopeMarker(HTMLStackItem* item) 73 inline bool isListItemScopeMarker(HTMLStackItem* item)
73 { 74 {
74 return isScopeMarker(item) 75 return isScopeMarker(item)
75 || item->hasTagName(olTag) 76 || item->hasTagName(olTag)
76 || item->hasTagName(ulTag); 77 || item->hasTagName(ulTag);
77 } 78 }
78 79
79 inline bool isTableScopeMarker(HTMLStackItem* item) 80 inline bool isTableScopeMarker(HTMLStackItem* item)
80 { 81 {
81 return item->hasTagName(tableTag) 82 return isHTMLTableElement(item->node())
82 || item->hasTagName(templateTag) 83 || item->hasTagName(templateTag)
83 || isRootNode(item); 84 || isRootNode(item);
84 } 85 }
85 86
86 inline bool isTableBodyScopeMarker(HTMLStackItem* item) 87 inline bool isTableBodyScopeMarker(HTMLStackItem* item)
87 { 88 {
88 return item->hasTagName(tbodyTag) 89 return item->hasTagName(tbodyTag)
89 || item->hasTagName(tfootTag) 90 || item->hasTagName(tfootTag)
90 || item->hasTagName(theadTag) 91 || item->hasTagName(theadTag)
91 || item->hasTagName(templateTag) 92 || item->hasTagName(templateTag)
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 610
610 void HTMLElementStack::show() 611 void HTMLElementStack::show()
611 { 612 {
612 for (ElementRecord* record = m_top.get(); record; record = record->next()) 613 for (ElementRecord* record = m_top.get(); record; record = record->next())
613 record->element()->showNode(); 614 record->element()->showNode();
614 } 615 }
615 616
616 #endif 617 #endif
617 618
618 } 619 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTableRowsCollection.cpp ('k') | Source/core/html/parser/HTMLTreeBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698