| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 const StylePropertySet* HTMLTableSectionElement::additionalPresentationAttribute
Style() | 47 const StylePropertySet* HTMLTableSectionElement::additionalPresentationAttribute
Style() |
| 48 { | 48 { |
| 49 if (HTMLTableElement* table = findParentTable()) | 49 if (HTMLTableElement* table = findParentTable()) |
| 50 return table->additionalGroupStyle(true); | 50 return table->additionalGroupStyle(true); |
| 51 return nullptr; | 51 return nullptr; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // these functions are rather slow, since we need to get the row at | 54 // these functions are rather slow, since we need to get the row at |
| 55 // the index... but they aren't used during usual HTML parsing anyway | 55 // the index... but they aren't used during usual HTML parsing anyway |
| 56 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index
, ExceptionState& exceptionState) | 56 RawPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index, ExceptionState
& exceptionState) |
| 57 { | 57 { |
| 58 RefPtrWillBeRawPtr<HTMLCollection> children = rows(); | 58 RawPtr<HTMLCollection> children = rows(); |
| 59 int numRows = children ? static_cast<int>(children->length()) : 0; | 59 int numRows = children ? static_cast<int>(children->length()) : 0; |
| 60 if (index < -1 || index > numRows) { | 60 if (index < -1 || index > numRows) { |
| 61 exceptionState.throwDOMException(IndexSizeError, "The provided index ("
+ String::number(index) + " is outside the range [-1, " + String::number(numRows
) + "]."); | 61 exceptionState.throwDOMException(IndexSizeError, "The provided index ("
+ String::number(index) + " is outside the range [-1, " + String::number(numRows
) + "]."); |
| 62 return nullptr; | 62 return nullptr; |
| 63 } | 63 } |
| 64 | 64 |
| 65 RefPtrWillBeRawPtr<HTMLTableRowElement> row = HTMLTableRowElement::create(do
cument()); | 65 RawPtr<HTMLTableRowElement> row = HTMLTableRowElement::create(document()); |
| 66 if (numRows == index || index == -1) | 66 if (numRows == index || index == -1) |
| 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 RawPtr<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) | 78 if (!numRows) |
| 79 return; | 79 return; |
| 80 index = numRows - 1; | 80 index = numRows - 1; |
| 81 } | 81 } |
| 82 if (index >= 0 && index < numRows) { | 82 if (index >= 0 && index < numRows) { |
| 83 RefPtrWillBeRawPtr<Element> row = children->item(index); | 83 RawPtr<Element> row = children->item(index); |
| 84 HTMLElement::removeChild(row.get(), exceptionState); | 84 HTMLElement::removeChild(row.get(), exceptionState); |
| 85 } else { | 85 } else { |
| 86 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
) + "]."); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 PassRefPtrWillBeRawPtr<HTMLCollection> HTMLTableSectionElement::rows() | 90 RawPtr<HTMLCollection> HTMLTableSectionElement::rows() |
| 91 { | 91 { |
| 92 return ensureCachedCollection<HTMLCollection>(TSectionRows); | 92 return ensureCachedCollection<HTMLCollection>(TSectionRows); |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |