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 ad...@apache.org on 2007/11/02 20:57:25 UTC
svn commit: r591437 - in /xmlgraphics/fop/trunk:
src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
test/layoutengine/standard-testcases/page-number-citation_empty-inline.xml
Author: adelmelle
Date: Fri Nov 2 12:57:25 2007
New Revision: 591437
URL: http://svn.apache.org/viewvc?rev=591437&view=rev
Log:
Bugzilla 42748: Added support for ids on empty fo:inlines
Added:
xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_empty-inline.xml (with props)
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java?rev=591437&r1=591436&r2=591437&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java Fri Nov 2 12:57:25 2007
@@ -270,9 +270,7 @@
public static class InlineLayoutManagerMaker extends Maker {
public void make(FONode node, List lms) {
- if (node.getChildNodes() != null) {
- lms.add(new InlineLayoutManager((InlineLevel) node));
- }
+ lms.add(new InlineLayoutManager((InlineLevel) node));
}
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=591437&r1=591436&r2=591437&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 Nov 2 12:57:25 2007
@@ -30,7 +30,6 @@
import org.apache.fop.area.inline.InlineBlockParent;
import org.apache.fop.area.inline.InlineParent;
import org.apache.fop.datatypes.Length;
-import org.apache.fop.fo.Constants;
import org.apache.fop.fo.flow.Inline;
import org.apache.fop.fo.flow.InlineLevel;
import org.apache.fop.fo.flow.Leader;
@@ -44,6 +43,7 @@
import org.apache.fop.layoutmgr.BlockKnuthSequence;
import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
import org.apache.fop.layoutmgr.BreakElement;
+import org.apache.fop.layoutmgr.InlineKnuthSequence;
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
@@ -108,7 +108,7 @@
}
private Inline getInlineFO() {
- return (Inline)fobj;
+ return (Inline) fobj;
}
/** {@inheritDoc} */
@@ -379,6 +379,24 @@
setFinished(true);
log.trace(trace);
+
+ if (returnList.size() == 0) {
+ /*
+ * if the FO itself is empty, but has an id specified
+ * or associated fo:markers, then we still need a dummy
+ * sequence to register its position in the area tree
+ */
+ if (fobj.hasId() || fobj.hasMarkers()) {
+ InlineKnuthSequence emptySeq = new InlineKnuthSequence();
+ emptySeq.add(new KnuthInlineBox(
+ 0,
+ alignmentContext,
+ notifyPos(getAuxiliaryPosition()),
+ true));
+ returnList.add(emptySeq);
+ }
+ }
+
return returnList.size() == 0 ? null : returnList;
}
@@ -394,8 +412,6 @@
public void addAreas(PositionIterator parentIter,
LayoutContext context) {
- Position lastPos = null;
-
addId();
setChildContext(new LayoutContext(context)); // Store current value
@@ -420,7 +436,8 @@
// layout context given to the other LMs.
LinkedList positionList = new LinkedList();
NonLeafPosition pos = null;
- LayoutManager lastLM = null; // last child LM in this iterator
+ LayoutManager lastLM = null;// last child LM in this iterator
+ Position lastPos = null;
while (parentIter.hasNext()) {
pos = (NonLeafPosition) parentIter.next();
if (pos != null && pos.getPosition() != null) {
@@ -556,10 +573,10 @@
/** {@inheritDoc} */
protected void addId() {
- if (fobj instanceof Inline) {
- getPSLM().addIDToPage(getInlineFO().getId());
- }
+ getPSLM().addIDToPage(fobj.getId());
}
+ public String toString() {
+ return (this.getClass().getName() + "[fobj=" + fobj.toString() + "]");
+ }
}
-
Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_empty-inline.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_empty-inline.xml?rev=591437&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_empty-inline.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_empty-inline.xml Fri Nov 2 12:57:25 2007
@@ -0,0 +1,50 @@
+<?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 a page-number-citation for an empty fo:inline (see Bugzilla 42748).
+ </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="20in"
+ margin="20pt">
+ <fo:region-body background-color="yellow"/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence id="page-sequence1" master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>
+ <fo:block>text<fo:inline id="empty-inline1" />text</fo:block>
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="normal">
+ <fo:flow flow-name="xsl-region-body" font-size="8pt">
+ <fo:block><fo:page-number-citation ref-id="empty-inline1" /></fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <true fail-msg="no ID for empty inline" xpath="'1' = //pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]"/>
+ </checks>
+</testcase>
Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_empty-inline.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