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

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

Issue 1486843002: Sync the HTMLTableElement return types with the spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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) 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 HTMLElement* child; 111 HTMLElement* child;
112 for (child = Traversal<HTMLElement>::firstChild(*this); child; child = Trave rsal<HTMLElement>::nextSibling(*child)) { 112 for (child = Traversal<HTMLElement>::firstChild(*this); child; child = Trave rsal<HTMLElement>::nextSibling(*child)) {
113 if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag) && !child->hasTagName(theadTag)) 113 if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag) && !child->hasTagName(theadTag))
114 break; 114 break;
115 } 115 }
116 116
117 insertBefore(newFoot, child, exceptionState); 117 insertBefore(newFoot, child, exceptionState);
118 } 118 }
119 119
120 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableElement::createTHead() 120 PassRefPtrWillBeRawPtr<HTMLTableSectionElement> HTMLTableElement::createTHead()
121 { 121 {
122 if (HTMLTableSectionElement* existingHead = tHead()) 122 if (HTMLTableSectionElement* existingHead = tHead())
123 return existingHead; 123 return existingHead;
124 RefPtrWillBeRawPtr<HTMLTableSectionElement> head = HTMLTableSectionElement:: create(theadTag, document()); 124 RefPtrWillBeRawPtr<HTMLTableSectionElement> head = HTMLTableSectionElement:: create(theadTag, document());
125 setTHead(head, IGNORE_EXCEPTION); 125 setTHead(head, IGNORE_EXCEPTION);
126 return head.release(); 126 return head.release();
127 } 127 }
128 128
129 void HTMLTableElement::deleteTHead() 129 void HTMLTableElement::deleteTHead()
130 { 130 {
131 removeChild(tHead(), IGNORE_EXCEPTION); 131 removeChild(tHead(), IGNORE_EXCEPTION);
132 } 132 }
133 133
134 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableElement::createTFoot() 134 PassRefPtrWillBeRawPtr<HTMLTableSectionElement> HTMLTableElement::createTFoot()
135 { 135 {
136 if (HTMLTableSectionElement* existingFoot = tFoot()) 136 if (HTMLTableSectionElement* existingFoot = tFoot())
137 return existingFoot; 137 return existingFoot;
138 RefPtrWillBeRawPtr<HTMLTableSectionElement> foot = HTMLTableSectionElement:: create(tfootTag, document()); 138 RefPtrWillBeRawPtr<HTMLTableSectionElement> foot = HTMLTableSectionElement:: create(tfootTag, document());
139 setTFoot(foot, IGNORE_EXCEPTION); 139 setTFoot(foot, IGNORE_EXCEPTION);
140 return foot.release(); 140 return foot.release();
141 } 141 }
142 142
143 void HTMLTableElement::deleteTFoot() 143 void HTMLTableElement::deleteTFoot()
144 { 144 {
145 removeChild(tFoot(), IGNORE_EXCEPTION); 145 removeChild(tFoot(), IGNORE_EXCEPTION);
146 } 146 }
147 147
148 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableElement::createTBody() 148 PassRefPtrWillBeRawPtr<HTMLTableSectionElement> HTMLTableElement::createTBody()
149 { 149 {
150 RefPtrWillBeRawPtr<HTMLTableSectionElement> body = HTMLTableSectionElement:: create(tbodyTag, document()); 150 RefPtrWillBeRawPtr<HTMLTableSectionElement> body = HTMLTableSectionElement:: create(tbodyTag, document());
151 Node* referenceElement = lastBody() ? lastBody()->nextSibling() : 0; 151 Node* referenceElement = lastBody() ? lastBody()->nextSibling() : 0;
152 152
153 insertBefore(body, referenceElement); 153 insertBefore(body, referenceElement);
154 return body.release(); 154 return body.release();
155 } 155 }
156 156
157 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableElement::createCaption() 157 PassRefPtrWillBeRawPtr<HTMLTableCaptionElement> HTMLTableElement::createCaption( )
158 { 158 {
159 if (HTMLTableCaptionElement* existingCaption = caption()) 159 if (HTMLTableCaptionElement* existingCaption = caption())
160 return existingCaption; 160 return existingCaption;
161 RefPtrWillBeRawPtr<HTMLTableCaptionElement> caption = HTMLTableCaptionElemen t::create(document()); 161 RefPtrWillBeRawPtr<HTMLTableCaptionElement> caption = HTMLTableCaptionElemen t::create(document());
162 setCaption(caption, IGNORE_EXCEPTION); 162 setCaption(caption, IGNORE_EXCEPTION);
163 return caption.release(); 163 return caption.release();
164 } 164 }
165 165
166 void HTMLTableElement::deleteCaption() 166 void HTMLTableElement::deleteCaption()
167 { 167 {
168 removeChild(caption(), IGNORE_EXCEPTION); 168 removeChild(caption(), IGNORE_EXCEPTION);
169 } 169 }
170 170
171 HTMLTableSectionElement* HTMLTableElement::lastBody() const 171 HTMLTableSectionElement* HTMLTableElement::lastBody() const
172 { 172 {
173 return toHTMLTableSectionElement(Traversal<HTMLElement>::lastChild(*this, Ha sHTMLTagName(tbodyTag))); 173 return toHTMLTableSectionElement(Traversal<HTMLElement>::lastChild(*this, Ha sHTMLTagName(tbodyTag)));
174 } 174 }
175 175
176 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableElement::insertRow(int index, Excep tionState& exceptionState) 176 PassRefPtrWillBeRawPtr<HTMLTableRowElement> HTMLTableElement::insertRow(int inde x, ExceptionState& exceptionState)
177 { 177 {
178 if (index < -1) { 178 if (index < -1) {
179 exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is less than -1."); 179 exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is less than -1.");
180 return nullptr; 180 return nullptr;
181 } 181 }
182 182
183 RefPtrWillBeRawPtr<Node> protectFromMutationEvents(this); 183 RefPtrWillBeRawPtr<Node> protectFromMutationEvents(this);
184 184
185 RefPtrWillBeRawPtr<HTMLTableRowElement> lastRow = nullptr; 185 RefPtrWillBeRawPtr<HTMLTableRowElement> lastRow = nullptr;
186 RefPtrWillBeRawPtr<HTMLTableRowElement> row = nullptr; 186 RefPtrWillBeRawPtr<HTMLTableRowElement> row = nullptr;
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 return getAttribute(summaryAttr); 559 return getAttribute(summaryAttr);
560 } 560 }
561 561
562 DEFINE_TRACE(HTMLTableElement) 562 DEFINE_TRACE(HTMLTableElement)
563 { 563 {
564 visitor->trace(m_sharedCellStyle); 564 visitor->trace(m_sharedCellStyle);
565 HTMLElement::trace(visitor); 565 HTMLElement::trace(visitor);
566 } 566 }
567 567
568 } 568 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTableElement.h ('k') | third_party/WebKit/Source/core/html/HTMLTableElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698