use own factory for children boxes for block comments
Signed-off-by: Florian Thienel <florian@thienel.org>
diff --git a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/layout/CommentBlockBox.java b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/layout/CommentBlockBox.java
index c78b6e6..c939e2f 100644
--- a/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/layout/CommentBlockBox.java
+++ b/org.eclipse.vex.core/src/org/eclipse/vex/core/internal/layout/CommentBlockBox.java
@@ -29,6 +29,11 @@
}
@Override
+ public VerticalRange layout(final LayoutContext context, final int top, final int bottom) {
+ return super.layout(context, top, bottom);
+ }
+
+ @Override
public List<Box> createChildren(final LayoutContext context) {
long start = 0;
if (VEXCorePlugin.getInstance().isDebugging()) {
@@ -38,20 +43,25 @@
final Node node = getNode();
final int width = getWidth();
- final List<Box> childList = new ArrayList<Box>();
+ final List<Box> result = new ArrayList<Box>();
+
+ final List<InlineBox> pendingInlines = new ArrayList<InlineBox>();
// :before content
- final List<InlineBox> beforeInlines = new ArrayList<InlineBox>();
- beforeInlines.add(new StaticTextBox(context, node, BEFORE_TEXT));
+ pendingInlines.add(new StaticTextBox(context, node, BEFORE_TEXT));
+
+ // textual content
+ if (node.getEndOffset() - node.getStartOffset() > 1) {
+ pendingInlines.add(new DocumentTextBox(context, node, node.getStartOffset() + 1, node.getEndOffset() - 1));
+ }
+
+ // placeholder
+ pendingInlines.add(new PlaceholderBox(context, node, node.getEndOffset() - node.getStartOffset()));
// :after content
- final List<InlineBox> afterInlines = new ArrayList<InlineBox>();
- afterInlines.add(new StaticTextBox(context, node, AFTER_TEXT));
+ pendingInlines.add(new StaticTextBox(context, node, AFTER_TEXT));
- final int startOffset = node.getStartOffset() + 1;
- final int endOffset = node.getEndOffset();
- final List<Box> blockBoxes = createBlockBoxes(context, startOffset, endOffset, width, beforeInlines, afterInlines);
- childList.addAll(blockBoxes);
+ result.add(ParagraphBox.create(context, node, pendingInlines, width));
if (VEXCorePlugin.getInstance().isDebugging()) {
final long end = System.currentTimeMillis();
@@ -60,6 +70,6 @@
}
}
- return childList;
+ return result;
}
}