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

Unified Diff: java/org/chromium/distiller/webdocument/WebImage.java

Issue 1507373003: Clean up attributes of image elements (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: address mdjones' comments Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: java/org/chromium/distiller/webdocument/WebImage.java
diff --git a/java/org/chromium/distiller/webdocument/WebImage.java b/java/org/chromium/distiller/webdocument/WebImage.java
index 491fdb73f9f07380e4d74d12c9d8061b7766754c..e4ece150fa3699c4e629a398be05267aade7b44a 100644
--- a/java/org/chromium/distiller/webdocument/WebImage.java
+++ b/java/org/chromium/distiller/webdocument/WebImage.java
@@ -43,9 +43,13 @@ public class WebImage extends WebElement {
@Override
public String generateOutput(boolean textOnly) {
if (textOnly) return "";
- Element container = Document.get().createDivElement();
- ImageElement ie = ImageElement.as(Element.as(imgElement.cloneNode(false)));
+
+ ImageElement ie = Document.get().createImageElement();
+ ie.setSrc(ImageElement.as(imgElement).getSrc());
+ ie.setAttribute("srcset", imgElement.getAttribute("srcset"));
DomUtil.makeSrcSetAbsolute(ie);
+
+ Element container = Document.get().createDivElement();
container.appendChild(ie);
return container.getInnerHTML();
}

Powered by Google App Engine
This is Rietveld 408576698