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 ma...@apache.org on 2005/12/23 12:27:20 UTC
svn commit: r358792 - in /xmlgraphics/fop/trunk:
src/java/org/apache/fop/layoutmgr/inline/ test/layoutengine/
test/layoutengine/standard-testcases/
Author: manuel
Date: Fri Dec 23 03:27:07 2005
New Revision: 358792
URL: http://svn.apache.org/viewcvs?rev=358792&view=rev
Log:
Fixed problem with linefeed-treatment=preserve not being correctly handled for text-align=center
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_linefeed-treatment_2.xml
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=358792&r1=358791&r2=358792&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Fri Dec 23 03:27:07 2005
@@ -362,7 +362,7 @@
LayoutManager lastLM = null; // last child LM in this iterator
while (parentIter.hasNext()) {
pos = (NonLeafPosition) parentIter.next();
- if (pos.getPosition() != null) {
+ if (pos != null && pos.getPosition() != null) {
positionList.add(pos.getPosition());
lastLM = pos.getPosition().getLM();
lastPos = pos;
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=358792&r1=358791&r2=358792&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Fri Dec 23 03:27:07 2005
@@ -338,7 +338,19 @@
inlineLM.removeWordSpace(removedElements);
}
}
-
+
+ /**
+ * @return true if the sequence contains a box
+ */
+ public boolean containsBox() {
+ for (int i = 0; i < this.size(); i++) {
+ KnuthElement el = (KnuthElement)this.get(i);
+ if (el.isBox()) {
+ return true;
+ }
+ }
+ return false;
+ }
}
private class LineBreakingAlgorithm extends BreakingAlgorithm {
@@ -756,9 +768,9 @@
== -KnuthPenalty.INFINITE) {
// a penalty item whose value is -inf
// represents a preserved linefeed,
- // wich forces a line break
+ // which forces a line break
lastPar.removeLast();
- if (lastPar.size() == 0) {
+ if (!lastPar.containsBox()) {
//only a forced linefeed on this line
//-> compensate with a zero width box
lastPar.add(new KnuthInlineBox(0, null, null, false));
@@ -798,7 +810,7 @@
}
log.trace(trace);
}
-
+
/**
* Find a set of breaking points.
* This method is called only once by getNextBreakPoss, and it
Modified: xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml?rev=358792&r1=358791&r2=358792&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml Fri Dec 23 03:27:07 2005
@@ -56,13 +56,6 @@
correctly.</description>
</testcase>
<testcase>
- <name>linefeed treatment 2</name>
- <file>block_linefeed-treatment_2.xml</file>
- <description>This test checks linefeed preservation between and at
- the start of fo:inline elements.</description>
- <reference>http://marc.theaimsgroup.com/?t=113525808000001</reference>
- </testcase>
- <testcase>
<name>Empty blocks produce fences</name>
<file>block_space-before_space-after_8.xml</file>
<description>An empty block currently produces a fence for
Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_linefeed-treatment_2.xml
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_linefeed-treatment_2.xml?rev=358792&r1=358791&r2=358792&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_linefeed-treatment_2.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_linefeed-treatment_2.xml Fri Dec 23 03:27:07 2005
@@ -36,19 +36,29 @@
</fo:layout-master-set>
<fo:page-sequence master-reference="master">
<fo:flow flow-name="xsl-region-body">
- <fo:block linefeed-treatment="preserve" text-align="center">
+ <fo:block background-color="silver"
+ linefeed-treatment="preserve" text-align="center"
+ margin-top="10pt" margin-bottom="10pt">
<fo:inline font-weight="bold">Leasing a ...</fo:inline>
+
<fo:inline>Contrat Nr.: W-113283...</fo:inline>
</fo:block>
- <fo:block linefeed-treatment="preserve" text-align="center">
+ <fo:block background-color="yellow"
+ linefeed-treatment="preserve" text-align="center"
+ margin-top="10pt" margin-bottom="10pt">
<fo:inline font-weight="bold">Leasing a ...</fo:inline>
<fo:inline> Contrat Nr.: W-113283...</fo:inline>
</fo:block>
- <fo:block linefeed-treatment="preserve">
+ <fo:block background-color="silver"
+ linefeed-treatment="preserve"
+ margin-top="10pt" margin-bottom="10pt">
<fo:inline font-weight="bold">Leasing a ...</fo:inline>
+
<fo:inline>Contrat Nr.: W-113283...</fo:inline>
</fo:block>
- <fo:block linefeed-treatment="preserve">
+ <fo:block background-color="yellow"
+ linefeed-treatment="preserve"
+ margin-top="10pt" margin-bottom="10pt">
<fo:inline font-weight="bold">Leasing a ...</fo:inline>
<fo:inline> Contrat Nr.: W-113283...</fo:inline>
</fo:block>
@@ -61,12 +71,15 @@
The result:
Leasing a ...
+
Contract Nr.: W-...
Leasing a ...
+
Contract Nr.: W-...
Leasing a ...
+
Contract Nr.: W-...
Leasing a ...
@@ -77,9 +90,9 @@
the fo:inline. The results for the first and second cases are lacking
the linefeed before the first line.
-->
- <eval expected="3" xpath="count(//flow/block[1]/lineArea)"/>
+ <eval expected="4" xpath="count(//flow/block[1]/lineArea)"/>
<eval expected="4" xpath="count(//flow/block[2]/lineArea)"/>
- <eval expected="3" xpath="count(//flow/block[3]/lineArea)"/>
+ <eval expected="4" xpath="count(//flow/block[3]/lineArea)"/>
<eval expected="4" xpath="count(//flow/block[4]/lineArea)"/>
</checks>
</testcase>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org