You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ga...@apache.org on 2012/04/14 18:48:59 UTC

svn commit: r1326144 - in /xmlgraphics/fop/trunk: ./ src/documentation/content/xdocs/ src/java/org/apache/fop/fo/flow/table/ src/java/org/apache/fop/layoutmgr/table/ src/java/org/apache/fop/render/txt/

Author: gadams
Date: Sat Apr 14 16:48:59 2012
New Revision: 1326144

URL: http://svn.apache.org/viewvc?rev=1326144&view=rev
Log:
Bugzilla #52572: Prevent NPE on use of unsupported collapse-with-precedence; fall back to collapse. Fix checkstyle errors from prior commit.

Modified:
    xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/Table.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/txt/TXTRenderer.java
    xmlgraphics/fop/trunk/status.xml

Modified: xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml?rev=1326144&r1=1326143&r2=1326144&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml (original)
+++ xmlgraphics/fop/trunk/src/documentation/content/xdocs/compliance.ihtml Sat Apr 14 16:48:59 2012
@@ -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=

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java?rev=1326144&r1=1326143&r2=1326144&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/ConditionalBorder.java Sat Apr 14 16:48:59 2012
@@ -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 );
     }
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/Table.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/Table.java?rev=1326144&r1=1326143&r2=1326144&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/Table.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/table/Table.java Sat Apr 14 16:48:59 2012
@@ -147,13 +147,19 @@ public class Table extends TableFObj imp
             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

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java?rev=1326144&r1=1326143&r2=1326144&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java Sat Apr 14 16:48:59 2012
@@ -49,7 +49,7 @@ public abstract class CollapsingBorderMo
 
     //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 CollapsingBorderMo
                 }
                 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.");
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/txt/TXTRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/txt/TXTRenderer.java?rev=1326144&r1=1326143&r2=1326144&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/txt/TXTRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/txt/TXTRenderer.java Sat Apr 14 16:48:59 2012
@@ -195,7 +195,7 @@ public class TXTRenderer extends Abstrac
      */
     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 Abstrac
         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 Abstrac
      */
     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 Abstrac
     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);
     }

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=1326144&r1=1326143&r2=1326144&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Sat Apr 14 16:48:59 2012
@@ -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>



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org