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 | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights |
8 * reserved. | 8 * reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 appendChild(cell, exceptionState); | 103 appendChild(cell, exceptionState); |
104 else | 104 else |
105 insertBefore(cell, children->item(index), exceptionState); | 105 insertBefore(cell, children->item(index), exceptionState); |
106 return cell; | 106 return cell; |
107 } | 107 } |
108 | 108 |
109 void HTMLTableRowElement::deleteCell(int index, | 109 void HTMLTableRowElement::deleteCell(int index, |
110 ExceptionState& exceptionState) { | 110 ExceptionState& exceptionState) { |
111 HTMLCollection* children = cells(); | 111 HTMLCollection* children = cells(); |
112 int numCells = children ? children->length() : 0; | 112 int numCells = children ? children->length() : 0; |
113 if (index == -1) | 113 if (index == -1) { |
114 if (numCells == 0) | |
115 return; | |
114 index = numCells - 1; | 116 index = numCells - 1; |
117 } | |
115 if (index >= 0 && index < numCells) { | 118 if (index >= 0 && index < numCells) { |
116 Element* cell = children->item(index); | 119 Element* cell = children->item(index); |
117 HTMLElement::removeChild(cell, exceptionState); | 120 HTMLElement::removeChild(cell, exceptionState); |
118 } else { | 121 } else { |
119 exceptionState.throwDOMException( | 122 exceptionState.throwDOMException( |
120 IndexSizeError, "The value provided (" + String::number(index) + | 123 IndexSizeError, "The value provided (" + String::number(index) + |
foolip
2016/10/12 13:07:11
Optional nit: could you reorder this so that it ob
rwlbuis
2016/10/12 13:48:37
Good idea, done.
| |
121 ") is outside the range [0, " + | 124 ") is outside the range [0, " + |
122 String::number(numCells) + ")."); | 125 String::number(numCells) + ")."); |
123 } | 126 } |
124 } | 127 } |
125 | 128 |
126 HTMLCollection* HTMLTableRowElement::cells() { | 129 HTMLCollection* HTMLTableRowElement::cells() { |
127 return ensureCachedCollection<HTMLCollection>(TRCells); | 130 return ensureCachedCollection<HTMLCollection>(TRCells); |
128 } | 131 } |
129 | 132 |
130 } // namespace blink | 133 } // namespace blink |
OLD | NEW |