Index: java/org/chromium/distiller/DomUtil.java |
diff --git a/java/org/chromium/distiller/DomUtil.java b/java/org/chromium/distiller/DomUtil.java |
index d0bcb1bfd7330c1cc8c56be59fdbc6320918284f..dcc96e4de0dcd06290c5c3f42d62963e138e2d25 100644 |
--- a/java/org/chromium/distiller/DomUtil.java |
+++ b/java/org/chromium/distiller/DomUtil.java |
@@ -95,11 +95,11 @@ public class DomUtil { |
}-*/; |
public static boolean isVisible(Element e) { |
- Style style = getComputedStyle(e); |
- double opacity = JavaScript.parseFloat(style.getOpacity()); |
- return !(style.getDisplay().equals("none") || |
- style.getVisibility().equals("hidden") || |
- opacity == 0.0F); |
+ // Detect whether any of the ancestors has "display: none". |
+ // Using offsetParent alone wouldn't work because it's also null when position is fixed. |
+ // Using offsetHeight/Width alone makes sense in production, but we have too many |
+ // zero-sized elements in our tests. |
+ return e.getOffsetParent() != null || e.getOffsetHeight() != 0 || e.getOffsetWidth() != 0; |
} |
/* |