| OLD | NEW |
| 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 Loading... |
| 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()) { |
| 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 } |
| OLD | NEW |