Author: jeremias
Date: Mon Jan 28 02:32:46 2008
New Revision: 615845
URL: http://svn.apache.org/viewvc?rev=615845&view=rev
Log:
Improve breaking for block-container and static-content so there are no more
"breaking artifacts" (like additional border lines) in the overflowing part of
the content anymore. This is done by removing all breaks from the result list
prior to constructing the area tree. The presence of breaks simply indicates
that there is an overflow.
Added:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_overflow_2.xml
(with props)
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/static-content_overflow_1.xml
(with props)
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_content_size_percentage.xml
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=615845&r1=615844&r2=615845&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
Mon Jan 28 02:32:46 2008
@@ -355,10 +355,7 @@
MinOptMax range = new MinOptMax(relDims.ipd);
BlockContainerBreaker breaker = new BlockContainerBreaker(this,
range);
breaker.doLayout(relDims.bpd, autoHeight);
- boolean contentOverflows = false;
- if (!breaker.isEmpty()) {
- contentOverflows = (breaker.deferredAlg.getPageBreaks().size()
> 1);
- }
+ boolean contentOverflows = breaker.isOverflow();
Position bcPosition = new BlockContainerPosition(this, breaker);
returnList.add(new KnuthBox(vpContentBPD, notifyPos(bcPosition),
false));
@@ -648,9 +645,9 @@
}
//Rendering all parts (not just the first) at once for the case
where the parts that
//overflow should be visible.
- //TODO Check if this has any unwanted side-effects. Feels a bit
like a hack.
+ this.deferredAlg.removeAllPageBreaks();
this.addAreas(this.deferredAlg,
- /*1*/ this.deferredAlg.getPageBreaks().size(),
+ this.deferredAlg.getPageBreaks().size(),
this.deferredOriginalList,
this.deferredEffectiveList);
}
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java?rev=615845&r1=615844&r2=615845&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
Mon Jan 28 02:32:46 2008
@@ -734,6 +734,20 @@
pageBreaks.addFirst(pageBreak);
}
+ /**
+ * Removes all page breaks from the result list. This is used by
block-containers and
+ * static-content when it is only desired to know where there is an
overflow but later the
+ * whole content should be painted as one part.
+ */
+ public void removeAllPageBreaks() {
+ if (pageBreaks == null) {
+ return;
+ }
+ while (pageBreaks.size() > 1) {
+ pageBreaks.removeFirst();
+ }
+ }
+
private int getPartCount() {
if (pageBreaks == null) {
return 0;
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java?rev=615845&r1=615844&r2=615845&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
Mon Jan 28 02:32:46 2008
@@ -25,9 +25,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.fop.area.RegionReference;
+
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
+import org.apache.fop.area.RegionReference;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.SideRegion;
@@ -339,11 +340,14 @@
protected void doPhase3(PageBreakingAlgorithm alg, int partCount,
BlockSequence originalList, BlockSequence effectiveList) {
- //Directly add areas after finding the breaks
- this.addAreas(alg, partCount, originalList, effectiveList);
if (partCount > 1) {
overflow = true;
}
+ //Rendering all parts (not just the first) at once for the case
where the parts that
+ //overflow should be visible.
+ alg.removeAllPageBreaks();
+ //Directly add areas after finding the breaks
+ this.addAreas(alg, 1, originalList, effectiveList);
}
protected void finishPart(PageBreakingAlgorithm alg, PageBreakPosition
pbp) {
Modified:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_content_size_percentage.xml
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_content_size_percentage.xml?rev=615845&r1=615844&r2=615845&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_content_size_percentage.xml
(original)
+++
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_content_size_percentage.xml
Mon Jan 28 02:32:46 2008
@@ -78,9 +78,7 @@
<!-- The 10% are ignored in this case. -->
<eval expected="57600" xpath="//flow/block[4]/@bpd"/> <!-- 4 lines -->
<eval expected="100000" xpath="//flow/block[4]/@ipd"/>
- <eval expected="28800" xpath="//flow/block[4]/block[1]/block[1]/@bpd"/>
<!-- the first 2 lines ... -->
+ <eval expected="57600" xpath="//flow/block[4]/block[1]/block[1]/@bpd"/>
<eval expected="50000" xpath="//flow/block[4]/block[1]/block[1]/@ipd"/>
- <eval expected="28800" xpath="//flow/block[4]/block[1]/block[2]/@bpd"/>
<!-- ... and the other 2 lines -->
- <eval expected="50000" xpath="//flow/block[4]/block[1]/block[2]/@ipd"/>
</checks>
</testcase>
Added:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_overflow_2.xml
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_overflow_2.xml?rev=615845&view=auto
==============================================================================
---
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_overflow_2.xml
(added)
+++
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_overflow_2.xml
Mon Jan 28 02:32:46 2008
@@ -0,0 +1,53 @@
+<?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 behaviour with overflowing content on block-containers.
+ </p>
+ <p>
+ Visual check: If there's a red line between the second and third line,
the
+ behaviour is wrong.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in"
page-height="5in" margin="20pt">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" text-align="justify">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block-container id="bc1" background-color="lightgray"
block-progression-dimension="2em">
+ <fo:block id="text" border="solid 1pt red"
border-before-width.conditionality="retain">Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Pellentesque hendrerit euismod velit. Nulla
facilisi. Etiam et risus at neque ultrices facilisis. Donec lectus est, nonummy
quis, rhoncus bibendum, porta at, nisl.</fo:block>
+ </fo:block-container>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <!-- fo:block must not be broken into multiple parts! -->
+ <eval expected="1" xpath="count(//[EMAIL PROTECTED]'text'])"/>
+
+ <!-- The following shows the overflow -->
+ <true expected="24000" xpath="//[EMAIL PROTECTED]'bc1' and
@is-viewport-area='true']/@bpd"/>
+ <true expected="60600" xpath="//[EMAIL PROTECTED]'bc1' and
@is-reference-area='true']/@bpd"/>
+ </checks>
+</testcase>
Propchange:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_overflow_2.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block-container_overflow_2.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/static-content_overflow_1.xml
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/static-content_overflow_1.xml?rev=615845&view=auto
==============================================================================
---
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/static-content_overflow_1.xml
(added)
+++
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/static-content_overflow_1.xml
Mon Jan 28 02:32:46 2008
@@ -0,0 +1,62 @@
+<?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 behaviour with overflowing content on static-content.
+ </p>
+ <p>
+ Visual check: If there's a red line between the second and third line,
the
+ behaviour is wrong.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in"
page-height="5in" margin="20pt">
+ <fo:region-body margin-top="2em" margin-bottom="2em"/>
+ <fo:region-before extent="2em" background-color="lightgray"/>
+ <fo:region-after extent="2em" background-color="lightgray"/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" text-align="justify">
+ <fo:static-content flow-name="xsl-region-before">
+ <fo:block id="text-before" border="solid 1pt red"
border-before-width.conditionality="retain">Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Pellentesque hendrerit euismod velit. Nulla
facilisi. Etiam et risus at neque ultrices facilisis. Donec lectus est, nonummy
quis, rhoncus bibendum, porta at, nisl.</fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="xsl-region-after">
+ <fo:block id="text-after" border="solid 1pt red"
border-before-width.conditionality="retain">Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Pellentesque hendrerit euismod velit. Nulla
facilisi. Etiam et risus at neque ultrices facilisis. Donec lectus est, nonummy
quis, rhoncus bibendum, porta at, nisl.</fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>xsl-region-body</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <!-- fo:block must not be broken into multiple parts! -->
+ <eval expected="1" xpath="count(//[EMAIL PROTECTED]'text-before'])"/>
+ <eval expected="1" xpath="count(//[EMAIL PROTECTED]'text-after'])"/>
+
+ <!-- The following shows the overflow -->
+ <true expected="24000" xpath="//regionBefore/@bpd"/>
+ <true expected="24000" xpath="//regionAfter/@bpd"/>
+ <true expected="60600" xpath="sum(//[EMAIL
PROTECTED]'text-before']/@bpda)"/>
+ <true expected="60600" xpath="sum(//[EMAIL
PROTECTED]'text-after']/@bpda)"/>
+ </checks>
+</testcase>
Propchange:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/static-content_overflow_1.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/static-content_overflow_1.xml
------------------------------------------------------------------------------
svn:keywords = Id
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]