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

Side by Side Diff: Source/core/html/HTMLTableElement.cpp

Issue 412033004: Use Traversal<>::firstChild() instead of firstWithin() when iterating over children (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/ParentNode.h ('k') | Source/core/html/HTMLTableRowElement.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) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010, 2011 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010, 2011 Apple Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 void HTMLTableElement::setCaption(PassRefPtrWillBeRawPtr<HTMLTableCaptionElement > newCaption, ExceptionState& exceptionState) 72 void HTMLTableElement::setCaption(PassRefPtrWillBeRawPtr<HTMLTableCaptionElement > newCaption, ExceptionState& exceptionState)
73 { 73 {
74 deleteCaption(); 74 deleteCaption();
75 insertBefore(newCaption, firstChild(), exceptionState); 75 insertBefore(newCaption, firstChild(), exceptionState);
76 } 76 }
77 77
78 HTMLTableSectionElement* HTMLTableElement::tHead() const 78 HTMLTableSectionElement* HTMLTableElement::tHead() const
79 { 79 {
80 for (HTMLElement* child = Traversal<HTMLElement>::firstWithin(*this); child; child = Traversal<HTMLElement>::nextSibling(*child)) { 80 for (HTMLElement* child = Traversal<HTMLElement>::firstChild(*this); child; child = Traversal<HTMLElement>::nextSibling(*child)) {
81 if (child->hasTagName(theadTag)) 81 if (child->hasTagName(theadTag))
82 return toHTMLTableSectionElement(child); 82 return toHTMLTableSectionElement(child);
83 } 83 }
84 return 0; 84 return 0;
85 } 85 }
86 86
87 void HTMLTableElement::setTHead(PassRefPtrWillBeRawPtr<HTMLTableSectionElement> newHead, ExceptionState& exceptionState) 87 void HTMLTableElement::setTHead(PassRefPtrWillBeRawPtr<HTMLTableSectionElement> newHead, ExceptionState& exceptionState)
88 { 88 {
89 deleteTHead(); 89 deleteTHead();
90 90
91 HTMLElement* child; 91 HTMLElement* child;
92 for (child = Traversal<HTMLElement>::firstWithin(*this); child; child = Trav ersal<HTMLElement>::nextSibling(*child)) { 92 for (child = Traversal<HTMLElement>::firstChild(*this); child; child = Trave rsal<HTMLElement>::nextSibling(*child)) {
93 if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag)) 93 if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag))
94 break; 94 break;
95 } 95 }
96 96
97 insertBefore(newHead, child, exceptionState); 97 insertBefore(newHead, child, exceptionState);
98 } 98 }
99 99
100 HTMLTableSectionElement* HTMLTableElement::tFoot() const 100 HTMLTableSectionElement* HTMLTableElement::tFoot() const
101 { 101 {
102 for (HTMLElement* child = Traversal<HTMLElement>::firstWithin(*this); child; child = Traversal<HTMLElement>::nextSibling(*child)) { 102 for (HTMLElement* child = Traversal<HTMLElement>::firstChild(*this); child; child = Traversal<HTMLElement>::nextSibling(*child)) {
103 if (child->hasTagName(tfootTag)) 103 if (child->hasTagName(tfootTag))
104 return toHTMLTableSectionElement(child); 104 return toHTMLTableSectionElement(child);
105 } 105 }
106 return 0; 106 return 0;
107 } 107 }
108 108
109 void HTMLTableElement::setTFoot(PassRefPtrWillBeRawPtr<HTMLTableSectionElement> newFoot, ExceptionState& exceptionState) 109 void HTMLTableElement::setTFoot(PassRefPtrWillBeRawPtr<HTMLTableSectionElement> newFoot, ExceptionState& exceptionState)
110 { 110 {
111 deleteTFoot(); 111 deleteTFoot();
112 112
113 HTMLElement* child; 113 HTMLElement* child;
114 for (child = Traversal<HTMLElement>::firstWithin(*this); child; child = Trav ersal<HTMLElement>::nextSibling(*child)) { 114 for (child = Traversal<HTMLElement>::firstChild(*this); child; child = Trave rsal<HTMLElement>::nextSibling(*child)) {
115 if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag) && !child->hasTagName(theadTag)) 115 if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag) && !child->hasTagName(theadTag))
116 break; 116 break;
117 } 117 }
118 118
119 insertBefore(newFoot, child, exceptionState); 119 insertBefore(newFoot, child, exceptionState);
120 } 120 }
121 121
122 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableElement::createTHead() 122 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableElement::createTHead()
123 { 123 {
124 if (HTMLTableSectionElement* existingHead = tHead()) 124 if (HTMLTableSectionElement* existingHead = tHead())
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 return getAttribute(summaryAttr); 576 return getAttribute(summaryAttr);
577 } 577 }
578 578
579 void HTMLTableElement::trace(Visitor* visitor) 579 void HTMLTableElement::trace(Visitor* visitor)
580 { 580 {
581 visitor->trace(m_sharedCellStyle); 581 visitor->trace(m_sharedCellStyle);
582 HTMLElement::trace(visitor); 582 HTMLElement::trace(visitor);
583 } 583 }
584 584
585 } 585 }
OLDNEW
« no previous file with comments | « Source/core/dom/ParentNode.h ('k') | Source/core/html/HTMLTableRowElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698