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

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

Issue 1507373003: Clean up attributes of image elements (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: add todos Created 5 years 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
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 DomUtil.stripStyleAttributes(clonedRoot);
72 // TODO(wychen): if we allow images in WebText later, add stripImageElem ents().
72 73
73 // Since there are tag elements that are being wrapped 74 // Since there are tag elements that are being wrapped
74 // by a pair of {@link WebTag}s, we only need to 75 // by a pair of {@link WebTag}s, we only need to
75 // get the innerHTML, otherwise these tags would be duplicated. 76 // get the innerHTML, otherwise these tags would be duplicated.
76 Element elementClonedRoot = Element.as(clonedRoot); 77 Element elementClonedRoot = Element.as(clonedRoot);
77 if (textOnly) { 78 if (textOnly) {
78 return elementClonedRoot.getInnerText(); 79 return elementClonedRoot.getInnerText();
79 } else if (WebTag.canBeNested(elementClonedRoot.getTagName())) { 80 } else if (WebTag.canBeNested(elementClonedRoot.getTagName())) {
80 return elementClonedRoot.getInnerHTML(); 81 return elementClonedRoot.getInnerHTML();
81 } 82 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 134 }
134 135
135 public void setGroupNumber(int group) { 136 public void setGroupNumber(int group) {
136 groupNumber = group; 137 groupNumber = group;
137 } 138 }
138 139
139 public int getGroupNumber() { 140 public int getGroupNumber() {
140 return groupNumber; 141 return groupNumber;
141 } 142 }
142 } 143 }
OLDNEW
« no previous file with comments | « java/org/chromium/distiller/webdocument/WebImage.java ('k') | javatests/org/chromium/distiller/ContentExtractorTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698