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

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

Issue 2721133002: Skip some social sharing elements (Closed)
Patch Set: Created 3 years, 10 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/DomConverter.java
diff --git a/java/org/chromium/distiller/webdocument/DomConverter.java b/java/org/chromium/distiller/webdocument/DomConverter.java
index 56fee56e243ae57f901c42e500581d26bdc3277f..1b270f62edee7f7e6f2538644f48e77bf545e324 100644
--- a/java/org/chromium/distiller/webdocument/DomConverter.java
+++ b/java/org/chromium/distiller/webdocument/DomConverter.java
@@ -140,6 +140,15 @@ public class DomConverter implements DomWalker.Visitor {
"Exception happened in EmbedExtractors: " + exception.getMessage());
}
+ String className = e.getAttribute("class");
+ String component = e.getAttribute("data-component");
+ if (className.equals("sharing") || className.equals("socialArea") ||
+ component.equals("share")) {
+ // Skip social and sharing elements.
+ // See crbug.com/692553, crbug.com/696556, and crbug.com/674557
+ return false;
+ }
+
// Create a placeholder for the elements we want to preserve.
if (WebTag.canBeNested(e.getTagName())) {
builder.tag(new WebTag(e.getTagName(), WebTag.TagType.START));
@@ -184,6 +193,7 @@ public class DomConverter implements DomWalker.Visitor {
case "svg": // The svg tag is actually in small case.
return false;
}
+
builder.startElement(e);
isHiddenStack.push(isHiddenClass);
isHiddenClass |= hasHiddenClassName;

Powered by Google App Engine
This is Rietveld 408576698