OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2011, 2012, 2014 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2011, 2012, 2014 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 child = Traversal<HTMLElement>::firstChild(table); | 88 child = Traversal<HTMLElement>::firstChild(table); |
89 else | 89 else |
90 child = Traversal<HTMLElement>::nextSibling(*previous->parentNode()); | 90 child = Traversal<HTMLElement>::nextSibling(*previous->parentNode()); |
91 for (; child; child = Traversal<HTMLElement>::nextSibling(*child)) { | 91 for (; child; child = Traversal<HTMLElement>::nextSibling(*child)) { |
92 if (child->hasTagName(tfootTag)) { | 92 if (child->hasTagName(tfootTag)) { |
93 if (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::first
Child(*child)) | 93 if (HTMLTableRowElement* row = Traversal<HTMLTableRowElement>::first
Child(*child)) |
94 return row; | 94 return row; |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 return 0; | 98 return nullptr; |
99 } | 99 } |
100 | 100 |
101 HTMLTableRowElement* HTMLTableRowsCollection::lastRow(HTMLTableElement& table) | 101 HTMLTableRowElement* HTMLTableRowsCollection::lastRow(HTMLTableElement& table) |
102 { | 102 { |
103 for (HTMLElement* tfoot = Traversal<HTMLElement>::lastChild(table, HasHTMLTa
gName(tfootTag)); tfoot; tfoot = Traversal<HTMLElement>::previousSibling(*tfoot,
HasHTMLTagName(tfootTag))) { | 103 for (HTMLElement* tfoot = Traversal<HTMLElement>::lastChild(table, HasHTMLTa
gName(tfootTag)); tfoot; tfoot = Traversal<HTMLElement>::previousSibling(*tfoot,
HasHTMLTagName(tfootTag))) { |
104 if (HTMLTableRowElement* lastRow = Traversal<HTMLTableRowElement>::lastC
hild(*tfoot)) | 104 if (HTMLTableRowElement* lastRow = Traversal<HTMLTableRowElement>::lastC
hild(*tfoot)) |
105 return lastRow; | 105 return lastRow; |
106 } | 106 } |
107 | 107 |
108 for (HTMLElement* child = Traversal<HTMLElement>::lastChild(table); child; c
hild = Traversal<HTMLElement>::previousSibling(*child)) { | 108 for (HTMLElement* child = Traversal<HTMLElement>::lastChild(table); child; c
hild = Traversal<HTMLElement>::previousSibling(*child)) { |
109 if (isHTMLTableRowElement(child)) | 109 if (isHTMLTableRowElement(child)) |
110 return toHTMLTableRowElement(child); | 110 return toHTMLTableRowElement(child); |
111 if (child->hasTagName(tbodyTag)) { | 111 if (child->hasTagName(tbodyTag)) { |
112 if (HTMLTableRowElement* lastRow = Traversal<HTMLTableRowElement>::l
astChild(*child)) | 112 if (HTMLTableRowElement* lastRow = Traversal<HTMLTableRowElement>::l
astChild(*child)) |
113 return lastRow; | 113 return lastRow; |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 for (HTMLElement* thead = Traversal<HTMLElement>::lastChild(table, HasHTMLTa
gName(theadTag)); thead; thead = Traversal<HTMLElement>::previousSibling(*thead,
HasHTMLTagName(theadTag))) { | 117 for (HTMLElement* thead = Traversal<HTMLElement>::lastChild(table, HasHTMLTa
gName(theadTag)); thead; thead = Traversal<HTMLElement>::previousSibling(*thead,
HasHTMLTagName(theadTag))) { |
118 if (HTMLTableRowElement* lastRow = Traversal<HTMLTableRowElement>::lastC
hild(*thead)) | 118 if (HTMLTableRowElement* lastRow = Traversal<HTMLTableRowElement>::lastC
hild(*thead)) |
119 return lastRow; | 119 return lastRow; |
120 } | 120 } |
121 | 121 |
122 return 0; | 122 return nullptr; |
123 } | 123 } |
124 | 124 |
125 // Must call get() on the table in case that argument is compiled before derefer
encing the | 125 // Must call get() on the table in case that argument is compiled before derefer
encing the |
126 // table to get at the collection cache. Order of argument evaluation is undefin
ed and can | 126 // table to get at the collection cache. Order of argument evaluation is undefin
ed and can |
127 // differ between compilers. | 127 // differ between compilers. |
128 HTMLTableRowsCollection::HTMLTableRowsCollection(ContainerNode& table) | 128 HTMLTableRowsCollection::HTMLTableRowsCollection(ContainerNode& table) |
129 : HTMLCollection(table, TableRows, OverridesItemAfter) | 129 : HTMLCollection(table, TableRows, OverridesItemAfter) |
130 { | 130 { |
131 ASSERT(isHTMLTableElement(table)); | 131 ASSERT(isHTMLTableElement(table)); |
132 } | 132 } |
133 | 133 |
134 PassRefPtrWillBeRawPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(
ContainerNode& table, CollectionType type) | 134 PassRefPtrWillBeRawPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(
ContainerNode& table, CollectionType type) |
135 { | 135 { |
136 ASSERT_UNUSED(type, type == TableRows); | 136 ASSERT_UNUSED(type, type == TableRows); |
137 return adoptRefWillBeNoop(new HTMLTableRowsCollection(table)); | 137 return adoptRefWillBeNoop(new HTMLTableRowsCollection(table)); |
138 } | 138 } |
139 | 139 |
140 Element* HTMLTableRowsCollection::virtualItemAfter(Element* previous) const | 140 Element* HTMLTableRowsCollection::virtualItemAfter(Element* previous) const |
141 { | 141 { |
142 return rowAfter(toHTMLTableElement(ownerNode()), toHTMLTableRowElement(previ
ous)); | 142 return rowAfter(toHTMLTableElement(ownerNode()), toHTMLTableRowElement(previ
ous)); |
143 } | 143 } |
144 | 144 |
145 } | 145 } |
OLD | NEW |