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

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

Issue 2285133003: Use .innerText in text-only mode (Closed) Base URL: git@github.com:chromium/dom-distiller.git@master
Patch Set: Created 4 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 | java/org/chromium/distiller/webdocument/WebText.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 package org.chromium.distiller.webdocument; 1 package org.chromium.distiller.webdocument;
2 2
3 import com.google.gwt.dom.client.Document; 3 import com.google.gwt.dom.client.Document;
4 import com.google.gwt.dom.client.Element; 4 import com.google.gwt.dom.client.Element;
5 import org.chromium.distiller.DomUtil; 5 import org.chromium.distiller.DomUtil;
6 6
7 /** 7 /**
8 * WebFigure represents a figure element, containing an image and optionally a c aption. 8 * WebFigure represents a figure element, containing an image and optionally a c aption.
9 */ 9 */
10 public class WebFigure extends WebImage { 10 public class WebFigure extends WebImage {
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 /** 27 /**
28 * WebFigure extends WebImage so it can use WebImage generated output 28 * WebFigure extends WebImage so it can use WebImage generated output
29 * and just handle the caption since an html figure is basically a 29 * and just handle the caption since an html figure is basically a
30 * placeholder for an image and a caption. 30 * placeholder for an image and a caption.
31 */ 31 */
32 @Override 32 @Override
33 public String generateOutput(boolean textOnly) { 33 public String generateOutput(boolean textOnly) {
34 Element figcaption = DomUtil.cloneAndProcessTree(figCaption); 34 Element figcaption = DomUtil.cloneAndProcessTree(figCaption);
35 // TODO(wychen): .textContent should be identical to .innerText 35 if (textOnly) return DomUtil.getInnerText(figcaption);
36 // in our use cases, but needs verification.
37 if (textOnly) return DomUtil.javascriptTextContent(figcaption);
38 36
39 Element figure = Document.get().createElement("FIGURE"); 37 Element figure = Document.get().createElement("FIGURE");
40 figure.appendChild(getProcessedNode()); 38 figure.appendChild(getProcessedNode());
41 if (!figCaption.getInnerHTML().isEmpty()) { 39 if (!figCaption.getInnerHTML().isEmpty()) {
42 figure.appendChild(figcaption); 40 figure.appendChild(figcaption);
43 } 41 }
44 return figure.getString(); 42 return figure.getString();
45 } 43 }
46 } 44 }
OLDNEW
« no previous file with comments | « no previous file | java/org/chromium/distiller/webdocument/WebText.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698