Chromium Code Reviews| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 int numRows = children ? static_cast<int>(children->length()) : 0; | 69 int numRows = children ? static_cast<int>(children->length()) : 0; |
| 70 if (index < -1 || index > numRows) { | 70 if (index < -1 || index > numRows) { |
| 71 exceptionState.throwDOMException(IndexSizeError, "The provided index (" + String::number(index) + " is outside the range [-1, " + String::number(numRows ) + "]."); | 71 exceptionState.throwDOMException(IndexSizeError, "The provided index (" + String::number(index) + " is outside the range [-1, " + String::number(numRows ) + "]."); |
| 72 return nullptr; | 72 return nullptr; |
| 73 } | 73 } |
| 74 | 74 |
| 75 RefPtr<HTMLTableRowElement> row = HTMLTableRowElement::create(document()); | 75 RefPtr<HTMLTableRowElement> row = HTMLTableRowElement::create(document()); |
| 76 if (numRows == index || index == -1) { | 76 if (numRows == index || index == -1) { |
| 77 appendChild(row, exceptionState); | 77 appendChild(row, exceptionState); |
| 78 } else { | 78 } else { |
| 79 Node* n = index ? children->item(index) : firstChild(); | 79 Element* n = children->item(index); |
|
tkent
2014/05/07 01:18:23
nit: We can remove the local variable |n| and fold
Inactive
2014/05/07 01:37:13
Done.
| |
| 80 insertBefore(row, n, exceptionState); | 80 insertBefore(row, n, exceptionState); |
| 81 } | 81 } |
| 82 return row.release(); | 82 return row.release(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void HTMLTableSectionElement::deleteRow(int index, ExceptionState& exceptionStat e) | 85 void HTMLTableSectionElement::deleteRow(int index, ExceptionState& exceptionStat e) |
| 86 { | 86 { |
| 87 RefPtr<HTMLCollection> children = rows(); | 87 RefPtr<HTMLCollection> children = rows(); |
| 88 int numRows = children ? (int)children->length() : 0; | 88 int numRows = children ? (int)children->length() : 0; |
| 89 if (index == -1) | 89 if (index == -1) |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 103 ++rowCount; | 103 ++rowCount; |
| 104 return rowCount; | 104 return rowCount; |
| 105 } | 105 } |
| 106 | 106 |
| 107 PassRefPtr<HTMLCollection> HTMLTableSectionElement::rows() | 107 PassRefPtr<HTMLCollection> HTMLTableSectionElement::rows() |
| 108 { | 108 { |
| 109 return ensureCachedHTMLCollection(TSectionRows); | 109 return ensureCachedHTMLCollection(TSectionRows); |
| 110 } | 110 } |
| 111 | 111 |
| 112 } | 112 } |
| OLD | NEW |