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 ss...@apache.org on 2021/05/25 09:08:59 UTC

svn commit: r1890190 - in /xmlgraphics/fop/trunk: fop-core/src/main/java/org/apache/fop/layoutmgr/inline/ fop-core/src/main/java/org/apache/fop/layoutmgr/table/ fop/test/layoutengine/standard-testcases/

Author: ssteiner
Date: Tue May 25 09:08:58 2021
New Revision: 1890190

URL: http://svn.apache.org/viewvc?rev=1890190&view=rev
Log:
FOP-3014: ConcurrentModificationException for table cell

Added:
    xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table-cell_height2.xml   (with props)
Modified:
    xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
    xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ActiveCell.java
    xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java

Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java?rev=1890190&r1=1890189&r2=1890190&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java Tue May 25 09:08:58 2021
@@ -436,10 +436,12 @@ public class TextLayoutManager extends L
         }
 
         private void setBlockProgressionOffset() {
-            if (blockProgressionDimension == alignmentContext.getHeight()) {
-                textArea.setBlockProgressionOffset(0);
-            } else {
-                textArea.setBlockProgressionOffset(alignmentContext.getOffset());
+            if (alignmentContext != null) {
+                if (blockProgressionDimension == alignmentContext.getHeight()) {
+                    textArea.setBlockProgressionOffset(0);
+                } else {
+                    textArea.setBlockProgressionOffset(alignmentContext.getOffset());
+                }
             }
         }
 

Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ActiveCell.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ActiveCell.java?rev=1890190&r1=1890189&r2=1890190&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ActiveCell.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/ActiveCell.java Tue May 25 09:08:58 2021
@@ -239,25 +239,23 @@ class ActiveCell {
     private void handleExplicitHeight(MinOptMax cellBPD, MinOptMax rowBPD) {
         int minBPD = Math.max(cellBPD.getMin(), rowBPD.getMin());
         if (minBPD > 0) {
-            ListIterator iter = elementList.listIterator();
             int cumulateLength = 0;
             boolean prevIsBox = false;
-            while (iter.hasNext() && cumulateLength < minBPD) {
-                KnuthElement el = (KnuthElement) iter.next();
+            for (int i = 0; i < elementList.size() && cumulateLength < minBPD; i++) {
+                KnuthElement el = (KnuthElement) elementList.get(i);
                 if (el.isBox()) {
                     prevIsBox = true;
                     cumulateLength += el.getWidth();
                 } else if (el.isGlue()) {
                     if (prevIsBox) {
-                        elementList.add(iter.nextIndex() - 1,
-                                new FillerPenalty(minBPD - cumulateLength));
+                        elementList.add(i, new FillerPenalty(minBPD - cumulateLength));
                     }
                     prevIsBox = false;
                     cumulateLength += el.getWidth();
                 } else {
                     prevIsBox = false;
                     if (cumulateLength + el.getWidth() < minBPD) {
-                        iter.set(new FillerPenalty((KnuthPenalty) el, minBPD - cumulateLength));
+                        elementList.set(i, new FillerPenalty((KnuthPenalty) el, minBPD - cumulateLength));
                     }
                 }
             }

Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=1890190&r1=1890189&r2=1890190&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Tue May 25 09:08:58 2021
@@ -703,7 +703,7 @@ public class TableCellLayoutManager exte
      * @param childArea the child to add to the cell
      */
     public void addChildArea(Area childArea) {
-        if (curBlockArea != null) {
+        if (curBlockArea != null && childArea instanceof Block) {
             curBlockArea.addBlock((Block) childArea);
         }
     }

Added: xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table-cell_height2.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table-cell_height2.xml?rev=1890190&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table-cell_height2.xml (added)
+++ xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table-cell_height2.xml Tue May 25 09:08:58 2021
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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 tables, especially table-cells. This test: height and block-progression-dimension.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="1">
+          <fo:region-body region-name="xsl-region-body"/>
+        </fo:simple-page-master>
+        <fo:page-sequence-master master-name="2">
+          <fo:repeatable-page-master-reference maximum-repeats="99999" master-reference="1"/>
+        </fo:page-sequence-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="2">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block>
+            <fo:block>
+              <fo:wrapper>
+                <fo:table>
+                  <fo:table-column column-width="226pt"/>
+                  <fo:table-column column-width="198pt"/>
+                  <fo:table-body>
+                    <fo:table-row height="5mm">
+                      <fo:table-cell>
+                        <fo:wrapper>
+                          <fo:wrapper>
+                            <fo:wrapper>
+                              <fo:block>
+                                <fo:wrapper></fo:wrapper>
+                              </fo:block>
+                            </fo:wrapper>
+                          </fo:wrapper>
+                        </fo:wrapper>
+                      </fo:table-cell>
+                      <fo:table-cell>
+                        <fo:wrapper>
+                          <fo:wrapper></fo:wrapper>
+                        </fo:wrapper>
+                      </fo:table-cell>
+                    </fo:table-row>
+                  </fo:table-body>
+                </fo:table>
+              </fo:wrapper>
+            </fo:block>
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="11100" xpath="//lineArea/@bpd"/>
+  </checks>
+</testcase>

Propchange: xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table-cell_height2.xml
------------------------------------------------------------------------------
    svn:eol-style = native



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