Bug 50196 - Padding-left ignored inside repeated table header
Padding-left ignored inside repeated table header
Status: RESOLVED FIXED
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf
1.0
PC All
: P3 normal
: ---
Assigned To: fop-dev
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-11-01 20:18 UTC by Matthias Reischenbacher
Modified: 2012-04-24 17:20 UTC (History)
0 users



Attachments
Testcase (1.08 KB, application/octet-stream)
2010-11-01 20:18 UTC, Matthias Reischenbacher
Details
Patch (3.19 KB, patch)
2010-11-28 19:38 UTC, Matthias Reischenbacher
Details | Diff
Patch (4.03 KB, patch)
2010-11-29 17:14 UTC, Matthias Reischenbacher
Details | Diff
Patch (4.91 KB, patch)
2010-12-17 15:42 UTC, Matthias Reischenbacher
Details | Diff
Patch (2.14 KB, application/octet-stream)
2010-12-19 19:42 UTC, Matthias Reischenbacher
Details
Patch (765 bytes, patch)
2011-03-09 16:07 UTC, Matthias Reischenbacher
Details | Diff
Layout engine testcase for checking inline padding after a page break in table headers and footers (7.12 KB, application/xml)
2011-05-28 05:57 UTC, darshan
Details
Testcase (728 bytes, application/xml)
2011-05-29 16:01 UTC, Matthias Reischenbacher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Reischenbacher 2010-11-01 20:18:20 UTC
Created attachment 26247 [details]
Testcase

There is a problem when using padding-left on a fo:inline element inside a repeating table header. The padding-left value is ignored on the repeated table header on the next page.
Comment 1 Matthias Reischenbacher 2010-11-28 19:38:16 UTC
Created attachment 26351 [details]
Patch
Comment 2 Matthias Reischenbacher 2010-11-29 17:14:14 UTC
Created attachment 26354 [details]
Patch

Patch didn't work when hyphenation was enabled. This is fixed now.
Comment 3 Matthias Reischenbacher 2010-12-17 15:42:18 UTC
Created attachment 26419 [details]
Patch

Previous patch didn't work when positions were unwrapped and wrapped in InlineStackingLayoutManager and getChangedKnuthElements() of InlineLayoutManager wasn't called.
Junit layout testcases pass with no errors after applying the patch.
Comment 4 Matthias Reischenbacher 2010-12-19 19:42:55 UTC
Created attachment 26426 [details]
Patch

Sorry for adding a patch again... (still learning ;-) ) But finally I've come up with a much simpler solution for this issue. Using the isFirst method of InlineLM seems to correctly detect the first position and can therefore be used to reset the areaCreated instance variable.
Comment 5 Vincent Hennebert 2011-03-09 15:17:47 UTC
Patch committed in rev. 1079969:
http://svn.apache.org/viewvc?rev=1079969&view=rev

You managed to find an elegant solution to this issue. Sorry for the delay, and thanks for your contribution!

Regards,
Vincent
Comment 6 Matthias Reischenbacher 2011-03-09 16:07:36 UTC
Created attachment 26756 [details]
Patch

Vincent,

thanks for applying the patch (and your encouraging words :-) ).

Sorry for adding this so late but I had to make a minimal change to my original patch because in some cases the index of the first knuth position was -1 causing isFirst() to throw an exception. I think this has something to do with auxiliary positions used for borders inside nested fo:inline elements but unfortunately I have no test case for reproducing the error. I could be that this change is not necessary anymore due to Simon's refactoring of the whole wrapping/unwrapping part of knuth elements. But just to be on the safe side, I'd recommend to apply this patch too.

