Author: ssteiner Date: Tue May 5 08:12:02 2020 New Revision: 1877372 URL: http://svn.apache.org/viewvc?rev=1877372&view=rev Log: FOP-2934: Absolute element should not be removed
Added: xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/block-container_absolute-position_break-after.xml (with props) Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=1877372&r1=1877371&r2=1877372&view=diff ============================================================================== --- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original) +++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Tue May 5 08:12:02 2020 @@ -161,7 +161,7 @@ public class BlockContainerLayoutManager return indents; } - private boolean isAbsoluteOrFixed() { + protected boolean isAbsoluteOrFixed() { return (abProps.absolutePosition == EN_ABSOLUTE || abProps.absolutePosition == EN_FIXED); } Modified: xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java?rev=1877372&r1=1877371&r2=1877372&view=diff ============================================================================== --- xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java (original) +++ xmlgraphics/fop/trunk/fop-core/src/main/java/org/apache/fop/layoutmgr/ElementListUtils.java Tue May 5 08:12:02 2020 @@ -229,10 +229,20 @@ public final class ElementListUtils { public static boolean isEmptyBox(List elements) { if (elements.size() == 1 && elements.get(0) instanceof KnuthBox) { KnuthBox kb = (KnuthBox) elements.get(0); - if (kb.getWidth() == 0) { - return true; - } + return kb.getWidth() == 0 && !isAbsoluteOrFixed(kb.getPosition()); } return false; } + + private static boolean isAbsoluteOrFixed(Position pos) { + if (pos == null || pos == pos.getPosition()) { + return false; + } + LayoutManager lm = pos.getLM(); + if (lm instanceof BlockContainerLayoutManager && ((BlockContainerLayoutManager)lm).isAbsoluteOrFixed()) { + return true; + } + return isAbsoluteOrFixed(pos.getPosition()); + } + } Added: xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/block-container_absolute-position_break-after.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/block-container_absolute-position_break-after.xml?rev=1877372&view=auto ============================================================================== --- xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/block-container_absolute-position_break-after.xml (added) +++ xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/block-container_absolute-position_break-after.xml Tue May 5 08:12:02 2020 @@ -0,0 +1,67 @@ +<?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 absolutely positioned block-containers. + </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="Page_1" page-width="8.5in" page-height="11in"> + <fo:region-body region-name="Body"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="Page_Odd_Even" page-width="8.5in" page-height="11in"> + <fo:region-body region-name="Body"/> + </fo:simple-page-master> + <fo:simple-page-master master-name="Page_last" page-width="8.5in" page-height="11in"> + <fo:region-body margin-bottom="16pt" region-name="Body"/> + </fo:simple-page-master> + <fo:page-sequence-master master-name="Page_Sequence"> + <fo:repeatable-page-master-alternatives maximum-repeats="5"> + <fo:conditional-page-master-reference blank-or-not-blank="any" page-position="last" master-reference="Page_last"/> + <fo:conditional-page-master-reference page-position="first" master-reference="Page_1"/> + <fo:conditional-page-master-reference page-position="rest" master-reference="Page_Odd_Even"/> + </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="even" initial-page-number="1" master-reference="Page_Sequence"> + <fo:flow overflow="error-if-overflow" flow-name="Body"> + <fo:block-container page-break-after="always"> + <fo:block-container left="0.375in" top="0.375in" height="10.25in" width="7.75in" absolute-position="absolute"> + <fo:block>1</fo:block> + </fo:block-container> + </fo:block-container> + <fo:block-container page-break-after="always"> + <fo:block-container left="0.375in" height="10.25in" width="7.75in" top="0.375in" absolute-position="absolute"> + <fo:block>2</fo:block> + </fo:block-container> + </fo:block-container> + <fo:block-container page-break-after="always"> + <fo:block>3</fo:block> + </fo:block-container> + </fo:flow> + </fo:page-sequence> +</fo:root> + </fo> + <checks> + <eval expected="4" xpath="count(//pageViewport)"/> + </checks> +</testcase> Propchange: xmlgraphics/fop/trunk/fop/test/layoutengine/standard-testcases/block-container_absolute-position_break-after.xml ------------------------------------------------------------------------------ svn:eol-style = native --------------------------------------------------------------------- To unsubscribe, e-mail: fop-commits-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-commits-h...@xmlgraphics.apache.org