From 26ff0b3f835290f1e8efa7bb38c2368ca5dddb2a Mon Sep 17 00:00:00 2001 From: Matthias Reischenbacher Date: Sat, 29 Apr 2017 22:17:48 +0000 Subject: [PATCH] FOP-2570: fix border placement of spanned table cells in r-l writing-mode git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1793236 13f79535-47bb-0310-9956-ffa450edef68 --- .../table/TableCellLayoutManager.java | 27 +++- .../table-border-span-rl.xml | 133 ++++++++++++++++++ 2 files changed, 153 insertions(+), 7 deletions(-) create mode 100644 fop/test/layoutengine/standard-testcases/table-border-span-rl.xml diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java index 42c174d64..eed28ff15 100644 --- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java +++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java @@ -471,17 +471,30 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager { BorderInfo border = gridUnits[0].getBorderStart(); int borderWidth = border.getRetainedWidth() / 2; if (borderWidth > 0) { - addBorder(blocks, y, 0, Trait.BORDER_START, border, - inFirstColumn, level); - adjustXOffset(blocks[y][0], borderWidth); - adjustIPD(blocks[y][0], -borderWidth); + if (level == 1) { + addBorder(blocks, y, gridUnits.length - 1, Trait.BORDER_START, border, + inFirstColumn, level); + adjustXOffset(blocks[y][gridUnits.length - 1], -borderWidth); + } else { + addBorder(blocks, y, 0, Trait.BORDER_START, border, + inFirstColumn, level); + adjustXOffset(blocks[y][0], borderWidth); + adjustIPD(blocks[y][0], -borderWidth); + } } border = gridUnits[gridUnits.length - 1].getBorderEnd(); borderWidth = border.getRetainedWidth() / 2; if (borderWidth > 0) { - addBorder(blocks, y, gridUnits.length - 1, Trait.BORDER_END, border, - inLastColumn, level); - adjustIPD(blocks[y][gridUnits.length - 1], -borderWidth); + if (level == 1) { + addBorder(blocks, y, 0, Trait.BORDER_END, border, + inLastColumn, level); + adjustXOffset(blocks[y][0], borderWidth); + adjustIPD(blocks[y][0], -borderWidth); + } else { + addBorder(blocks, y, gridUnits.length - 1, Trait.BORDER_END, border, + inLastColumn, level); + adjustIPD(blocks[y][gridUnits.length - 1], -borderWidth); + } } } int dy = yoffset; diff --git a/fop/test/layoutengine/standard-testcases/table-border-span-rl.xml b/fop/test/layoutengine/standard-testcases/table-border-span-rl.xml new file mode 100644 index 000000000..6e0d46ffc --- /dev/null +++ b/fop/test/layoutengine/standard-testcases/table-border-span-rl.xml @@ -0,0 +1,133 @@ + + + + + +

This test checks correct placement of table borders of spanned table cells in right-to-left writing mode.

+
+ + + + + + + + + + + + + + + + + + A1,B1,C1 + + + + + A2 + + + B2 + + + C2 + + + + + A2,B2 + + + C2 + + + + + A3 + + + B3,C3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file -- 2.39.5