Regards,
Matthias
Comment 7 Vincent Hennebert 2011-03-18 15:03:29 UTC
(In reply to comment #6)

Hi Matthias,

Thanks for letting us know. If you could come up with a test case that would be brilliant. I've tried to reproduce the error on my side and haven't managed.

Meanwhile, I'll re-open this bug as a reminder.

Vincent
Comment 8 darshan 2011-05-28 05:57:36 UTC
Created attachment 27078 [details]
Layout engine testcase for checking  inline padding after a page break in table headers and footers

Hi Vincent,

The attachment is a test case for the inline header/footer padding bug.

Thank you,
Darshan
Comment 9 Andreas L. Delmelle 2011-05-28 06:34:03 UTC
Thanks for the testcase. I checked a pristine version of FOP trunk, with the one additional change in Matthias' last patch, and the full test suite still failed with the message:

    [junit] Testcase: table-header_table-footer_padding.xml(org.apache.fop.layoutengine.LayoutEngineTestSuite$LayoutEngineTestCase):	Caused an ERROR
    [junit] Expected XPath expression to evaluate to '20000', but got '' (XPath: /areatree/pageSequence/pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block/block[10]/block/linearea/inlineparent/@padding-start)
    [junit] java.lang.RuntimeException: Expected XPath expression to evaluate to '20000', but got '' (XPath: /areatree/pageSequence/pageViewport[2]/page/regionViewport/regionBody/mainReference/span/flow/block/block[10]/block/linearea/inlineparent/@padding-start)
    [junit] 	at org.apache.fop.layoutengine.EvalCheck.doCheck(EvalCheck.java:86)
    [junit] 	at org.apache.fop.layoutengine.EvalCheck.check(EvalCheck.java:60)
    [junit] 	at org.apache.fop.layoutengine.LayoutEngineTester.doATChecks(LayoutEngineTester.java:226)
    [junit] 	at org.apache.fop.layoutengine.LayoutEngineTester.checkAll(LayoutEngineTester.java:159)
    [junit] 	at org.apache.fop.layoutengine.LayoutEngineTester.runTest(LayoutEngineTester.java:141)
    [junit] 	at org.apache.fop.layoutengine.LayoutEngineTestSuite$LayoutEngineTestCase.runTest(LayoutEngineTestSuite.java:206)

Do you run your test against FOP trunk or against 1.0?
Comment 10 darshan 2011-05-28 06:46:47 UTC
I ran it against the trunk as the patch has been applied after the release of version 1.0.

Thank you,
Darshan
Comment 11 Andreas L. Delmelle 2011-05-28 17:49:13 UTC
(In reply to comment #10)
> I ran it against the trunk as the patch has been applied after the release of
> version 1.0.

Aaaaah... *blush*
My mistake. I was still checking the test you sent earlier, instead of the latest one. The most recent one indeed passes.

However, the reason this bug report was still left open, is that we did not have a test for that latest small patch. Whether I apply that patch or not, the test still passes, so it seems like it is not exactly what we were looking for, unfortunately... :(
Comment 12 Matthias Reischenbacher 2011-05-29 15:59:23 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > I ran it against the trunk as the patch has been applied after the release of
> > version 1.0.
> 
> Aaaaah... *blush*
> My mistake. I was still checking the test you sent earlier, instead of the
> latest one. The most recent one indeed passes.
> 
> However, the reason this bug report was still left open, is that we did not
> have a test for that latest small patch. Whether I apply that patch or not, the
> test still passes, so it seems like it is not exactly what we were looking for,
> unfortunately... :(

In order to reproduce the exception mentioned in comment 6 you have to svn update fop trunk to revision 1052560 and run the additional testcase I'm attaching.
With revision 1052561 this exception doesn't occur anymore because KnuthElement Positions are not unwrapped and rewrapped anymore (due to hyphenation) and this has the effect that the positions index is never -1 (at least for the positions iterated by InlineLayoutManger).
Since this error only occurred when hyphenation is active, it's actual a hyphenation test case.

That's the stack trace of the exception:

java.lang.IllegalArgumentException: Only non-null Positions with an index can be checked
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:303)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
        at org.apache.fop.cli.Main.startFOP(Main.java:177)
        at org.apache.fop.cli.Main.main(Main.java:208)
Caused by: java.lang.IllegalArgumentException: Only non-null Positions with an index can be checked
        at org.apache.fop.layoutmgr.AbstractLayoutManager.verifyNonNullPosition(AbstractLayoutManager.java:322)
        at org.apache.fop.layoutmgr.AbstractLayoutManager.isFirst(AbstractLayoutManager.java:334)
        at org.apache.fop.layoutmgr.inline.InlineLayoutManager.addAreas(InlineLayoutManager.java:431)
        at org.apache.fop.layoutmgr.inline.LineLayoutManager.addInlineArea(LineLayoutManager.java:1517)
        at org.apache.fop.layoutmgr.inline.LineLayoutManager.addAreas(LineLayoutManager.java:1417)
        at org.apache.fop.layoutmgr.BlockLayoutManager.addAreas(BlockLayoutManager.java:389)
        at org.apache.fop.layoutmgr.AreaAdditionUtil.addAreas(AreaAdditionUtil.java:124)
        at org.apache.fop.layoutmgr.FlowLayoutManager.addAreas(FlowLayoutManager.java:351)
        at org.apache.fop.layoutmgr.PageBreaker.addAreas(PageBreaker.java:286)
        at org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:675)
        at org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:546)
        at org.apache.fop.layoutmgr.PageBreaker.doPhase3(PageBreaker.java:314)
        at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:499)
        at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:90)
        at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:107)
        at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:238)
        at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:120)
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:349)
        at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
        at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1101)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:300)
        ... 3 more

