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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
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..caf80ac004398845eccdef4ee12cb5ad447d3e85
--- /dev/null
+++ b/java/org/chromium/distiller/webdocument/WebFigure.java
@@ -0,0 +1,26 @@
+package org.chromium.distiller.webdocument;
+
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Element;
+
+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) {
wychen 2016/06/02 23:48:49 This doesn't work for text-only mode. Add this as
marcelorcorrea 2016/06/06 20:38:30 Acknowledged.
+ Element fig = Document.get().createElement("FIGURE");
+ fig.setInnerHTML(super.generateOutput(textOnly));
wychen 2016/06/02 23:48:49 After that, textOnly can only be false here.
marcelorcorrea 2016/06/06 20:38:30 Acknowledged.
+ if (!figCaption.isEmpty()) {
+ Element cap = Document.get().createElement("FIGCAPTION");
+ cap.setInnerText(figCaption);
+ fig.appendChild(cap);
+ }
+ return fig.getString();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698