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

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

Issue 2020403002: Add support for figure element (Closed) Base URL: https://github.com/chromium/dom-distiller.git@master
Patch Set: comments addressed Created 4 years, 6 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
OLDNEW
(Empty)
1 package org.chromium.distiller.webdocument;
2
3 import com.google.gwt.dom.client.Document;
4 import com.google.gwt.dom.client.Element;
5 import org.chromium.distiller.DomUtil;
6
7 public class WebFigure extends WebImage {
8
9 private String figCaption;
10
11 public WebFigure(Element e, int w, int h, String src, String caption) {
12 super(e, w, h, src);
13 figCaption = caption;
14 }
15
16 @Override
17 public String generateOutput(boolean textOnly) {
18 if (textOnly) return figCaption;
wychen 2016/06/20 18:54:20 Now this doesn't work with these escaping.
19
20 Element figure = Document.get().createElement("FIGURE");
21 figure.setInnerHTML(super.generateOutput(false));
22 if (!figCaption.isEmpty()) {
23 Element caption = Document.get().createElement("FIGCAPTION");
24 caption.setInnerHTML(figCaption);
25 figure.appendChild(caption);
26 }
27 DomUtil.makeAllLinksAbsolute(figure);
28 return figure.getString();
29 }
30 }
OLDNEW
« no previous file with comments | « java/org/chromium/distiller/extractors/embeds/ImageExtractor.java ('k') | javatests/org/chromium/distiller/DomUtilTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698