Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 } | |
| OLD | NEW |