Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 38 if (srcUrl == null) { | 38 if (srcUrl == null) { |
| 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 Element container = Document.get().createDivElement(); | 46 Element container = Document.get().createDivElement(); |
| 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()); | |
|
mdjones
2015/12/09 17:40:16
Instead of removing all the attributes manually, w
wychen
2015/12/09 22:27:53
Done.
| |
| 48 DomUtil.makeSrcSetAbsolute(ie); | 49 DomUtil.makeSrcSetAbsolute(ie); |
| 49 container.appendChild(ie); | 50 container.appendChild(ie); |
| 51 | |
| 52 DomUtil.stripIds(ie); | |
| 53 DomUtil.stripStyleAttributes(ie); | |
| 54 DomUtil.stripAlignAttributes(ie); | |
| 55 | |
| 50 return container.getInnerHTML(); | 56 return container.getInnerHTML(); |
| 51 } | 57 } |
| 52 | 58 |
| 53 /** | 59 /** |
| 54 * Get the image element of this WebImage. | 60 * Get the image element of this WebImage. |
| 55 * @return Image element or null. | 61 * @return Image element or null. |
| 56 */ | 62 */ |
| 57 public Element getImageNode() { | 63 public Element getImageNode() { |
| 58 return imgElement; | 64 return imgElement; |
| 59 } | 65 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 75 } | 81 } |
| 76 | 82 |
| 77 /** | 83 /** |
| 78 * Get the source URL of this image. | 84 * Get the source URL of this image. |
| 79 * @return Source URL or an empty string. | 85 * @return Source URL or an empty string. |
| 80 */ | 86 */ |
| 81 public String getSrc() { | 87 public String getSrc() { |
| 82 return srcUrl; | 88 return srcUrl; |
| 83 } | 89 } |
| 84 } | 90 } |
| OLD | NEW |