Index: java/org/chromium/distiller/webdocument/WebFigure.java |
diff --git a/java/org/chromium/distiller/webdocument/WebFigure.java b/java/org/chromium/distiller/webdocument/WebFigure.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6214034619dc2dcc813107fcc58ff9976f39bcdf |
--- /dev/null |
+++ b/java/org/chromium/distiller/webdocument/WebFigure.java |
@@ -0,0 +1,30 @@ |
+package org.chromium.distiller.webdocument; |
+ |
+import com.google.gwt.dom.client.Document; |
+import com.google.gwt.dom.client.Element; |
+import org.chromium.distiller.DomUtil; |
+ |
+public class WebFigure extends WebImage { |
+ |
+ private String figCaption; |
+ |
+ public WebFigure(Element e, int w, int h, String src, String caption) { |
+ super(e, w, h, src); |
+ figCaption = caption; |
+ } |
+ |
+ @Override |
+ public String generateOutput(boolean textOnly) { |
+ if (textOnly) return figCaption; |
wychen
2016/06/20 18:54:20
Now this doesn't work with these escaping.
|
+ |
+ Element figure = Document.get().createElement("FIGURE"); |
+ figure.setInnerHTML(super.generateOutput(false)); |
+ if (!figCaption.isEmpty()) { |
+ Element caption = Document.get().createElement("FIGCAPTION"); |
+ caption.setInnerHTML(figCaption); |
+ figure.appendChild(caption); |
+ } |
+ DomUtil.makeAllLinksAbsolute(figure); |
+ return figure.getString(); |
+ } |
+} |