xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sstei...@apache.org
Subject svn commit: r1871261 - in /xmlgraphics/fop/trunk: fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java fop/test/layoutengine/standard-testcases/table_border_padding_7.xml
Date Thu, 12 Dec 2019 09:42:19 GMT
Author: ssteiner
Date: Thu Dec 12 09:42:19 2019
New Revision: 1871261

URL: http://svn.apache.org/viewvc?rev=1871261&view=rev
Log:
FOP-2894: Fit table contents onto current page

Added:
    xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table_border_padding_7.xml
  (with props)
Modified:
    xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java

Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java?rev=1871261&r1=1871260&r2=1871261&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java
(original)
+++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableStepper.java
Thu Dec 12 09:42:19 2019
@@ -274,17 +274,19 @@ public class TableStepper {
 
             laststep = step;
             step = getNextStep();
-
             if (penaltyOrGlueLen < 0) {
+                int shrink = 0;
+                int stretch = 0;
+                int width = -penaltyOrGlueLen;
                 if (keep.getPenalty() == KnuthElement.INFINITE) {
-                    if (boxLen > -penaltyOrGlueLen && boxLen < maxRemainingHeight)
{
-                        returnList.add(new KnuthGlue(boxLen, 0, 0, new Position(null), true));
-                    } else {
-                        returnList.add(new KnuthGlue(0, -penaltyOrGlueLen, 0, new Position(null),
true));
+                    width = (boxLen + -penaltyOrGlueLen) / 2;
+                    if (-penaltyOrGlueLen > maxRemainingHeight) {
+                        width = 0;
                     }
-                } else {
-                    returnList.add(new KnuthGlue(-penaltyOrGlueLen, 0, 0, new Position(null),
true));
+                    stretch = Math.max(boxLen, -penaltyOrGlueLen);
+                    shrink = Math.min(boxLen, -penaltyOrGlueLen);
                 }
+                returnList.add(new KnuthGlue(width, stretch, shrink, new Position(null),
true));
             }
         } while (step >= 0);
         assert !returnList.isEmpty();

Added: xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table_border_padding_7.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table_border_padding_7.xml?rev=1871261&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table_border_padding_7.xml
(added)
+++ xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table_border_padding_7.xml
Thu Dec 12 09:42:19 2019
@@ -0,0 +1,203 @@
+<?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 border and padding conditionality on table.
+    </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 margin-top="10mm" master-name="FirstPage" page-width="210mm"
page-height="297mm" margin-bottom="5mm" margin-right="5mm" margin-left="5mm">
+      <fo:region-body margin-bottom="25mm" margin-top="20mm" margin-right="7mm" margin-left="7mm"
region-name="PageBody"/>
+      
+    </fo:simple-page-master>
+    <fo:simple-page-master margin-top="10mm" margin-right="5mm" margin-left="5mm" margin-bottom="5mm"
master-name="ReversePage" page-width="210mm" page-height="297mm">
+      <fo:region-body margin-bottom="30mm" margin-top="4mm" margin-right="7mm" margin-left="7mm"
region-name="PageBody"/>
+      
+    </fo:simple-page-master>
+    <fo:simple-page-master margin-top="10mm" margin-left="5mm" margin-right="5mm" master-name="ContinuationPage"
page-width="210mm" page-height="297mm" margin-bottom="5mm">
+      <fo:region-body margin-top="20mm" margin-bottom="20mm" margin-right="7mm" margin-left="7mm"
region-name="PageBody"/>
+      
+    </fo:simple-page-master>
+    <fo:page-sequence-master master-name="PageSequence">
+      <fo:repeatable-page-master-alternatives>
+        <fo:conditional-page-master-reference odd-or-even="odd" page-position="first"
master-reference="FirstPage"/>
+        <fo:conditional-page-master-reference odd-or-even="even" master-reference="ReversePage"/>
+        <fo:conditional-page-master-reference odd-or-even="odd" page-position="rest" master-reference="ContinuationPage"/>
+      </fo:repeatable-page-master-alternatives>
+    </fo:page-sequence-master>
+  </fo:layout-master-set>
+  <fo:page-sequence format="1" id="th_default_sequence1" force-page-count="auto" initial-page-number="auto"
master-reference="PageSequence">
+   
+    <fo:flow flow-name="PageBody">
+     
+      <fo:block-container>
+        <fo:block>
+          <fo:block  font-size="18pt"   keep-with-next.within-column="always"  space-before="7pt"
text-align="left">Your retirement options</fo:block>
+          <fo:table id="1" border-collapse="separate"  border-style="solid" border-width="2pt"
 keep-together.within-page="always" padding="10pt" space-before="7pt" table-layout="fixed"
width="100%">
+            <fo:table-column column-width="proportional-column-width(100)" column-number="1"/>
+            <fo:table-body>
+              <fo:table-row>
+                <fo:table-cell>
+                  <fo:block>
+                    <fo:block>
+                      <fo:block   font-size="12pt"   keep-with-next.within-column="always"
 space-before="7pt" role="H2" id="N100CD">You’ll need to choose an option for your
pension savings, such as:</fo:block>
+                      <fo:list-block  font-size="10pt"  space-before="7pt" >
+                        <fo:list-item    space-before="6pt">
+                          <fo:list-item-label  end-indent="label-end()"  font-size="9pt"
>
+                            <fo:block>
+                              <fo:inline>●</fo:inline>
+                            </fo:block>
+                          </fo:list-item-label>
+                          <fo:list-item-body     start-indent="body-start()">
+                            <fo:block>
+                              <fo:inline >Buy</fo:inline>
+                            </fo:block>
+                          </fo:list-item-body>
+                        </fo:list-item>
+                        <fo:list-item    space-before="6pt">
+                          <fo:list-item-label  end-indent="label-end()"  font-size="9pt"
>
+                            <fo:block>
+                              <fo:inline>●</fo:inline>
+                            </fo:block>
+                          </fo:list-item-label>
+                          <fo:list-item-body     start-indent="body-start()">
+                            <fo:block>
+                              <fo:inline >Re</fo:inline>
+                            </fo:block>
+                          </fo:list-item-body>
+                        </fo:list-item>
+                        <fo:list-item    space-before="6pt">
+                          <fo:list-item-label  end-indent="label-end()"  font-size="9pt"
>
+                            <fo:block>
+                              <fo:inline>●</fo:inline>
+                            </fo:block>
+                          </fo:list-item-label>
+                          <fo:list-item-body     start-indent="body-start()">
+                            <fo:block>
+                              <fo:inline >Take</fo:inline>
+                            </fo:block>
+                          </fo:list-item-body>
+                        </fo:list-item>
+                      </fo:list-block>
+                      <fo:list-block  font-size="10pt"  space-before="7pt" >
+                        <fo:list-item    space-before="6pt">
+                          <fo:list-item-label  end-indent="label-end()"  font-size="9pt"
>
+                            <fo:block>
+                              <fo:inline>●</fo:inline>
+                            </fo:block>
+                          </fo:list-item-label>
+                          <fo:list-item-body     start-indent="body-start()">
+                            <fo:block>
+                              <fo:inline >Mix</fo:inline>
+                            </fo:block>
+                          </fo:list-item-body>
+                        </fo:list-item>
+                        <fo:list-item    space-before="6pt">
+                          <fo:list-item-label  end-indent="label-end()"  font-size="9pt"
>
+                            <fo:block>
+                              <fo:inline>●</fo:inline>
+                            </fo:block>
+                          </fo:list-item-label>
+                          <fo:list-item-body     start-indent="body-start()">
+                            <fo:block>
+                              <fo:inline >Leave</fo:inline>
+                            </fo:block>
+                          </fo:list-item-body>
+                        </fo:list-item>
+                      </fo:list-block>
+                    </fo:block>
+                  </fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:table id="2" border-collapse="separate" border-style="solid"   keep-together.within-page="always"
padding="10pt" space-before="7pt" table-layout="fixed" width="100%">
+            <fo:table-column column-width="proportional-column-width(100)" column-number="1"/>
+            <fo:table-body>
+              <fo:table-row>
+                <fo:table-cell>
+                  <fo:block>
+                    <fo:block   font-size="12pt"   keep-with-next.within-column="always"
 space-before="7pt" role="H2" id="N10114">test test test test test test test test </fo:block>
+                    <fo:block   font-size="10pt" >test test test test test test test
test test test test test test test test </fo:block>
+                    <fo:block   font-size="10pt"  space-before="7pt">
+                      test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test </fo:block>
+                    <fo:table table-layout="fixed" width="100%">
+                      <fo:table-column column-width="proportional-column-width(100)" column-number="1"/>
+                      <fo:table-body>
+                        <fo:table-row>
+                          <fo:table-cell>
+                            <fo:block>
+                              <fo:block   font-size="10pt"  space-before="7pt" text-align="center">
+                                <fo:inline >test test test test test test test test
test test test </fo:inline>
+                              </fo:block>
+                            </fo:block>
+                          </fo:table-cell>
+                        </fo:table-row>
+                      </fo:table-body>
+                    </fo:table>
+                    <fo:block   font-size="10pt"  space-before="7pt">
+                      test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
</fo:block>
+                    <fo:block   font-size="10pt"  space-before="7pt">
+                      test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test </fo:block>
+                    <fo:block   font-size="10pt"  space-before="7pt">
+                      test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test </fo:block>
+                    <fo:block   font-size="10pt"  space-before="7pt">
+                     test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test 
+                      </fo:block>
+                    <fo:block   font-size="10pt"  space-before="7pt">test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test </fo:block>
+
+                  </fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+          <fo:table id="3" border-collapse="separate" border-style="solid"   keep-together.within-page="always"
padding="10pt" space-before="7pt" table-layout="fixed" width="100%">
+            <fo:table-column column-width="proportional-column-width(100)" column-number="1"/>
+            <fo:table-body>
+              <fo:table-row>
+                <fo:table-cell>
+                  <fo:block>        
+                    <fo:block   font-size="10pt" >test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test </fo:block>
+                    <fo:block   font-size="10pt"  space-before="7pt">test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test test test test test test test test test
test test test test test test test test test test </fo:block>
+          
+                  </fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+        
+          
+       
+       
+        </fo:block>
+      </fo:block-container>
+     
+    </fo:flow>
+  </fo:page-sequence>
+</fo:root>
+
+  </fo>
+  <checks>
+    <eval expected="1" xpath="count(//pageViewport)"/>
+    <eval expected="587" xpath="count(//pageViewport[1]//word)"/>
+  </checks>
+</testcase>

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

Propchange: xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/table_border_padding_7.xml
------------------------------------------------------------------------------
    svn:executable = *



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


Mime
View raw message