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

Side by Side Diff: java/org/chromium/distiller/webdocument/WebTable.java

Issue 2638823002: Support <picture> in image extraction (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.distiller.webdocument; 5 package org.chromium.distiller.webdocument;
6 6
7 import org.chromium.distiller.DomUtil; 7 import org.chromium.distiller.DomUtil;
8 8
9 import java.util.ArrayList; 9 import java.util.ArrayList;
10 import java.util.List; 10 import java.util.List;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 /** 44 /**
45 * Get the list of source URLs of this image. 45 * Get the list of source URLs of this image.
46 * It's more efficient to call after generateOutput(). 46 * It's more efficient to call after generateOutput().
47 * @return Source URLs or an empty List. 47 * @return Source URLs or an empty List.
48 */ 48 */
49 public List<String> getImageUrlList() { 49 public List<String> getImageUrlList() {
50 if (cloned == null) { 50 if (cloned == null) {
51 cloneAndProcessNode(); 51 cloneAndProcessNode();
52 } 52 }
53 List<String> imgUrls = new ArrayList<>(); 53 List<String> imgUrls = new ArrayList<>();
54 NodeList<Element> imgs = DomUtil.querySelectorAll(cloned, "IMG"); 54 NodeList<Element> imgs = DomUtil.querySelectorAll(cloned, "IMG, SOURCE") ;
55 for (int i = 0; i < imgs.getLength(); i++) { 55 for (int i = 0; i < imgs.getLength(); i++) {
56 ImageElement ie = (ImageElement) imgs.getItem(i); 56 ImageElement ie = (ImageElement) imgs.getItem(i);
57 imgUrls.add(ie.getSrc()); 57 if (!ie.getSrc().isEmpty()) {
mdjones 2017/01/17 17:41:47 nit: same in-line comment as above.
wychen 2017/01/18 17:29:54 Acknowledged.
58 imgUrls.addAll(DomUtil.getSrcSetUrls(ie)); 58 imgUrls.add(ie.getSrc());
59 }
60 imgUrls.addAll(DomUtil.getAllSrcSetUrls(ie));
59 } 61 }
60 return imgUrls; 62 return imgUrls;
61 } 63 }
62 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698