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

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

Issue 99083002: WIP: Migrate generated bindings to new ExceptionState constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Created 7 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
« no previous file with comments | « Source/core/html/HTMLProgressElement.cpp ('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 10 matching lines...) Expand all
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA. 22 * Boston, MA 02110-1301, USA.
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 #include "core/html/HTMLTableElement.h" 26 #include "core/html/HTMLTableElement.h"
27 27
28 #include "CSSPropertyNames.h" 28 #include "CSSPropertyNames.h"
29 #include "CSSValueKeywords.h" 29 #include "CSSValueKeywords.h"
30 #include "HTMLNames.h" 30 #include "HTMLNames.h"
31 #include "bindings/v8/ExceptionMessages.h"
32 #include "bindings/v8/ExceptionState.h" 31 #include "bindings/v8/ExceptionState.h"
33 #include "bindings/v8/ExceptionStatePlaceholder.h" 32 #include "bindings/v8/ExceptionStatePlaceholder.h"
34 #include "core/css/CSSImageValue.h" 33 #include "core/css/CSSImageValue.h"
35 #include "core/css/CSSValuePool.h" 34 #include "core/css/CSSValuePool.h"
36 #include "core/css/StylePropertySet.h" 35 #include "core/css/StylePropertySet.h"
37 #include "core/dom/Attribute.h" 36 #include "core/dom/Attribute.h"
38 #include "core/dom/ExceptionCode.h" 37 #include "core/dom/ExceptionCode.h"
39 #include "core/html/HTMLTableCaptionElement.h" 38 #include "core/html/HTMLTableCaptionElement.h"
40 #include "core/html/HTMLTableRowElement.h" 39 #include "core/html/HTMLTableRowElement.h"
41 #include "core/html/HTMLTableRowsCollection.h" 40 #include "core/html/HTMLTableRowsCollection.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 for (Node* child = lastChild(); child; child = child->previousSibling()) { 176 for (Node* child = lastChild(); child; child = child->previousSibling()) {
178 if (child->hasTagName(tbodyTag)) 177 if (child->hasTagName(tbodyTag))
179 return toHTMLTableSectionElement(child); 178 return toHTMLTableSectionElement(child);
180 } 179 }
181 return 0; 180 return 0;
182 } 181 }
183 182
184 PassRefPtr<HTMLElement> HTMLTableElement::insertRow(int index, ExceptionState& e xceptionState) 183 PassRefPtr<HTMLElement> HTMLTableElement::insertRow(int index, ExceptionState& e xceptionState)
185 { 184 {
186 if (index < -1) { 185 if (index < -1) {
187 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::fail edToExecute("insertRow", "HTMLTableElement", "The index provided (" + String::nu mber(index) + ") is less than -1.")); 186 exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is less than -1.");
188 return 0; 187 return 0;
189 } 188 }
190 189
191 RefPtr<Node> protectFromMutationEvents(this); 190 RefPtr<Node> protectFromMutationEvents(this);
192 191
193 RefPtr<HTMLTableRowElement> lastRow = 0; 192 RefPtr<HTMLTableRowElement> lastRow = 0;
194 RefPtr<HTMLTableRowElement> row = 0; 193 RefPtr<HTMLTableRowElement> row = 0;
195 if (index == -1) 194 if (index == -1)
196 lastRow = HTMLTableRowsCollection::lastRow(this); 195 lastRow = HTMLTableRowsCollection::lastRow(this);
197 else { 196 else {
198 for (int i = 0; i <= index; ++i) { 197 for (int i = 0; i <= index; ++i) {
199 row = HTMLTableRowsCollection::rowAfter(this, lastRow.get()); 198 row = HTMLTableRowsCollection::rowAfter(this, lastRow.get());
200 if (!row) { 199 if (!row) {
201 if (i != index) { 200 if (i != index) {
202 exceptionState.throwDOMException(IndexSizeError, ExceptionMe ssages::failedToExecute("insertRow", "HTMLTableElement", "The index provided (" + String::number(index) + ") is greater than the number of rows in the table (" + String::number(i) + ").")); 201 exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is greater than the number of rows in t he table (" + String::number(i) + ").");
203 return 0; 202 return 0;
204 } 203 }
205 break; 204 break;
206 } 205 }
207 lastRow = row; 206 lastRow = row;
208 } 207 }
209 } 208 }
210 209
211 RefPtr<ContainerNode> parent; 210 RefPtr<ContainerNode> parent;
212 if (lastRow) 211 if (lastRow)
(...skipping 10 matching lines...) Expand all
223 } 222 }
224 223
225 RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(document()) ; 224 RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(document()) ;
226 parent->insertBefore(newRow, row.get(), exceptionState); 225 parent->insertBefore(newRow, row.get(), exceptionState);
227 return newRow.release(); 226 return newRow.release();
228 } 227 }
229 228
230 void HTMLTableElement::deleteRow(int index, ExceptionState& exceptionState) 229 void HTMLTableElement::deleteRow(int index, ExceptionState& exceptionState)
231 { 230 {
232 if (index < -1) { 231 if (index < -1) {
233 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::fail edToExecute("deleteRow", "HTMLTableElement", "The index provided (" + String::nu mber(index) + ") is less than -1.")); 232 exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is less than -1.");
234 return; 233 return;
235 } 234 }
236 235
237 HTMLTableRowElement* row = 0; 236 HTMLTableRowElement* row = 0;
238 int i = 0; 237 int i = 0;
239 if (index == -1) 238 if (index == -1)
240 row = HTMLTableRowsCollection::lastRow(this); 239 row = HTMLTableRowsCollection::lastRow(this);
241 else { 240 else {
242 for (i = 0; i <= index; ++i) { 241 for (i = 0; i <= index; ++i) {
243 row = HTMLTableRowsCollection::rowAfter(this, row); 242 row = HTMLTableRowsCollection::rowAfter(this, row);
244 if (!row) 243 if (!row)
245 break; 244 break;
246 } 245 }
247 } 246 }
248 if (!row) { 247 if (!row) {
249 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::fail edToExecute("deleteRow", "HTMLTableElement", "The index provided (" + String::nu mber(index) + ") is greater than the number of rows in the table (" + String::nu mber(i) + ").")); 248 exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is greater than the number of rows in the table (" + String::number(i) + ").");
250 return; 249 return;
251 } 250 }
252 row->remove(exceptionState); 251 row->remove(exceptionState);
253 } 252 }
254 253
255 static inline bool isTableCellAncestor(Node* n) 254 static inline bool isTableCellAncestor(Node* n)
256 { 255 {
257 return n->hasTagName(theadTag) || n->hasTagName(tbodyTag) || 256 return n->hasTagName(theadTag) || n->hasTagName(tbodyTag) ||
258 n->hasTagName(tfootTag) || n->hasTagName(trTag) || 257 n->hasTagName(tfootTag) || n->hasTagName(trTag) ||
259 n->hasTagName(thTag); 258 n->hasTagName(thTag);
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 } 574 }
576 575
577 void HTMLTableElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons t 576 void HTMLTableElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons t
578 { 577 {
579 HTMLElement::addSubresourceAttributeURLs(urls); 578 HTMLElement::addSubresourceAttributeURLs(urls);
580 579
581 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) ); 580 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)) );
582 } 581 }
583 582
584 } 583 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLProgressElement.cpp ('k') | Source/core/html/HTMLTableRowElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698