You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ss...@apache.org on 2024/07/30 10:26:12 UTC

(xmlgraphics-fop) branch main updated: FOP-3195: Skip written block ipds inside float

This is an automated email from the ASF dual-hosted git repository.

ssteiner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xmlgraphics-fop.git


The following commit(s) were added to refs/heads/main by this push:
     new f9e031ace FOP-3195: Skip written block ipds inside float
f9e031ace is described below

commit f9e031ace069602f5a67222b32e2f1ce3fdc54fc
Author: Simon Steiner <ss...@apache.org>
AuthorDate: Tue Jul 30 11:25:57 2024 +0100

    FOP-3195: Skip written block ipds inside float
---
 .../fop/layoutmgr/AbstractBaseLayoutManager.java   |  8 +--
 .../fop/layoutmgr/FloatContentLayoutManager.java   |  2 +-
 .../layoutengine/standard-testcases/float_10.xml   | 57 ++++++++++++++++++++++
 3 files changed, 59 insertions(+), 8 deletions(-)

diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
index a3edc2088..dba4723c9 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
@@ -209,14 +209,8 @@ public abstract class AbstractBaseLayoutManager
                 "getContentAreaIPD() called when it should have been overridden");
     }
 
-    /**
-     * {@inheritDoc}
-     * <i>NOTE: Should be overridden by subclasses.
-     * Default implementation throws an <code>UnsupportedOperationException</code>.</i>
-     */
     public int getContentAreaBPD() {
-        throw new UnsupportedOperationException(
-                "getContentAreaBPD() called when it should have been overridden");
+        return 0;
     }
 
     /** {@inheritDoc} */
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java
index b489760ce..8a82f2398 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/FloatContentLayoutManager.java
@@ -113,7 +113,7 @@ public class FloatContentLayoutManager extends SpacedBorderedPaddedBlockLayoutMa
         for (LayoutManager childLM : childLMs) {
             if (childLM instanceof TableLayoutManager) {
                 ipd += childLM.getContentAreaIPD();
-            } else {
+            } else if (childLM.getContentAreaBPD() != -1) {
                 ipd += getContentAreaIPD(childLM.getChildLMs());
             }
         }
diff --git a/fop/test/layoutengine/standard-testcases/float_10.xml b/fop/test/layoutengine/standard-testcases/float_10.xml
new file mode 100644
index 000000000..5969c6626
--- /dev/null
+++ b/fop/test/layoutengine/standard-testcases/float_10.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testcase>
+  <info>
+    <p>
+      Test position of float containing tables
+    </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="0.5in" margin-bottom="0.5in" master-name="LetterPage" margin-right="0.5in" margin-left="0.5in" page-width="8.5in" page-height="11in">
+          <fo:region-body margin-top="3.3in" region-name="LetterPageBody" margin-bottom="2in" />
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence format="1" master-reference="LetterPage">
+        <fo:flow flow-name="LetterPageBody">
+          <fo:block>
+            <fo:float space-before="2in" float="right">
+              <fo:block>
+                <fo:block-container height="1.85in" width="2.5in">
+                  <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>Visit My Account</fo:block>
+                          </fo:table-cell>
+                        </fo:table-row>
+                      </fo:table-body>
+                    </fo:table>
+                    <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:leader/>
+                            </fo:block>
+                          </fo:table-cell>
+                        </fo:table-row>
+                      </fo:table-body>
+                    </fo:table>
+                  </fo:block>
+                </fo:block-container>
+              </fo:block>
+            </fo:float>
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="180000" xpath="//block[2]/@ipd" />
+    <eval expected="Visit" xpath="//block[2]//word" />
+  </checks>
+</testcase>
\ No newline at end of file


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