diff options
author | Glenn Adams <gadams@apache.org> | 2012-04-14 16:48:59 +0000 |
---|---|---|
committer | Glenn Adams <gadams@apache.org> | 2012-04-14 16:48:59 +0000 |
commit | 01388f7ca30e5d5e48f41c65f7453b068205c539 (patch) | |
tree | 795722451004577e50d16c5fe9fba3bb436be942 | |
parent | 3c558c69c28d79abd0710dba0651e4cd97a4e192 (diff) | |
download | xmlgraphics-fop-01388f7ca30e5d5e48f41c65f7453b068205c539.tar.gz xmlgraphics-fop-01388f7ca30e5d5e48f41c65f7453b068205c539.zip |
Bugzilla #52572: Prevent NPE on use of unsupported collapse-with-precedence; fall back to collapse. Fix checkstyle errors from prior commit.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1326144 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/documentation/content/xdocs/compliance.ihtml | 8 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java | 13 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/flow/table/Table.java | 20 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/txt/TXTRenderer.java | 12 | ||||
-rw-r--r-- | status.xml | 3 |
6 files changed, 33 insertions, 30 deletions
diff --git a/src/documentation/content/xdocs/compliance.ihtml b/src/documentation/content/xdocs/compliance.ihtml index fe3107142..a8e7a39ca 100644 --- a/src/documentation/content/xdocs/compliance.ihtml +++ b/src/documentation/content/xdocs/compliance.ihtml @@ -3962,10 +3962,10 @@ <td><a name="fo-property-border-collapse" id= "fo-property-border-collapse">border-collapse</a></td> <td class="extended">Extended</td> - <td class="yes">yes</td> - <td class="yes">yes</td> - <td class="yes">yes</td> - <td>Some small limitations</td> + <td class="partial">partial</td> + <td class="partial">partial</td> + <td class="partial">partial</td> + <td>value "collapse-with-precedence" not yet supported</td> </tr> <tr> <td align="center"><a href= diff --git a/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java b/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java index b5cd56d47..e69439276 100644 --- a/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java +++ b/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java @@ -60,6 +60,7 @@ public class ConditionalBorder { private ConditionalBorder(BorderSpecification normal, BorderSpecification leadingTrailing, BorderSpecification rest, CollapsingBorderModel collapsingBorderModel) { + assert collapsingBorderModel != null; this.normal = normal; this.leadingTrailing = leadingTrailing; this.rest = rest; @@ -74,14 +75,10 @@ public class ConditionalBorder { */ ConditionalBorder(BorderSpecification borderSpecification, CollapsingBorderModel collapsingBorderModel) { - normal = borderSpecification; - leadingTrailing = normal; - if (borderSpecification.getBorderInfo().getWidth().isDiscard()) { - rest = BorderSpecification.getDefaultBorder(); - } else { - rest = leadingTrailing; - } - this.collapsingBorderModel = collapsingBorderModel; + this ( borderSpecification, borderSpecification, + borderSpecification.getBorderInfo().getWidth().isDiscard() + ? BorderSpecification.getDefaultBorder() : borderSpecification, + collapsingBorderModel ); } /** diff --git a/src/java/org/apache/fop/fo/flow/table/Table.java b/src/java/org/apache/fop/fo/flow/table/Table.java index b14326af5..e599fc8c5 100644 --- a/src/java/org/apache/fop/fo/flow/table/Table.java +++ b/src/java/org/apache/fop/fo/flow/table/Table.java @@ -147,13 +147,19 @@ public class Table extends TableFObj implements ColumnNumberManagerHolder, Break getFOValidationEventProducer().unimplementedFeature(this, getName(), "table-layout=\"auto\"", getLocator()); } - if (!isSeparateBorderModel() - && getCommonBorderPaddingBackground().hasPadding( - ValidationPercentBaseContext.getPseudoContext())) { - //See "17.6.2 The collapsing border model" in CSS2 - TableEventProducer eventProducer = TableEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.noTablePaddingWithCollapsingBorderModel(this, getLocator()); + if (!isSeparateBorderModel()) { + if (borderCollapse == EN_COLLAPSE_WITH_PRECEDENCE) { + getFOValidationEventProducer().unimplementedFeature(this, getName(), + "border-collapse=\"collapse-with-precedence\"; defaulting to \"collapse\"", getLocator()); + borderCollapse = EN_COLLAPSE; + } + if (getCommonBorderPaddingBackground().hasPadding( + ValidationPercentBaseContext.getPseudoContext())) { + //See "17.6.2 The collapsing border model" in CSS2 + TableEventProducer eventProducer = TableEventProducer.Provider.get( + getUserAgent().getEventBroadcaster()); + eventProducer.noTablePaddingWithCollapsingBorderModel(this, getLocator()); + } } /* Store reference to the property list, so diff --git a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java b/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java index 7221d4fee..88b89e1db 100644 --- a/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java +++ b/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java @@ -49,7 +49,7 @@ public abstract class CollapsingBorderModel { //These statics are used singleton-style. No MT issues here. private static CollapsingBorderModel collapse = null; - private static CollapsingBorderModel collapseWithPrecedence = null; + // private static CollapsingBorderModel collapseWithPrecedence = null; /** * @param borderCollapse border collapse control @@ -63,10 +63,7 @@ public abstract class CollapsingBorderModel { } return collapse; case Constants.EN_COLLAPSE_WITH_PRECEDENCE: - if (collapseWithPrecedence == null) { - //collapseWithPrecedence = new CollapsingBorderModelWithPrecedence(); - } - return collapseWithPrecedence; + throw new UnsupportedOperationException ( "collapse-with-precedence not yet supported" ); default: throw new IllegalArgumentException("Illegal border-collapse mode."); } diff --git a/src/java/org/apache/fop/render/txt/TXTRenderer.java b/src/java/org/apache/fop/render/txt/TXTRenderer.java index dd3d883f6..9492018fc 100644 --- a/src/java/org/apache/fop/render/txt/TXTRenderer.java +++ b/src/java/org/apache/fop/render/txt/TXTRenderer.java @@ -195,7 +195,7 @@ public class TXTRenderer extends AbstractPathOrientedRenderer { */ protected void renderText(TextArea area) { int col = Helper.ceilPosition(this.currentIPPosition, CHAR_WIDTH); - int row = Helper.ceilPosition(this.currentBPPosition - LINE_LEADING, CHAR_HEIGHT + 2*LINE_LEADING); + int row = Helper.ceilPosition(this.currentBPPosition - LINE_LEADING, CHAR_HEIGHT + 2 * LINE_LEADING); String s = area.getText(); @@ -219,7 +219,7 @@ public class TXTRenderer extends AbstractPathOrientedRenderer { double height = bounds.getHeight(); pageWidth = Helper.ceilPosition((int) width, CHAR_WIDTH); - pageHeight = Helper.ceilPosition((int) height, CHAR_HEIGHT + 2*LINE_LEADING); + pageHeight = Helper.ceilPosition((int) height, CHAR_HEIGHT + 2 * LINE_LEADING); // init buffers charData = new StringBuffer[pageHeight]; @@ -463,9 +463,9 @@ public class TXTRenderer extends AbstractPathOrientedRenderer { */ public void renderImage(Image image, Rectangle2D pos) { int x1 = Helper.ceilPosition(currentIPPosition, CHAR_WIDTH); - int y1 = Helper.ceilPosition(currentBPPosition - LINE_LEADING, CHAR_HEIGHT + 2*LINE_LEADING); + int y1 = Helper.ceilPosition(currentBPPosition - LINE_LEADING, CHAR_HEIGHT + 2 * LINE_LEADING); int width = Helper.ceilPosition((int) pos.getWidth(), CHAR_WIDTH); - int height = Helper.ceilPosition((int) pos.getHeight(), CHAR_HEIGHT + 2*LINE_LEADING); + int height = Helper.ceilPosition((int) pos.getHeight(), CHAR_HEIGHT + 2 * LINE_LEADING); fillRect(x1, y1, width, height, IMAGE_CHAR); } @@ -562,9 +562,9 @@ public class TXTRenderer extends AbstractPathOrientedRenderer { protected void drawBackAndBorders(Area area, float startx, float starty, float width, float height) { bm.setWidth(Helper.ceilPosition(toMilli(width), CHAR_WIDTH)); - bm.setHeight(Helper.ceilPosition(toMilli(height), CHAR_HEIGHT + 2*LINE_LEADING)); + bm.setHeight(Helper.ceilPosition(toMilli(height), CHAR_HEIGHT + 2 * LINE_LEADING)); bm.setStartX(Helper.ceilPosition(toMilli(startx), CHAR_WIDTH)); - bm.setStartY(Helper.ceilPosition(toMilli(starty), CHAR_HEIGHT + 2*LINE_LEADING)); + bm.setStartY(Helper.ceilPosition(toMilli(starty), CHAR_HEIGHT + 2 * LINE_LEADING)); super.drawBackAndBorders(area, startx, starty, width, height); } diff --git a/status.xml b/status.xml index 95f640639..92f35af8d 100644 --- a/status.xml +++ b/status.xml @@ -62,6 +62,9 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> <release version="FOP Trunk" date="TBD"> + <action context="Code" dev="GA" type="fix" fixes-bug="52572" due-to="Pascal Sancho"> + Prevent NPE on use of unsupported collapse-with-precedence; fall back to collapse. Fix checkstyle errors from prior commit. + </action> <action context="Code" dev="GA" type="fix" fixes-bug="52514" due-to="Luis Bernardo"> Ensure square image is appropriately scaled. </action> |