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

Side by Side Diff: Source/core/html/HTMLTableRowElement.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/HTMLTableElement.cpp ('k') | Source/core/html/HTMLTextAreaElement.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, 2007, 2010 Apple Inc. All rights reserv ed. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserv ed.
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
11 * License as published by the Free Software Foundation; either 11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version. 12 * version 2 of the License, or (at your option) any later version.
13 * 13 *
14 * This library is distributed in the hope that it will be useful, 14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details. 17 * Library General Public License for more details.
18 * 18 *
19 * You should have received a copy of the GNU Library General Public License 19 * You should have received a copy of the GNU Library General Public License
20 * along with this library; see the file COPYING.LIB. If not, write to 20 * along with this library; see the file COPYING.LIB. If not, write to
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/HTMLTableRowElement.h" 26 #include "core/html/HTMLTableRowElement.h"
27 27
28 #include "HTMLNames.h" 28 #include "HTMLNames.h"
29 #include "bindings/v8/ExceptionMessages.h"
30 #include "bindings/v8/ExceptionState.h" 29 #include "bindings/v8/ExceptionState.h"
31 #include "core/dom/ExceptionCode.h" 30 #include "core/dom/ExceptionCode.h"
32 #include "core/html/HTMLCollection.h" 31 #include "core/html/HTMLCollection.h"
33 #include "core/html/HTMLTableCellElement.h" 32 #include "core/html/HTMLTableCellElement.h"
34 #include "core/html/HTMLTableElement.h" 33 #include "core/html/HTMLTableElement.h"
35 #include "core/html/HTMLTableSectionElement.h" 34 #include "core/html/HTMLTableSectionElement.h"
36 35
37 namespace WebCore { 36 namespace WebCore {
38 37
39 using namespace HTMLNames; 38 using namespace HTMLNames;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 while (n); 110 while (n);
112 111
113 return rIndex; 112 return rIndex;
114 } 113 }
115 114
116 PassRefPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, ExceptionStat e& exceptionState) 115 PassRefPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, ExceptionStat e& exceptionState)
117 { 116 {
118 RefPtr<HTMLCollection> children = cells(); 117 RefPtr<HTMLCollection> children = cells();
119 int numCells = children ? children->length() : 0; 118 int numCells = children ? children->length() : 0;
120 if (index < -1 || index > numCells) { 119 if (index < -1 || index > numCells) {
121 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::fail edToExecute("insertCell", "HTMLTableRowElement", "The value provided (" + String ::number(index) + ") is outside the range [-1, " + String::number(numCells) + "] .")); 120 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(index) + ") is outside the range [-1, " + String::number(numCel ls) + "].");
122 return 0; 121 return 0;
123 } 122 }
124 123
125 RefPtr<HTMLTableCellElement> cell = HTMLTableCellElement::create(tdTag, docu ment()); 124 RefPtr<HTMLTableCellElement> cell = HTMLTableCellElement::create(tdTag, docu ment());
126 if (index < 0 || index >= numCells) 125 if (index < 0 || index >= numCells)
127 appendChild(cell, exceptionState); 126 appendChild(cell, exceptionState);
128 else { 127 else {
129 Node* n; 128 Node* n;
130 if (index < 1) 129 if (index < 1)
131 n = firstChild(); 130 n = firstChild();
132 else 131 else
133 n = children->item(index); 132 n = children->item(index);
134 insertBefore(cell, n, exceptionState); 133 insertBefore(cell, n, exceptionState);
135 } 134 }
136 return cell.release(); 135 return cell.release();
137 } 136 }
138 137
139 void HTMLTableRowElement::deleteCell(int index, ExceptionState& exceptionState) 138 void HTMLTableRowElement::deleteCell(int index, ExceptionState& exceptionState)
140 { 139 {
141 RefPtr<HTMLCollection> children = cells(); 140 RefPtr<HTMLCollection> children = cells();
142 int numCells = children ? children->length() : 0; 141 int numCells = children ? children->length() : 0;
143 if (index == -1) 142 if (index == -1)
144 index = numCells-1; 143 index = numCells-1;
145 if (index >= 0 && index < numCells) { 144 if (index >= 0 && index < numCells) {
146 RefPtr<Node> cell = children->item(index); 145 RefPtr<Node> cell = children->item(index);
147 HTMLElement::removeChild(cell.get(), exceptionState); 146 HTMLElement::removeChild(cell.get(), exceptionState);
148 } else { 147 } else {
149 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::fail edToExecute("deleteCell", "HTMLTableRowElement", "The value provided (" + String ::number(index) + ") is outside the range [0, " + String::number(numCells) + "). ")); 148 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(index) + ") is outside the range [0, " + String::number(numCell s) + ").");
150 } 149 }
151 } 150 }
152 151
153 PassRefPtr<HTMLCollection> HTMLTableRowElement::cells() 152 PassRefPtr<HTMLCollection> HTMLTableRowElement::cells()
154 { 153 {
155 return ensureCachedHTMLCollection(TRCells); 154 return ensureCachedHTMLCollection(TRCells);
156 } 155 }
157 156
158 } 157 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTableElement.cpp ('k') | Source/core/html/HTMLTextAreaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698