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

Side by Side Diff: java/org/chromium/distiller/webdocument/WebText.java

Issue 1364253003: Amend "Strip style attributes from all tags" (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | javatests/org/chromium/distiller/ContentExtractorTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.distiller.webdocument; 5 package org.chromium.distiller.webdocument;
6 6
7 import com.google.gwt.dom.client.Element; 7 import com.google.gwt.dom.client.Element;
8 import org.chromium.distiller.DomUtil; 8 import org.chromium.distiller.DomUtil;
9 import org.chromium.distiller.TreeCloneBuilder; 9 import org.chromium.distiller.TreeCloneBuilder;
10 import org.chromium.distiller.labels.DefaultLabels; 10 import org.chromium.distiller.labels.DefaultLabels;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 if (clonedRoot.getNodeType() != Node.ELEMENT_NODE) { 61 if (clonedRoot.getNodeType() != Node.ELEMENT_NODE) {
62 Node parentClone = getTextNodes().get(0).getParentElement().cloneNod e(false); 62 Node parentClone = getTextNodes().get(0).getParentElement().cloneNod e(false);
63 parentClone.appendChild(clonedRoot); 63 parentClone.appendChild(clonedRoot);
64 clonedRoot = parentClone; 64 clonedRoot = parentClone;
65 } 65 }
66 66
67 // Make sure links are absolute and IDs are gone. 67 // Make sure links are absolute and IDs are gone.
68 DomUtil.makeAllLinksAbsolute(clonedRoot); 68 DomUtil.makeAllLinksAbsolute(clonedRoot);
69 DomUtil.stripIds(clonedRoot); 69 DomUtil.stripIds(clonedRoot);
70 DomUtil.stripFontColorAttributes(clonedRoot); 70 DomUtil.stripFontColorAttributes(clonedRoot);
71 DomUtil.stripStyleAttributes(clonedRoot);
71 72
72 // Since there are tag elements that are being wrapped 73 // Since there are tag elements that are being wrapped
73 // by a pair of {@link WebTag}s, we only need to 74 // by a pair of {@link WebTag}s, we only need to
74 // get the innerHTML, otherwise these tags would be duplicated. 75 // get the innerHTML, otherwise these tags would be duplicated.
75 Element elementClonedRoot = Element.as(clonedRoot); 76 Element elementClonedRoot = Element.as(clonedRoot);
76 if (textOnly) { 77 if (textOnly) {
77 return elementClonedRoot.getInnerText(); 78 return elementClonedRoot.getInnerText();
78 } else if (WebTag.canBeNested(elementClonedRoot.getTagName())) { 79 } else if (WebTag.canBeNested(elementClonedRoot.getTagName())) {
79 return elementClonedRoot.getInnerHTML(); 80 return elementClonedRoot.getInnerHTML();
80 } 81 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 133 }
133 134
134 public void setGroupNumber(int group) { 135 public void setGroupNumber(int group) {
135 groupNumber = group; 136 groupNumber = group;
136 } 137 }
137 138
138 public int getGroupNumber() { 139 public int getGroupNumber() {
139 return groupNumber; 140 return groupNumber;
140 } 141 }
141 } 142 }
OLDNEW
« no previous file with comments | « no previous file | javatests/org/chromium/distiller/ContentExtractorTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698