Parcourir la source

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
pull/26/head
Glenn Adams il y a 12 ans
Parent
révision
a54389dbe5

+ 4
- 4
src/documentation/content/xdocs/compliance.ihtml Voir le fichier

@@ -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=

+ 5
- 8
src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java Voir le fichier

@@ -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 );
}

/**

+ 13
- 7
src/java/org/apache/fop/fo/flow/table/Table.java Voir le fichier

@@ -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

+ 2
- 5
src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java Voir le fichier

@@ -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.");
}

+ 6
- 6
src/java/org/apache/fop/render/txt/TXTRenderer.java Voir le fichier

@@ -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);
}

+ 3
- 0
status.xml Voir le fichier

@@ -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>

Chargement…
Annuler
Enregistrer