| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 com.google.gwt.dom.client.Document; | 7 import com.google.gwt.dom.client.Document; |
| 8 import com.google.gwt.dom.client.Element; | 8 import com.google.gwt.dom.client.Element; |
| 9 import com.google.gwt.dom.client.ImageElement; | 9 import com.google.gwt.dom.client.ImageElement; |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 srcUrl = ""; | 39 srcUrl = ""; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 @Override | 43 @Override |
| 44 public String generateOutput(boolean textOnly) { | 44 public String generateOutput(boolean textOnly) { |
| 45 if (textOnly) return ""; | 45 if (textOnly) return ""; |
| 46 | 46 |
| 47 ImageElement ie = ImageElement.as(Element.as(imgElement.cloneNode(false)
)); | 47 ImageElement ie = ImageElement.as(Element.as(imgElement.cloneNode(false)
)); |
| 48 ie.setSrc(ie.getSrc()); | 48 ie.setSrc(ie.getSrc()); |
| 49 ie.setWidth(width); |
| 50 ie.setHeight(height); |
| 49 DomUtil.makeSrcSetAbsolute(ie); | 51 DomUtil.makeSrcSetAbsolute(ie); |
| 50 DomUtil.stripImageElement(ie); | 52 DomUtil.stripImageElement(ie); |
| 51 | 53 |
| 52 Element container = Document.get().createDivElement(); | 54 Element container = Document.get().createDivElement(); |
| 53 container.appendChild(ie); | 55 container.appendChild(ie); |
| 54 return container.getInnerHTML(); | 56 return container.getInnerHTML(); |
| 55 } | 57 } |
| 56 | 58 |
| 57 /** | 59 /** |
| 58 * Get the image element of this WebImage. | 60 * Get the image element of this WebImage. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 79 } | 81 } |
| 80 | 82 |
| 81 /** | 83 /** |
| 82 * Get the source URL of this image. | 84 * Get the source URL of this image. |
| 83 * @return Source URL or an empty string. | 85 * @return Source URL or an empty string. |
| 84 */ | 86 */ |
| 85 public String getSrc() { | 87 public String getSrc() { |
| 86 return srcUrl; | 88 return srcUrl; |
| 87 } | 89 } |
| 88 } | 90 } |
| OLD | NEW |