]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugfix: tables nested in inline elements caused a NullPointerException.
authorJeremias Maerki <jeremias@apache.org>
Mon, 15 May 2006 09:59:59 +0000 (09:59 +0000)
committerJeremias Maerki <jeremias@apache.org>
Mon, 15 May 2006 09:59:59 +0000 (09:59 +0000)
Furthermore, keep-together handling was not appropriate when a table is nested in an inline (fixes a ClassCastException).
Finally, TableContentPosition did not indicate that it generates area which made them be ignored by the InlineLM.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@406596 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
status.xml
test/layoutengine/standard-testcases/inline_table_nested_1.xml [new file with mode: 0644]

index 9c3e897809677c77b27d0ecbea92102ce428a87a..3c6b7c6f2cab133d648e310141611065f9c1cfe0 100644 (file)
@@ -1127,6 +1127,11 @@ public class TableContentLayoutManager implements PercentBaseContext {
             }
         }
         
+        /** @see org.apache.fop.layoutmgr.Position#generatesAreas() */
+        public boolean generatesAreas() {
+            return true;
+        }
+
         /** @see java.lang.Object#toString() */
         public String toString() {
             StringBuffer sb = new StringBuffer("TableContentPosition:");
index a50cf1317166d4809291989d32badcc657d4c5d8..2810401aea557ef754a76fc7bc5d82b12ee75285 100644 (file)
@@ -61,7 +61,6 @@ public class TableLayoutManager extends BlockStackingLayoutManager
 
     private Block curBlockArea;
 
-    private int referenceBPD;
     private double tableUnits;
     private boolean autoLayout = true;
 
@@ -156,7 +155,6 @@ public class TableLayoutManager extends BlockStackingLayoutManager
             }
         }
 
-        referenceBPD = context.getStackLimit().opt;
         referenceIPD = context.getRefIPD();
 
         if (getTable().getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
@@ -449,7 +447,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager
      */
     public boolean mustKeepTogether() {
         //TODO Keeps will have to be more sophisticated sooner or later
-        return ((BlockLevelLayoutManager)getParent()).mustKeepTogether() 
+        return super.mustKeepTogether() 
                 || !getTable().getKeepTogether().getWithinPage().isAuto()
                 || !getTable().getKeepTogether().getWithinColumn().isAuto();
     }
@@ -495,14 +493,6 @@ public class TableLayoutManager extends BlockStackingLayoutManager
         }
     }
     
-    /**
-     * Returns the BPD of the content area
-     * @return the BPD of the content area
-     */
-    public int getContentAreaBPD() {
-        return referenceBPD;
-    }
-    
     /** @see org.apache.fop.layoutmgr.ConditionalElementListener */
     public void notifySpace(RelSide side, MinOptMax effectiveLength) {
         if (RelSide.BEFORE == side) {
index c2f835f6523c1801d68fb02d92f2bd678ca9ef6d..6eeebfe14a86fc1935d323cb736cf77253874232 100644 (file)
@@ -27,6 +27,9 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="JM" type="fix" fixes-bug="39443">
+        Bugfix: tables nested in inline elements caused a NullPointerException.
+      </action>
       <action context="Code" dev="JM" type="update">
         The default sRGB color profile provided by the Java class library is no longer
         embedded if it is encountered. This should reduce the PDF size considerably.
diff --git a/test/layoutengine/standard-testcases/inline_table_nested_1.xml b/test/layoutengine/standard-testcases/inline_table_nested_1.xml
new file mode 100644 (file)
index 0000000..9b483aa
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+  <info>
+    <p>
+      This test checks fo:inline and nested fo:tables.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="normal">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>
+            <fo:inline>part1<fo:table width="100%" table-layout="fixed">
+                <fo:table-column column-width="65%"/>
+                <fo:table-column column-width="10%"/>
+                <fo:table-column column-width="25%"/>
+                <fo:table-body>
+                  <fo:table-row>
+                    <fo:table-cell>
+                      <fo:block>table content</fo:block>
+                    </fo:table-cell>
+                  </fo:table-row>
+                </fo:table-body>
+              </fo:table>part2</fo:inline>
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="3" xpath="count(//flow/block[1]/lineArea)"/>
+    <eval expected="table content" xpath="//flow/block[1]/lineArea[2]"/>
+  </checks>
+</testcase>