You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by "plutext (via GitHub)" <gi...@apache.org> on 2026/10/04 22:23:55 UTC

[PR] FOP-3348: A block nested in an inline keeps the lines after it when line breaking runs again [xmlgraphics-fop]

plutext opened a new pull request, #120:
URL: https://github.com/apache/xmlgraphics-fop/pull/120

   Fixes [FOP-3348](https://issues.apache.org/jira/browse/FOP-3348). Related to [FOP-1912](https://issues.apache.org/jira/browse/FOP-1912), the same scenario's page-width form, reported in 2011 with a trace at a different site.
   
   `LineLayoutManager` keeps a paragraph's Knuth sequences in `knuthParagraphs`. A block nested in an inline gives
   it a block-level sequence between two inline ones. `postProcessLineBreaks` passes that sequence's elements
   upward as the same objects it stores, wrapping each in place:
   
   ```java
   tempElement.setPosition(notifyPos(new NonLeafPosition(this, tempElement.getPosition())));
   ```
   
   and the enclosing block and flow managers wrap the same objects in place again
   (`BlockStackingLayoutManager.wrapPositionElements`).
   
   Line breaking runs a second time over the stored paragraphs in two cases: the content after a float
   (`PageBreaker.handleFloatLayout` restarts after it), and the restart after a change of IPD. The elements still
   carry the first pass's wrapping, so they were wrapped twice. With a float, the nested block's chain came out
   LineLM > FlowLM > BlockLM > LineLM > InlineLM > BlockLM, where it should be LineLM > InlineLM > BlockLM.
   `addBlockArea` unwraps one level, reaches the `FlowLayoutManager`, and so re-enters the enclosing block's
   `addAreas`, which flushes the block's area and sets `curBlockArea` to null. Back in the outer call, the line
   after the nested block reaches `addChildArea`, which drops it silently while the area is null; then
   `TraitSetter.setVisibility(curBlockArea, ...)` throws a `NullPointerException`. A null check there would stop
   the exception and lose the text.
   
   **The change.** `unwrapEarlierPass`: before such an element is wrapped, walk its chain of `NonLeafPosition`s.
   If one belongs to this manager, an earlier pass left it there, so start again from the position inside it. On
   a first pass none does, and nothing changes. Only `NonLeafPosition`s are walked, since the wrapping is made of
   them; a `TableContentPosition` returns itself from `getPosition()`, so walking any position until null loops
   forever on a table inside an inline (`inline_block-level_nested_1.xml`).
   
   **Tests.** Two layout tests:
   - `inline_block_nested_float_relayout.xml`, the float form;
   - `inline_block_nested_ipd_relayout.xml`, the page-width form: a page-sequence-master whose later pages have a
     larger margin-left.
   
   Both throw the `NullPointerException` without the change. With it, the fop-core suite passes, 3665 tests and 0
   failures; the layout engine suite runs 743 standard test cases, since the 34 in `disabled-testcases.xml` don't
   run. Checkstyle reports 0 violations.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Re: [PR] FOP-3348: A block nested in an inline keeps the lines after it when line breaking runs again [xmlgraphics-fop]

Posted by "plutext (via GitHub)" <gi...@apache.org>.
plutext commented on PR #120:
URL: https://github.com/apache/xmlgraphics-fop/pull/120#issuecomment-6180363045

   Closing: applied to main as 5be8c69b6 (2026-10-05), FOP-3348 resolved Fixed for 2.12. Thank you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Re: [PR] FOP-3348: A block nested in an inline keeps the lines after it when line breaking runs again [xmlgraphics-fop]

Posted by "plutext (via GitHub)" <gi...@apache.org>.
plutext closed pull request #120: FOP-3348: A block nested in an inline keeps the lines after it when line breaking runs again
URL: https://github.com/apache/xmlgraphics-fop/pull/120


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org