You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/09/14 17:02:28 UTC

svn commit: r280872 - in /xmlgraphics/fop/trunk/test/layoutengine: disabled-testcases.txt testcases/block_padding_2.xml

Author: jeremias
Date: Wed Sep 14 08:02:24 2005
New Revision: 280872

URL: http://svn.apache.org/viewcvs?rev=280872&view=rev
Log:
Ouch. The penalties are completely wrong if a higher-level block defines non-conditional padding.

Added:
    xmlgraphics/fop/trunk/test/layoutengine/testcases/block_padding_2.xml   (with props)
Modified:
    xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt

Modified: xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt?rev=280872&r1=280871&r2=280872&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt Wed Sep 14 08:02:24 2005
@@ -1,6 +1,7 @@
 character_background-image.xml
 block-container_reference-orientation_bug36391.xml
 block_font-stretch.xml
+block_padding_2.xml
 block_space-before_space-after_2.xml
 block_space-before_space-after_3.xml
 block_word-spacing.xml

Added: xmlgraphics/fop/trunk/test/layoutengine/testcases/block_padding_2.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/testcases/block_padding_2.xml?rev=280872&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/testcases/block_padding_2.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/testcases/block_padding_2.xml Wed Sep 14 08:02:24 2005
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2005 The Apache Software Foundation
+
+  Licensed 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 non-conditional before- and after-padding in break-situations.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="normal" page-width="3in" page-height="2in">
+          <fo:region-body/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="normal">
+        <fo:flow flow-name="xsl-region-body">
+          <fo:block background-color="lightgray" padding-before="30pt" padding-before.conditionality="retain" padding-after="30pt" padding-after.conditionality="retain">
+            <fo:block background-color="yellow">line1</fo:block>
+            <fo:block background-color="orange">line2</fo:block>
+            <fo:block background-color="yellow">line3</fo:block>
+            <fo:block background-color="orange">line4</fo:block>
+            <fo:block background-color="yellow">line5</fo:block>
+            <fo:block background-color="orange">line6</fo:block>
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <element-list category="breaker">
+      <box w="30000"/>
+      <box w="14400"/>
+      <penalty w="30000" p="0"/> <!-- w="30000" is for the padding-after -->
+      <glue w="-30000" aux="true"/> <!-- get's discarded if a break happens on the penalty above -->
+      <box w="0"/>
+      <penalty w="0" p="INF"/>
+      <glue w="30000" aux="true"/> <!-- w="30000" is for the padding-before -->
+      <box w="14400"/>
+      <penalty w="30000" p="0"/>
+      <glue w="-30000" aux="true"/>
+      <box w="0"/>
+      <penalty w="0" p="INF"/>
+      <glue w="30000" aux="true"/>
+      <box w="14400"/>
+      <penalty w="30000" p="0"/>
+      <glue w="-30000" aux="true"/>
+      <box w="0"/>
+      <penalty w="0" p="INF"/>
+      <glue w="30000" aux="true"/>
+      <box w="14400"/>
+      <penalty w="30000" p="0"/>
+      <glue w="-30000" aux="true"/>
+      <box w="0"/>
+      <penalty w="0" p="INF"/>
+      <glue w="30000" aux="true"/>
+      <box w="14400"/>
+      <penalty w="30000" p="0"/>
+      <glue w="-30000" aux="true"/>
+      <box w="0"/>
+      <penalty w="0" p="INF"/>
+      <glue w="30000" aux="true"/>
+      <box w="14400"/>
+      <box w="30000"/>
+      <skip>3</skip>
+    </element-list>
+  </checks>
+</testcase>

Propchange: xmlgraphics/fop/trunk/test/layoutengine/testcases/block_padding_2.xml
------------------------------------------------------------------------------
    svn:keywords = Id



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


Re: svn commit: r280872 - in /xmlgraphics/fop/trunk/test/layoutengine: disabled-testcases.txt testcases/block_padding_2.xml

Posted by Simon Pepping <sp...@leverkruid.nl>.
I see my error; I did not realize the influence of the retained
padding.

This situation is very similar to tables with their headers and
footers. There needs to be a penalty equal to the widths of the
padding-after and padding-before below each block. A block equal to
the widths of the padding-after and padding-before comes at the end of
the block.

I do not have time to look up the details, as I am going away
for a few days.

Regards, Simon

