ASF Bugzilla – Attachment 26613 Details for
Bug 47530
[PATCH] Problem with fo:wrapper inside block-container or table-cell
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
revised patch
b47530.diff (text/plain), 8.27 KB, created by
Andreas L. Delmelle
on 2011-02-06 11:30:21 UTC
(
hide
)
Description:
revised patch
Filename:
MIME Type:
Creator:
Andreas L. Delmelle
Created:
2011-02-06 11:30:21 UTC
Size:
8.27 KB
patch
obsolete
>Index: src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java >=================================================================== >--- src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java (revision 1067688) >+++ src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java (working copy) >@@ -24,10 +24,16 @@ > import org.apache.fop.fo.flow.Wrapper; > import org.apache.fop.layoutmgr.BlockLayoutManager; > import org.apache.fop.layoutmgr.BlockStackingLayoutManager; >+import org.apache.fop.layoutmgr.KnuthBox; >+import org.apache.fop.layoutmgr.KnuthSequence; > import org.apache.fop.layoutmgr.LayoutContext; >+import org.apache.fop.layoutmgr.ListElement; > import org.apache.fop.layoutmgr.PositionIterator; > import org.apache.fop.layoutmgr.TraitSetter; > >+import java.util.LinkedList; >+import java.util.List; >+ > /** > * This is the layout manager for the fo:wrapper formatting object. > */ >@@ -54,14 +60,39 @@ > return area; > } > >+ > /** >+ * Overridden to generate a proper {@link ListElement}, if the parent >+ * requires it (i.e. is a block-container, list-item-body...) >+ * If the parent is a block, the line LM will take care of properly >+ * wrapping the sequence in a line box. >+ * {@inheritDoc} >+ */ >+ @Override >+ public List getNextKnuthElements(LayoutContext context, int alignment) { >+ List returnList = super.getNextKnuthElements(context, alignment); >+ KnuthSequence seq = (KnuthSequence) returnList.get(0); >+ ListElement tempElement = (ListElement) seq.get(0); >+ if (parentLayoutManager instanceof BlockStackingLayoutManager >+ && !(parentLayoutManager instanceof BlockLayoutManager)) { >+ // replace inline box with a block box >+ returnList = new LinkedList(); >+ KnuthBox auxiliaryBox = new KnuthBox(0, tempElement.getPosition(), true); >+ returnList.add(auxiliaryBox); >+ } else { >+ // make sure the inline box is an auxiliary one >+ seq.set(0, new KnuthInlineBox(0, null, tempElement.getPosition(), true)); >+ } >+ return returnList; >+ } >+ >+ /** > * Add the area for this layout manager. > * This adds the dummy area to the parent, *if* it has an id > * - otherwise it serves no purpose. >- * >- * @param posIter the position iterator >- * @param context the layout context for adding the area >+ * {@inheritDoc} > */ >+ @Override > public void addAreas(PositionIterator posIter, LayoutContext context) { > if (fobj.hasId()) { > addId(); >Index: test/layoutengine/standard-testcases/wrapper_block.xml >=================================================================== >--- test/layoutengine/standard-testcases/wrapper_block.xml (revision 1067111) >+++ test/layoutengine/standard-testcases/wrapper_block.xml (working copy) >@@ -23,7 +23,7 @@ > </p> > </info> > <fo> >- <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"> >+ <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="5in"> > <fo:region-body/> >@@ -31,21 +31,92 @@ > </fo:layout-master-set> > <fo:page-sequence master-reference="normal"> > <fo:flow flow-name="xsl-region-body"> >- <fo:wrapper color="red"> >- <fo:block>block content.</fo:block> >+ <fo:wrapper color="red" font-size="8pt"> >+ <fo:block>w-1</fo:block> > </fo:wrapper> >+ <fo:block> >+ <!-- triggers creation of a blank lineArea; bug? --> >+ <fo:wrapper color="green" font-size="9pt"> >+ <fo:block>w-2</fo:block> >+ </fo:wrapper> >+ </fo:block> >+ <fo:block-container> >+ <fo:wrapper color="blue" font-size="10pt"> >+ <fo:block>w-3</fo:block> >+ </fo:wrapper> >+ </fo:block-container> >+ <fo:list-block> >+ <fo:list-item> >+ <fo:list-item-label end-indent="label-end()"> >+ <!-- does not work; causes the list content to be dropped... --> >+ <!--fo:wrapper color="red" font-size="8pt"--> >+ <fo:block>w-4</fo:block> >+ <!--/fo:wrapper--> >+ </fo:list-item-label> >+ <fo:list-item-body start-indent="body-start() + 5pt"> >+ <fo:wrapper color="green" font-size="9pt"> >+ <fo:block>w-5</fo:block> >+ <fo:block>w-5</fo:block> >+ <fo:block>w-5</fo:block> >+ </fo:wrapper> >+ </fo:list-item-body> >+ </fo:list-item> >+ </fo:list-block> >+ <fo:table> >+ <fo:table-column /> >+ <fo:table-body> >+ <fo:table-cell starts-row="true" ends-row="true"> >+ <fo:wrapper color="blue" font-size="10pt"> >+ <fo:block>w-6</fo:block> >+ <fo:block>w-6</fo:block> >+ </fo:wrapper> >+ </fo:table-cell> >+ </fo:table-body> >+ </fo:table> > </fo:flow> > </fo:page-sequence> > </fo:root> > </fo> > <checks> >- <!-- Just check if this really results in 1 line. --> >- <element-list category="breaker"> >- <skip>2</skip> >- <box w="14400"/> >- <skip>3</skip> >- </element-list> >- <eval expected="1" xpath="count(//lineArea)"/> >- <eval expected="#ff0000" xpath="//flow/block/lineArea[1]/text[1]/@color"/> >+ <!-- Check the amount of lines, inherited property values and content --> >+ <!-- wrapper as child of flow --> >+ <eval expected="1" xpath="count(//lineArea//word[.='w-1'])"/> >+ <eval expected="#ff0000" xpath="(//flow[1]//lineArea)[1]/text[1]/@color"/> >+ <eval expected="8000" xpath="(//flow[1]//lineArea)[1]/text[1]/@font-size"/> >+ <eval expected="w-1" xpath="(//flow[1]//lineArea)[1]//word" /> >+ <!-- wrapper as child of block; generates an extra line area? --> >+ <eval expected="1" xpath="count(//lineArea//word[.='w-2'])"/> >+ <eval expected="#008000" xpath="(//flow[1]//lineArea)[3]/text[1]/@color"/> >+ <eval expected="9000" xpath="(//flow[1]//lineArea)[3]/text[1]/@font-size"/> >+ <eval expected="w-2" xpath="(//flow[1]//lineArea)[3]//word" /> >+ <!-- wrapper as child of block-container --> >+ <eval expected="1" xpath="count(//lineArea//word[.='w-3'])"/> >+ <eval expected="#0000ff" xpath="(//flow[1]//lineArea)[4]/text[1]/@color"/> >+ <eval expected="10000" xpath="(//flow[1]//lineArea)[4]/text[1]/@font-size"/> >+ <eval expected="w-3" xpath="(//flow[1]//lineArea)[4]//word" /> >+ <!-- wrapper as child of list-item-label --> >+ <!--eval expected="1" xpath="count(//lineArea//word[.='w-4'])"/> >+ <eval expected="#ff0000" xpath="(//flow[1]//lineArea)[5]/text[1]/@color"/> >+ <eval expected="8000" xpath="(//flow[1]//lineArea)[5]/text[1]/@font-size"/> >+ <eval expected="w-4" xpath="(//flow[1]//lineArea)[5]//word" /--> >+ <!-- wrapper as child of list-item-body --> >+ <eval expected="3" xpath="count(//lineArea//word[.='w-5'])"/> >+ <eval expected="#008000" xpath="(//flow[1]//lineArea)[6]/text[1]/@color"/> >+ <eval expected="9000" xpath="(//flow[1]//lineArea)[6]/text[1]/@font-size"/> >+ <eval expected="w-5" xpath="(//flow[1]//lineArea)[6]//word" /> >+ <eval expected="#008000" xpath="(//flow[1]//lineArea)[7]/text[1]/@color"/> >+ <eval expected="9000" xpath="(//flow[1]//lineArea)[7]/text[1]/@font-size"/> >+ <eval expected="w-5" xpath="(//flow[1]//lineArea)[7]//word" /> >+ <eval expected="#008000" xpath="(//flow[1]//lineArea)[8]/text[1]/@color"/> >+ <eval expected="9000" xpath="(//flow[1]//lineArea)[8]/text[1]/@font-size"/> >+ <eval expected="w-5" xpath="(//flow[1]//lineArea)[8]//word" /> >+ <!-- wrapper as child of table-cell --> >+ <eval expected="2" xpath="count(//lineArea//word[.='w-6'])"/> >+ <eval expected="#0000ff" xpath="(//flow[1]//lineArea)[9]/text[1]/@color"/> >+ <eval expected="10000" xpath="(//flow[1]//lineArea)[9]/text[1]/@font-size"/> >+ <eval expected="w-6" xpath="(//flow[1]//lineArea)[9]//word" /> >+ <eval expected="#0000ff" xpath="(//flow[1]//lineArea)[10]/text[1]/@color"/> >+ <eval expected="10000" xpath="(//flow[1]//lineArea)[10]/text[1]/@font-size"/> >+ <eval expected="w-6" xpath="(//flow[1]//lineArea)[10]//word" /> > </checks> > </testcase>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 47530
:
23983
|
23984
|
23985
|
26611
| 26613