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

Side by Side Diff: Source/WebCore/html/HTMLTableElement.cpp

Issue 9567036: Merge 109362 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 9 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/WebCore/html/HTMLScriptElement.cpp ('k') | Source/WebCore/html/HTMLTextAreaElement.cpp » ('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, 2008, 2010, 2011 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010, 2011 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 return 0; 178 return 0;
179 } 179 }
180 180
181 PassRefPtr<HTMLElement> HTMLTableElement::insertRow(int index, ExceptionCode& ec ) 181 PassRefPtr<HTMLElement> HTMLTableElement::insertRow(int index, ExceptionCode& ec )
182 { 182 {
183 if (index < -1) { 183 if (index < -1) {
184 ec = INDEX_SIZE_ERR; 184 ec = INDEX_SIZE_ERR;
185 return 0; 185 return 0;
186 } 186 }
187 187
188 HTMLTableRowElement* lastRow = 0; 188 RefPtr<Node> protectFromMutationEvents(this);
189 HTMLTableRowElement* row = 0; 189
190 RefPtr<HTMLTableRowElement> lastRow = 0;
191 RefPtr<HTMLTableRowElement> row = 0;
190 if (index == -1) 192 if (index == -1)
191 lastRow = HTMLTableRowsCollection::lastRow(this); 193 lastRow = HTMLTableRowsCollection::lastRow(this);
192 else { 194 else {
193 for (int i = 0; i <= index; ++i) { 195 for (int i = 0; i <= index; ++i) {
194 row = HTMLTableRowsCollection::rowAfter(this, lastRow); 196 row = HTMLTableRowsCollection::rowAfter(this, lastRow.get());
195 if (!row) { 197 if (!row) {
196 if (i != index) { 198 if (i != index) {
197 ec = INDEX_SIZE_ERR; 199 ec = INDEX_SIZE_ERR;
198 return 0; 200 return 0;
199 } 201 }
200 break; 202 break;
201 } 203 }
202 lastRow = row; 204 lastRow = row;
203 } 205 }
204 } 206 }
205 207
206 ContainerNode* parent; 208 RefPtr<ContainerNode> parent;
207 if (lastRow) 209 if (lastRow)
208 parent = row ? row->parentNode() : lastRow->parentNode(); 210 parent = row ? row->parentNode() : lastRow->parentNode();
209 else { 211 else {
210 parent = lastBody(); 212 parent = lastBody();
211 if (!parent) { 213 if (!parent) {
212 RefPtr<HTMLTableSectionElement> newBody = HTMLTableSectionElement::c reate(tbodyTag, document()); 214 RefPtr<HTMLTableSectionElement> newBody = HTMLTableSectionElement::c reate(tbodyTag, document());
213 RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(doc ument()); 215 RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(doc ument());
214 newBody->appendChild(newRow, ec); 216 newBody->appendChild(newRow, ec);
215 appendChild(newBody.release(), ec); 217 appendChild(newBody.release(), ec);
216 return newRow.release(); 218 return newRow.release();
217 } 219 }
218 } 220 }
219 221
220 RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(document()) ; 222 RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(document()) ;
221 parent->insertBefore(newRow, row, ec); 223 parent->insertBefore(newRow, row.get(), ec);
222 return newRow.release(); 224 return newRow.release();
223 } 225 }
224 226
225 void HTMLTableElement::deleteRow(int index, ExceptionCode& ec) 227 void HTMLTableElement::deleteRow(int index, ExceptionCode& ec)
226 { 228 {
227 HTMLTableRowElement* row = 0; 229 HTMLTableRowElement* row = 0;
228 if (index == -1) 230 if (index == -1)
229 row = HTMLTableRowsCollection::lastRow(this); 231 row = HTMLTableRowsCollection::lastRow(this);
230 else { 232 else {
231 for (int i = 0; i <= index; ++i) { 233 for (int i = 0; i <= index; ++i) {
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 } 615 }
614 616
615 void HTMLTableElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons t 617 void HTMLTableElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons t
616 { 618 {
617 HTMLElement::addSubresourceAttributeURLs(urls); 619 HTMLElement::addSubresourceAttributeURLs(urls);
618 620
619 addSubresourceURL(urls, document()->completeURL(getAttribute(backgroundAttr) )); 621 addSubresourceURL(urls, document()->completeURL(getAttribute(backgroundAttr) ));
620 } 622 }
621 623
622 } 624 }
OLDNEW
« no previous file with comments | « Source/WebCore/html/HTMLScriptElement.cpp ('k') | Source/WebCore/html/HTMLTextAreaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698