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

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

Issue 1754213004: Retain image sizes (Closed) Base URL: https://github.com/chromium/dom-distiller.git@master
Patch Set: comments addressed Created 4 years, 9 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 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 cd68677d66f4df0428de73727cf2d460f5572940..0c14d46f7ae7605d53ad2e64465367e415142304 100644
--- a/java/org/chromium/distiller/webdocument/WebImage.java
+++ b/java/org/chromium/distiller/webdocument/WebImage.java
@@ -46,6 +46,12 @@ public class WebImage extends WebElement {
ImageElement ie = ImageElement.as(Element.as(imgElement.cloneNode(false)));
ie.setSrc(ie.getSrc());
+ // If computed width or height is zero, do not override them
+ // to keep them visible.
+ if (width > 0 && height > 0) {
+ ie.setWidth(width);
+ ie.setHeight(height);
+ }
DomUtil.makeSrcSetAbsolute(ie);
DomUtil.stripImageElement(ie);

Powered by Google App Engine
This is Rietveld 408576698