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

Side by Side Diff: Source/web/WebPageSerializer.cpp

Issue 137433008: Have HTMLCollection::item() return an Element as per specification (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 10 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/web/WebNodeCollection.cpp ('k') | Source/web/WebPageSerializerImpl.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) 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return; 158 return;
159 159
160 // If we have already seen that frame, ignore it. 160 // If we have already seen that frame, ignore it.
161 if (visitedFrames->contains(frame)) 161 if (visitedFrames->contains(frame))
162 return; 162 return;
163 visitedFrames->append(frame); 163 visitedFrames->append(frame);
164 if (!frameURLs->contains(frameURL)) 164 if (!frameURLs->contains(frameURL))
165 frameURLs->append(frameURL); 165 frameURLs->append(frameURL);
166 166
167 // Now get the resources associated with each node of the document. 167 // Now get the resources associated with each node of the document.
168 RefPtr<HTMLCollection> allNodes = frame->document()->all(); 168 RefPtr<HTMLCollection> allElements = frame->document()->all();
169 for (unsigned i = 0; i < allNodes->length(); ++i) { 169 for (unsigned i = 0; i < allElements->length(); ++i) {
170 Node* node = allNodes->item(i); 170 Element* element = allElements->item(i);
171 // We are only interested in HTML resources. 171 retrieveResourcesForElement(element,
172 if (!node->isElementNode())
173 continue;
174 retrieveResourcesForElement(toElement(node),
175 visitedFrames, framesToVisit, 172 visitedFrames, framesToVisit,
176 frameURLs, resourceURLs); 173 frameURLs, resourceURLs);
177 } 174 }
178 } 175 }
179 176
180 } // namespace 177 } // namespace
181 178
182 namespace blink { 179 namespace blink {
183 180
184 void WebPageSerializer::serialize(WebView* view, WebVector<WebPageSerializer::Re source>* resourcesParam) 181 void WebPageSerializer::serialize(WebView* view, WebVector<WebPageSerializer::Re source>* resourcesParam)
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 289
293 WebString WebPageSerializer::generateBaseTagDeclaration(const WebString& baseTar get) 290 WebString WebPageSerializer::generateBaseTagDeclaration(const WebString& baseTar get)
294 { 291 {
295 if (baseTarget.isEmpty()) 292 if (baseTarget.isEmpty())
296 return String("<base href=\".\">"); 293 return String("<base href=\".\">");
297 String baseString = "<base href=\".\" target=\"" + static_cast<const String& >(baseTarget) + "\">"; 294 String baseString = "<base href=\".\" target=\"" + static_cast<const String& >(baseTarget) + "\">";
298 return baseString; 295 return baseString;
299 } 296 }
300 297
301 } // namespace blink 298 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebNodeCollection.cpp ('k') | Source/web/WebPageSerializerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698