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

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

Issue 262163008: HTMLTableSectionElement.insertRow(0) / HTMLTableRowElement.insertCell(0) do not behave correctly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix descriptions 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 | Annotate | Revision Log
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« Source/core/html/HTMLTableRowElement.cpp ('K') | « Source/core/html/HTMLTableRowElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698