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 2008/08/14 15:03:28 UTC
svn commit: r685879 - in /xmlgraphics/fop/trunk:
src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java status.xml
test/layoutengine/standard-testcases/leader_leader-pattern_use-content.xml
Author: jeremias
Date: Thu Aug 14 06:03:20 2008
New Revision: 685879
URL: http://svn.apache.org/viewvc?rev=685879&view=rev
Log:
Fixed the source for a NullPointerException when the content of an fo:leader with leader-pattern="use-content" collapses to zero width during layout.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
xmlgraphics/fop/trunk/status.xml
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_leader-pattern_use-content.xml
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java?rev=685879&r1=685878&r2=685879&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java Thu Aug 14 06:03:20 2008
@@ -183,17 +183,23 @@
childContext.setAlignmentContext(context.getAlignmentContext());
contentList = clm.getNextKnuthElements(childContext, 0);
int width = clm.getStackingSize();
- Space spacer = null;
- if (fobj.getLeaderPatternWidth().getValue(this) > width) {
- spacer = new Space();
- spacer.setIPD(fobj.getLeaderPatternWidth().getValue(this) - width);
- width = fobj.getLeaderPatternWidth().getValue(this);
+ if (width != 0) {
+ Space spacer = null;
+ if (fobj.getLeaderPatternWidth().getValue(this) > width) {
+ spacer = new Space();
+ spacer.setIPD(fobj.getLeaderPatternWidth().getValue(this) - width);
+ width = fobj.getLeaderPatternWidth().getValue(this);
+ }
+ fa.setUnitWidth(width);
+ if (spacer != null) {
+ fa.addChildArea(spacer);
+ }
+ leaderArea = fa;
+ } else {
+ //Content collapsed to nothing, so use a space
+ leaderArea = new Space();
+ leaderArea.setBPD(1);
}
- fa.setUnitWidth(width);
- if (spacer != null) {
- fa.addChildArea(spacer);
- }
- leaderArea = fa;
}
TraitSetter.setProducerID(leaderArea, fobj.getId());
return leaderArea;
Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=685879&r1=685878&r2=685879&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Thu Aug 14 06:03:20 2008
@@ -53,6 +53,10 @@
<changes>
<release version="FOP Trunk" date="TBD">
+ <action context="Layout" dev="JM" type="fix">
+ Fixed the source for a NullPointerException when the content of an fo:leader with
+ leader-pattern="use-content" collapses to zero width during layout.
+ </action>
<action context="Renderers" dev="JM" type="fix">
Fixed border trait parsing for the area tree XML when CMYK or ICC colors were used.
</action>
Modified: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_leader-pattern_use-content.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_leader-pattern_use-content.xml?rev=685879&r1=685878&r2=685879&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_leader-pattern_use-content.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/leader_leader-pattern_use-content.xml Thu Aug 14 06:03:20 2008
@@ -69,6 +69,10 @@
</fo:instream-foreign-object></fo:leader>
Content is svg 20 x 10 which is wider than the leader-length
</fo:block>
+ <fo:block>
+ <fo:leader leader-length="36pt" leader-pattern="use-content"> </fo:leader>
+ Content is " "
+ </fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
@@ -172,5 +176,9 @@
<eval expected="0" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/@offset"/>
<eval expected="20000" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/viewport/@ipd"/>
<eval expected="-1384" xpath="//flow/block[7]/lineArea/inlineparent/inlineparent[1]/viewport/@offset"/>
+
+ <eval expected="11100" xpath="//flow/block[8]/lineArea/@bpd"/>
+ <eval expected="36000" xpath="//flow/block[8]/lineArea/space[1]/@ipd"/>
+ <eval expected="0" xpath="//flow/block[8]/lineArea/space[1]/@offset"/>
</checks>
</testcase>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org