aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Furini <lfurini@apache.org>2008-07-07 13:52:36 +0000
committerLuca Furini <lfurini@apache.org>2008-07-07 13:52:36 +0000
commitb8afaae2940a6020e8593a4e83ee9036b9f97666 (patch)
tree2d85b1de8699b3700af229913ef762c3563912f3
parent61ce6bf89af376daa19d905d5c3dbf69d7e82713 (diff)
downloadxmlgraphics-fop-b8afaae2940a6020e8593a4e83ee9036b9f97666.tar.gz
xmlgraphics-fop-b8afaae2940a6020e8593a4e83ee9036b9f97666.zip
Fixing absolute positioning of block-containers: bottom and right distances were not taken into account
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@674489 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java9
-rw-r--r--status.xml4
-rw-r--r--test/layoutengine/standard-testcases/block-container_absolute-position_tblr.xml87
3 files changed, 100 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
index 732cb1ae7..022ba1d90 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
@@ -694,9 +694,17 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
int y = 0;
if (abProps.left.getEnum() != EN_AUTO) {
x = abProps.left.getValue(this);
+ } else if (abProps.right.getEnum() != EN_AUTO
+ && width.getEnum() != EN_AUTO) {
+ x = getReferenceAreaIPD()
+ - abProps.right.getValue(this) - width.getValue(this);
}
if (abProps.top.getEnum() != EN_AUTO) {
y = abProps.top.getValue(this);
+ } else if (abProps.bottom.getEnum() != EN_AUTO
+ && height.getEnum() != EN_AUTO) {
+ y = getReferenceAreaBPD()
+ - abProps.bottom.getValue(this) - height.getValue(this);
}
return new Point(x, y);
}
@@ -1085,3 +1093,4 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager
}
+
diff --git a/status.xml b/status.xml
index 5bbcd4bd1..4dc8b9d05 100644
--- a/status.xml
+++ b/status.xml
@@ -53,6 +53,10 @@
<changes>
<release version="FOP Trunk" date="TBD">
+ <action context="Layout" dev="LF" type="fix">
+ Fixed absolute positioning of block-containers when specified
+ using right and bottom instead of left and top.
+ </action>
<action context="Renderers" dev="AC" type="add">
Added PDF encryption parameter support in configuration.
</action>
diff --git a/test/layoutengine/standard-testcases/block-container_absolute-position_tblr.xml b/test/layoutengine/standard-testcases/block-container_absolute-position_tblr.xml
new file mode 100644
index 000000000..f9919d2c1
--- /dev/null
+++ b/test/layoutengine/standard-testcases/block-container_absolute-position_tblr.xml
@@ -0,0 +1,87 @@
+<?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 using top, bottom, left and right distances
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="simple" page-width="6in" page-height="5in" margin="0.5in">
+ <fo:region-body margin="0.5in"/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="simple">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block font-size="48pt">position</fo:block>
+ <fo:block font-size="48pt" text-align="right"><fo:inline>NOT</fo:inline> ok!</fo:block>
+ <fo:block-container absolute-position="absolute" width="51pt" height="30pt" background-color="red" top="57pt" left="109pt">
+ <!-- nested container -->
+ <fo:block-container absolute-position="absolute" width="5pt" height="5pt" background-color="white" bottom="20pt" right="41pt">
+ <fo:block></fo:block>
+ </fo:block-container>
+ </fo:block-container>
+ <fo:block-container absolute-position="absolute" width="51pt" height="30pt" background-color="yellow" top="57pt" right="77pt">
+ <fo:block/>
+ </fo:block-container>
+ <fo:block-container absolute-position="absolute" width="51pt" height="30pt" background-color="blue" bottom="99pt" left="109pt">
+ <fo:block/>
+ </fo:block-container>
+ <fo:block-container absolute-position="absolute" width="51pt" height="30pt" background-color="green" bottom="99pt" right="77pt">
+ <fo:block/>
+ </fo:block-container>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <!-- *** first block-container *** -->
+ <true xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[3]/@is-viewport-area"/>
+ <eval expected="absolute" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[3]/@positioning"/>
+ <eval expected="109000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[3]/@left-position"/>
+ <eval expected="57000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[3]/@top-position"/>
+
+ <!-- *** nested block-container *** -->
+ <true xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[3]/block[1]/block[1]/@is-viewport-area"/>
+ <eval expected="absolute" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[3]/block[1]/block[1]/@positioning"/>
+ <eval expected="5000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[3]/block[1]/block[1]/@left-position"/>
+ <eval expected="5000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[3]/block[1]/block[1]/@top-position"/>
+
+ <!-- *** second block-container *** -->
+ <true xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/@is-viewport-area"/>
+ <eval expected="absolute" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/@positioning"/>
+ <eval expected="160000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/@left-position"/>
+ <eval expected="57000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/@top-position"/>
+
+ <!-- *** third block-container *** -->
+ <true xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[5]/@is-viewport-area"/>
+ <eval expected="absolute" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[5]/@positioning"/>
+ <eval expected="109000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[5]/@left-position"/>
+ <eval expected="87000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[5]/@top-position"/>
+
+ <!-- *** fourth block-container *** -->
+ <true xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[6]/@is-viewport-area"/>
+ <eval expected="absolute" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[6]/@positioning"/>
+ <eval expected="160000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[6]/@left-position"/>
+ <eval expected="87000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[6]/@top-position"/>
+
+ </checks>
+</testcase>