diff options
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java | 15 | ||||
-rw-r--r-- | status.xml | 4 | ||||
-rw-r--r-- | test/layoutengine/standard-testcases/block_text-indent.xml | 8 |
3 files changed, 17 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java index 9dd0ad3fb..73c0de905 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-2006 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. @@ -73,8 +73,10 @@ import org.apache.fop.traits.MinOptMax; public class LineLayoutManager extends InlineStackingLayoutManager implements BlockLevelLayoutManager { - private Block fobj; + private Block fobj; + private boolean isFirstInBlock; + /** @see org.apache.fop.layoutmgr.LayoutManager#initialize() */ public void initialize() { textAlignment = fobj.getTextAlign(); textAlignmentLast = fobj.getTextAlignLast(); @@ -85,6 +87,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager wrapOption = fobj.getWrapOption(); // effectiveAlignment = getEffectiveAlignment(textAlignment, textAlignmentLast); + isFirstInBlock = (this == getParent().getChildLMs().get(0)); } private int getEffectiveAlignment(int alignment, int alignmentLast) { @@ -238,9 +241,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager // add the element representing text indentation // at the beginning of the first paragraph - if (knuthParagraphs.size() == 0 - && fobj.getTextIndent().getValue(layoutManager) != 0) { - this.add(new KnuthInlineBox(fobj.getTextIndent().getValue(layoutManager), null, + if (isFirstInBlock && knuthParagraphs.size() == 0 + && textIndent != 0) { + this.add(new KnuthInlineBox(textIndent, null, null, false)); ignoreAtStart++; } @@ -348,7 +351,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager int textAlign = (bestActiveNode.line < total) ? alignment : alignmentLast; indent += (textAlign == Constants.EN_CENTER) ? difference / 2 : (textAlign == Constants.EN_END) ? difference : 0; - indent += (bestActiveNode.line == 1 && bFirst) ? textIndent : 0; + indent += (bestActiveNode.line == 1 && bFirst && isFirstInBlock) ? textIndent : 0; double ratio = (textAlign == Constants.EN_JUSTIFY || difference < 0 && -difference <= bestActiveNode.availableShrink) ? bestActiveNode.adjustRatio : 0; diff --git a/status.xml b/status.xml index fac11f333..a21b75e3d 100644 --- a/status.xml +++ b/status.xml @@ -28,6 +28,10 @@ <changes> <release version="FOP Trunk"> <action context="Code" dev="JM" type="fix"> + Corrected expectation and behaviour for the text-indent property to only apply + to the first line area generated by a block. + </action> + <action context="Code" dev="JM" type="fix"> Bugfix for invalid handling of ICC color profiles in JPEG images and for dealing with CMYK JPEG images with the Adobe APPE marker. </action> diff --git a/test/layoutengine/standard-testcases/block_text-indent.xml b/test/layoutengine/standard-testcases/block_text-indent.xml index 1f1eaceb1..334606f18 100644 --- a/test/layoutengine/standard-testcases/block_text-indent.xml +++ b/test/layoutengine/standard-testcases/block_text-indent.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2005 The Apache Software Foundation + Copyright 2005-2006 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. @@ -53,8 +53,8 @@ This is just for testing purpose and this line will be indented. <fo:block>This is the nested block.</fo:block> -The text following the nested block should be indented as well. The text following -the nested block should be indented as well. +The text following the nested block should NOT indented. The text following +the nested block should NOT be indented. </fo:block> </fo:flow> </fo:page-sequence> @@ -89,7 +89,7 @@ the nested block should be indented as well. <eval expected="20000" xpath="//flow/block[3]/child::*[1]/@start-indent"/> <eval expected="20000" xpath="//flow/block[3]/child::*[2]/lineArea[1]/@start-indent"/> - <eval expected="20000" xpath="//flow/block[3]/child::*[3]/@start-indent"/> + <true xpath="boolean(not(//flow/block[3]/child::*[3]/@start-indent))"/> <true xpath="boolean(not(//flow/block[3]/child::*[4]/@start-indent))"/> </checks> </testcase> |