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, 2010 Apple Inc. All rights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2010 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 appendChild(row, exceptionState); | 67 appendChild(row, exceptionState); |
68 else | 68 else |
69 insertBefore(row, children->item(index), exceptionState); | 69 insertBefore(row, children->item(index), exceptionState); |
70 return row.release(); | 70 return row.release(); |
71 } | 71 } |
72 | 72 |
73 void HTMLTableSectionElement::deleteRow(int index, ExceptionState& exceptionStat
e) | 73 void HTMLTableSectionElement::deleteRow(int index, ExceptionState& exceptionStat
e) |
74 { | 74 { |
75 RefPtrWillBeRawPtr<HTMLCollection> children = rows(); | 75 RefPtrWillBeRawPtr<HTMLCollection> children = rows(); |
76 int numRows = children ? (int)children->length() : 0; | 76 int numRows = children ? (int)children->length() : 0; |
77 if (index == -1) | 77 if (index == -1) { |
| 78 if (!numRows) |
| 79 return; |
78 index = numRows - 1; | 80 index = numRows - 1; |
| 81 } |
79 if (index >= 0 && index < numRows) { | 82 if (index >= 0 && index < numRows) { |
80 RefPtrWillBeRawPtr<Element> row = children->item(index); | 83 RefPtrWillBeRawPtr<Element> row = children->item(index); |
81 HTMLElement::removeChild(row.get(), exceptionState); | 84 HTMLElement::removeChild(row.get(), exceptionState); |
82 } else { | 85 } else { |
83 exceptionState.throwDOMException(IndexSizeError, "The provided index ("
+ String::number(index) + " is outside the range [-1, " + String::number(numRows
) + "]."); | 86 exceptionState.throwDOMException(IndexSizeError, "The provided index ("
+ String::number(index) + " is outside the range [-1, " + String::number(numRows
) + "]."); |
84 } | 87 } |
85 } | 88 } |
86 | 89 |
87 PassRefPtrWillBeRawPtr<HTMLCollection> HTMLTableSectionElement::rows() | 90 PassRefPtrWillBeRawPtr<HTMLCollection> HTMLTableSectionElement::rows() |
88 { | 91 { |
89 return ensureCachedCollection<HTMLCollection>(TSectionRows); | 92 return ensureCachedCollection<HTMLCollection>(TSectionRows); |
90 } | 93 } |
91 | 94 |
92 } // namespace blink | 95 } // namespace blink |
OLD | NEW |