Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: Source/core/html/HTMLTableSectionElement.cpp

Issue 280123002: Oilpan: move LiveNodeList collections to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have NodeRareData clear out NodeListsNodeData instead. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/html/HTMLTableSectionElement.h ('k') | Source/core/html/LabelableElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableSectionElement::insertRow(Exception State& exceptionState) 58 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableSectionElement::insertRow(Exception State& exceptionState)
59 { 59 {
60 // The default 'index' argument value is -1. 60 // The default 'index' argument value is -1.
61 return insertRow(-1, exceptionState); 61 return insertRow(-1, exceptionState);
62 } 62 }
63 63
64 // these functions are rather slow, since we need to get the row at 64 // these functions are rather slow, since we need to get the row at
65 // the index... but they aren't used during usual HTML parsing anyway 65 // the index... but they aren't used during usual HTML parsing anyway
66 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index , ExceptionState& exceptionState) 66 PassRefPtrWillBeRawPtr<HTMLElement> HTMLTableSectionElement::insertRow(int index , ExceptionState& exceptionState)
67 { 67 {
68 RefPtr<HTMLCollection> children = rows(); 68 RefPtrWillBeRawPtr<HTMLCollection> children = rows();
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 RefPtrWillBeRawPtr<HTMLTableRowElement> row = HTMLTableRowElement::create(do cument()); 75 RefPtrWillBeRawPtr<HTMLTableRowElement> row = HTMLTableRowElement::create(do cument());
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 insertBefore(row, children->item(index), exceptionState); 79 insertBefore(row, children->item(index), exceptionState);
80 return row.release(); 80 return row.release();
81 } 81 }
82 82
83 void HTMLTableSectionElement::deleteRow(int index, ExceptionState& exceptionStat e) 83 void HTMLTableSectionElement::deleteRow(int index, ExceptionState& exceptionStat e)
84 { 84 {
85 RefPtr<HTMLCollection> children = rows(); 85 RefPtrWillBeRawPtr<HTMLCollection> children = rows();
86 int numRows = children ? (int)children->length() : 0; 86 int numRows = children ? (int)children->length() : 0;
87 if (index == -1) 87 if (index == -1)
88 index = numRows - 1; 88 index = numRows - 1;
89 if (index >= 0 && index < numRows) { 89 if (index >= 0 && index < numRows) {
90 RefPtr<Element> row = children->item(index); 90 RefPtr<Element> row = children->item(index);
91 HTMLElement::removeChild(row.get(), exceptionState); 91 HTMLElement::removeChild(row.get(), exceptionState);
92 } else { 92 } else {
93 exceptionState.throwDOMException(IndexSizeError, "The provided index (" + String::number(index) + " is outside the range [-1, " + String::number(numRows ) + "]."); 93 exceptionState.throwDOMException(IndexSizeError, "The provided index (" + String::number(index) + " is outside the range [-1, " + String::number(numRows ) + "].");
94 } 94 }
95 } 95 }
96 96
97 int HTMLTableSectionElement::numRows() const 97 int HTMLTableSectionElement::numRows() const
98 { 98 {
99 int rowCount = 0; 99 int rowCount = 0;
100 for (const HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firstC hild(*this); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row)) 100 for (const HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::firstC hild(*this); row; row = Traversal<HTMLTableRowElement>::nextSibling(*row))
101 ++rowCount; 101 ++rowCount;
102 return rowCount; 102 return rowCount;
103 } 103 }
104 104
105 PassRefPtr<HTMLCollection> HTMLTableSectionElement::rows() 105 PassRefPtrWillBeRawPtr<HTMLCollection> HTMLTableSectionElement::rows()
106 { 106 {
107 return ensureCachedHTMLCollection(TSectionRows); 107 return ensureCachedHTMLCollection(TSectionRows);
108 } 108 }
109 109
110 } 110 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTableSectionElement.h ('k') | Source/core/html/LabelableElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698