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..c94c3378b050627ff35a78d5f0466cedfe41e3a4 100644 |
--- a/java/org/chromium/distiller/DomUtil.java |
+++ b/java/org/chromium/distiller/DomUtil.java |
@@ -102,6 +102,13 @@ public class DomUtil { |
opacity == 0.0F); |
} |
+ /** |
+ * Verifies if a given element is visible by checking its offset. |
+ */ |
+ public static boolean isVisibleByItsOffset(Element e) { |
+ return !(e.getOffsetHeight() <= 0 || e.getOffsetWidth() <= 0); |
+ } |
+ |
/* |
* We want to use jsni for direct access to javascript's innerText. This avoids GWT's |
* implementation of Element::getInnerText(), which is intentionally different to mimic an old |
@@ -171,11 +178,11 @@ public class DomUtil { |
/** |
* Get the nearest common ancestor of nodes. |
*/ |
- public static Node getNearestCommonAncestor(final NodeList ns) { |
- if (ns.getLength() == 0) return null; |
- Node parent = ns.getItem(0); |
- for (int i = 1; i < ns.getLength(); i++) { |
- parent = getNearestCommonAncestor(parent, ns.getItem(i)); |
+ public static Node getNearestCommonAncestor(final List<Element> ns) { |
+ if (ns.size() == 0) return null; |
+ Node parent = ns.get(0); |
+ for (int i = 1; i < ns.size(); i++) { |
+ parent = getNearestCommonAncestor(parent, ns.get(i)); |
} |
return parent; |
} |