On Thu, Sep 15, 2005 at 08:58:37AM +0200, Jeremias Maerki wrote:
> 
> On 14.09.2005 22:44:07 Simon Pepping wrote:
> > On Wed, Sep 14, 2005 at 05:05:37PM +0200, Jeremias Maerki wrote:
> > > Can one of the Knuth specialist please review my element list in the new
> > > test case below? Thanks.
> > 
> > The element list seems OK to me. The first page also seems OK to
> > me. What is strange is that the first line on the second page has
> > vpos="190800", i.e. 60000 below the end of the last line on page
> > 1. Clearly 30000 padding after and padding before are added. Is this
> > not a problem of the area part of the code?
> 
> I didn't even look at the area tree, but you're right vpos is a bit
> strange, though I get 162000, not 190800. :-) But I wouldn't put too
> much weight on the vpos attribute since it simply writes out the
> currentBPPosition. I'm going to investigate that a little more. I
> believe we can't start talking about something wrong in the area part if
> the element list is wrong in the first place. Both parts need to be
> synchronized. That's why it's important not only to test the area tree
> but also the element lists. Otherwise, you get strange line or page
> breaking decisions and you don't know why.
> 
> Thanks for the feedback!
> 
> I realized with this bug that I need to take borders and padding from
> parent LMs into account when I'm trying to create the right element
> lists for spaces. Looks like we need a stack on the LayoutContext for
> non-conditional borders and paddings. ATM I believe we will end up
> extending the use of "unresolved list elements" which get resolved to
> normal Knuth elements prior to breaking. Otherwise, the code gets too
> complicated if the complex break possibilities (like
> pen-glue-box-PEN-glue) are becoming more common. I will write something
> up on the Wiki about that.
> 
> > > BTW, if you run this test, the output looks good, but add two or three
> > > additional lines and you'll see the problem in the output, too.
> > 
> > Regards, Simon
> 
> 
> Jeremias Maerki
> 

-- 
Simon Pepping
home page: http://www.leverkruid.nl


Re: svn commit: r280872 - in /xmlgraphics/fop/trunk/test/layoutengine: disabled-testcases.txt testcases/block_padding_2.xml

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 14.09.2005 22:44:07 Simon Pepping wrote:
> On Wed, Sep 14, 2005 at 05:05:37PM +0200, Jeremias Maerki wrote:
> > Can one of the Knuth specialist please review my element list in the new
> > test case below? Thanks.
> 
> The element list seems OK to me. The first page also seems OK to
> me. What is strange is that the first line on the second page has
> vpos="190800", i.e. 60000 below the end of the last line on page
> 1. Clearly 30000 padding after and padding before are added. Is this
> not a problem of the area part of the code?

I didn't even look at the area tree, but you're right vpos is a bit
strange, though I get 162000, not 190800. :-) But I wouldn't put too
much weight on the vpos attribute since it simply writes out the
currentBPPosition. I'm going to investigate that a little more. I
believe we can't start talking about something wrong in the area part if
the element list is wrong in the first place. Both parts need to be
synchronized. That's why it's important not only to test the area tree
but also the element lists. Otherwise, you get strange line or page
breaking decisions and you don't know why.

Thanks for the feedback!

I realized with this bug that I need to take borders and padding from
parent LMs into account when I'm trying to create the right element
lists for spaces. Looks like we need a stack on the LayoutContext for
non-conditional borders and paddings. ATM I believe we will end up
extending the use of "unresolved list elements" which get resolved to
normal Knuth elements prior to breaking. Otherwise, the code gets too
complicated if the complex break possibilities (like
pen-glue-box-PEN-glue) are becoming more common. I will write something
up on the Wiki about that.

> > BTW, if you run this test, the output looks good, but add two or three
> > additional lines and you'll see the problem in the output, too.
> 
> Regards, Simon


Jeremias Maerki


Re: svn commit: r280872 - in /xmlgraphics/fop/trunk/test/layoutengine: disabled-testcases.txt testcases/block_padding_2.xml

Posted by Simon Pepping <sp...@leverkruid.nl>.
On Wed, Sep 14, 2005 at 05:05:37PM +0200, Jeremias Maerki wrote:
> Can one of the Knuth specialist please review my element list in the new
> test case below? Thanks.

The element list seems OK to me. The first page also seems OK to
me. What is strange is that the first line on the second page has
vpos="190800", i.e. 60000 below the end of the last line on page
1. Clearly 30000 padding after and padding before are added. Is this
not a problem of the area part of the code?

> BTW, if you run this test, the output looks good, but add two or three
> additional lines and you'll see the problem in the output, too.

Regards, Simon

-- 
Simon Pepping
home page: http://www.leverkruid.nl


Re: svn commit: r280872 - in /xmlgraphics/fop/trunk/test/layoutengine: disabled-testcases.txt testcases/block_padding_2.xml

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Can one of the Knuth specialist please review my element list in the new
test case below? Thanks.

BTW, if you run this test, the output looks good, but add two or three
additional lines and you'll see the problem in the output, too.

On 14.09.2005 17:02:28 jeremias wrote:
> Author: jeremias
> Date: Wed Sep 14 08:02:24 2005
> New Revision: 280872
> 
> URL: http://svn.apache.org/viewcvs?rev=280872&view=rev
> Log:
> Ouch. The penalties are completely wrong if a higher-level block defines non-conditional padding.
> 
> Added:
>     xmlgraphics/fop/trunk/test/layoutengine/testcases/block_padding_2.xml   (with props)
> Modified:
>     xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.txt
> 
<snip/>


Jeremias Maerki