OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return WebNodeCollection(unwrap<Document>()->all()); | 157 return WebNodeCollection(unwrap<Document>()->all()); |
158 } | 158 } |
159 | 159 |
160 void WebDocument::images(WebVector<WebElement>& results) | 160 void WebDocument::images(WebVector<WebElement>& results) |
161 { | 161 { |
162 RefPtr<HTMLCollection> images = unwrap<Document>()->images(); | 162 RefPtr<HTMLCollection> images = unwrap<Document>()->images(); |
163 size_t sourceLength = images->length(); | 163 size_t sourceLength = images->length(); |
164 Vector<WebElement> temp; | 164 Vector<WebElement> temp; |
165 temp.reserveCapacity(sourceLength); | 165 temp.reserveCapacity(sourceLength); |
166 for (size_t i = 0; i < sourceLength; ++i) { | 166 for (size_t i = 0; i < sourceLength; ++i) { |
167 Node* node = images->item(i); | 167 Element* element = images->item(i); |
168 if (node && node->isHTMLElement()) | 168 if (element && element->isHTMLElement()) |
169 temp.append(WebElement(toElement(node))); | 169 temp.append(WebElement(element)); |
170 } | 170 } |
171 results.assign(temp); | 171 results.assign(temp); |
172 } | 172 } |
173 | 173 |
174 void WebDocument::forms(WebVector<WebFormElement>& results) const | 174 void WebDocument::forms(WebVector<WebFormElement>& results) const |
175 { | 175 { |
176 RefPtr<HTMLCollection> forms = const_cast<Document*>(constUnwrap<Document>()
)->forms(); | 176 RefPtr<HTMLCollection> forms = const_cast<Document*>(constUnwrap<Document>()
)->forms(); |
177 size_t sourceLength = forms->length(); | 177 size_t sourceLength = forms->length(); |
178 Vector<WebFormElement> temp; | 178 Vector<WebFormElement> temp; |
179 temp.reserveCapacity(sourceLength); | 179 temp.reserveCapacity(sourceLength); |
180 for (size_t i = 0; i < sourceLength; ++i) { | 180 for (size_t i = 0; i < sourceLength; ++i) { |
181 Node* node = forms->item(i); | 181 Element* element = forms->item(i); |
182 // Strange but true, sometimes node can be 0. | 182 // Strange but true, sometimes node can be 0. |
183 if (node && node->isHTMLElement()) | 183 if (element && element->isHTMLElement()) |
184 temp.append(WebFormElement(toHTMLFormElement(node))); | 184 temp.append(WebFormElement(toHTMLFormElement(element))); |
185 } | 185 } |
186 results.assign(temp); | 186 results.assign(temp); |
187 } | 187 } |
188 | 188 |
189 WebURL WebDocument::completeURL(const WebString& partialURL) const | 189 WebURL WebDocument::completeURL(const WebString& partialURL) const |
190 { | 190 { |
191 return constUnwrap<Document>()->completeURL(partialURL); | 191 return constUnwrap<Document>()->completeURL(partialURL); |
192 } | 192 } |
193 | 193 |
194 WebElement WebDocument::getElementById(const WebString& id) const | 194 WebElement WebDocument::getElementById(const WebString& id) const |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 m_private = elem; | 315 m_private = elem; |
316 return *this; | 316 return *this; |
317 } | 317 } |
318 | 318 |
319 WebDocument::operator PassRefPtr<Document>() const | 319 WebDocument::operator PassRefPtr<Document>() const |
320 { | 320 { |
321 return toDocument(m_private.get()); | 321 return toDocument(m_private.get()); |
322 } | 322 } |
323 | 323 |
324 } // namespace blink | 324 } // namespace blink |
OLD | NEW |