---------

java.lang.IllegalArgumentException: Only non-null Positions with an index can be checked
        at org.apache.fop.layoutmgr.AbstractLayoutManager.verifyNonNullPosition(AbstractLayoutManager.java:322)
        at org.apache.fop.layoutmgr.AbstractLayoutManager.isFirst(AbstractLayoutManager.java:334)
        at org.apache.fop.layoutmgr.inline.InlineLayoutManager.addAreas(InlineLayoutManager.java:431)
        at org.apache.fop.layoutmgr.inline.LineLayoutManager.addInlineArea(LineLayoutManager.java:1517)
        at org.apache.fop.layoutmgr.inline.LineLayoutManager.addAreas(LineLayoutManager.java:1417)
        at org.apache.fop.layoutmgr.BlockLayoutManager.addAreas(BlockLayoutManager.java:389)
        at org.apache.fop.layoutmgr.AreaAdditionUtil.addAreas(AreaAdditionUtil.java:124)
        at org.apache.fop.layoutmgr.FlowLayoutManager.addAreas(FlowLayoutManager.java:351)
        at org.apache.fop.layoutmgr.PageBreaker.addAreas(PageBreaker.java:286)
        at org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:675)
        at org.apache.fop.layoutmgr.AbstractBreaker.addAreas(AbstractBreaker.java:546)
        at org.apache.fop.layoutmgr.PageBreaker.doPhase3(PageBreaker.java:314)
        at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:499)
        at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:90)
        at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:107)
        at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:238)
        at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:120)
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:349)
        at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
        at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1101)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
        at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:300)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
        at org.apache.fop.cli.Main.startFOP(Main.java:177)
        at org.apache.fop.cli.Main.main(Main.java:208)
Comment 13 Matthias Reischenbacher 2011-05-29 16:01:47 UTC
Created attachment 27087 [details]
Testcase

Additional test case showing possible IllegalArgumentException prior rev 1052561
Comment 14 Glenn Adams 2012-04-01 21:14:11 UTC
does the reported problem still exist? if so, is it reproducible? if not, can this bug be moved to resolved?
Comment 15 Glenn Adams 2012-04-01 21:15:01 UTC
see comment 14
Comment 16 Matthias Reischenbacher 2012-04-01 21:18:58 UTC
(In reply to comment #14)
> does the reported problem still exist? if so, is it reproducible? if not, can
> this bug be moved to resolved?

No, it isn't reproducible anymore. Before this issue gets closed, it would be good to add the latest test case I provided:
https://issues.apache.org/bugzilla/attachment.cgi?id=27087
Comment 17 Glenn Adams 2012-04-07 01:44:46 UTC
resetting P2 open bugs to P3 pending further review
Comment 18 Glenn Adams 2012-04-24 05:28:51 UTC
need to add test case per comment 16
Comment 19 Glenn Adams 2012-04-24 17:20:21 UTC
added additional test case at http://svn.apache.org/viewvc?view=revision&revision=1329865