OLD | NEW |
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 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 120 } |
121 | 121 |
122 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableRowElement::insertCell(ExceptionSta
te& exceptionState) | 122 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableRowElement::insertCell(ExceptionSta
te& exceptionState) |
123 { | 123 { |
124 // The default 'index' argument value is -1. | 124 // The default 'index' argument value is -1. |
125 return insertCell(-1, exceptionState); | 125 return insertCell(-1, exceptionState); |
126 } | 126 } |
127 | 127 |
128 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, E
xceptionState& exceptionState) | 128 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableRowElement::insertCell(int index, E
xceptionState& exceptionState) |
129 { | 129 { |
130 RefPtr<HTMLCollection> children = cells(); | 130 RefPtrWillBeRawPtr<HTMLCollection> children = cells(); |
131 int numCells = children ? children->length() : 0; | 131 int numCells = children ? children->length() : 0; |
132 if (index < -1 || index > numCells) { | 132 if (index < -1 || index > numCells) { |
133 exceptionState.throwDOMException(IndexSizeError, "The value provided ("
+ String::number(index) + ") is outside the range [-1, " + String::number(numCel
ls) + "]."); | 133 exceptionState.throwDOMException(IndexSizeError, "The value provided ("
+ String::number(index) + ") is outside the range [-1, " + String::number(numCel
ls) + "]."); |
134 return nullptr; | 134 return nullptr; |
135 } | 135 } |
136 | 136 |
137 RefPtrWillBeRawPtr<HTMLTableCellElement> cell = HTMLTableCellElement::create
(tdTag, document()); | 137 RefPtrWillBeRawPtr<HTMLTableCellElement> cell = HTMLTableCellElement::create
(tdTag, document()); |
138 if (numCells == index || index == -1) | 138 if (numCells == index || index == -1) |
139 appendChild(cell, exceptionState); | 139 appendChild(cell, exceptionState); |
140 else | 140 else |
141 insertBefore(cell, children->item(index), exceptionState); | 141 insertBefore(cell, children->item(index), exceptionState); |
142 return cell.release(); | 142 return cell.release(); |
143 } | 143 } |
144 | 144 |
145 void HTMLTableRowElement::deleteCell(int index, ExceptionState& exceptionState) | 145 void HTMLTableRowElement::deleteCell(int index, ExceptionState& exceptionState) |
146 { | 146 { |
147 RefPtr<HTMLCollection> children = cells(); | 147 RefPtrWillBeRawPtr<HTMLCollection> children = cells(); |
148 int numCells = children ? children->length() : 0; | 148 int numCells = children ? children->length() : 0; |
149 if (index == -1) | 149 if (index == -1) |
150 index = numCells-1; | 150 index = numCells-1; |
151 if (index >= 0 && index < numCells) { | 151 if (index >= 0 && index < numCells) { |
152 RefPtrWillBeRawPtr<Element> cell = children->item(index); | 152 RefPtrWillBeRawPtr<Element> cell = children->item(index); |
153 HTMLElement::removeChild(cell.get(), exceptionState); | 153 HTMLElement::removeChild(cell.get(), exceptionState); |
154 } else { | 154 } else { |
155 exceptionState.throwDOMException(IndexSizeError, "The value provided ("
+ String::number(index) + ") is outside the range [0, " + String::number(numCell
s) + ")."); | 155 exceptionState.throwDOMException(IndexSizeError, "The value provided ("
+ String::number(index) + ") is outside the range [0, " + String::number(numCell
s) + ")."); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 PassRefPtr<HTMLCollection> HTMLTableRowElement::cells() | 159 PassRefPtrWillBeRawPtr<HTMLCollection> HTMLTableRowElement::cells() |
160 { | 160 { |
161 return ensureCachedHTMLCollection(TRCells); | 161 return ensureCachedHTMLCollection(TRCells); |
162 } | 162 } |
163 | 163 |
164 } | 164 } |
OLD | NEW |