Hi allI have a patch fixing bugs 41019 and 41121, for both trunk and float branch, and I'm wondering how it's best for me to proceed in order to avoid merging problems: should I change both trunk and branch, or just one of them?
The patch is extremely simple and does not break any testcase: I only had to adjust the checks in a testcase because of the different line breaks. However, it adds some three lines to the TextLM, so maybe it's better if I wait for Simon to apply his unicode breaking changes?
I'm attaching the patches, just to let you see if they interfere with someone else's work-in-progress.
(sorry for repeating what I wrote some time ago, but I have experienced some e-mail problems and I probably lost some messages)
Regards Luca
Index: test/layoutengine/standard-testcases/block-container_content_size_percentage.xml =================================================================== --- test/layoutengine/standard-testcases/block-container_content_size_percentage.xml (revision 486106) +++ test/layoutengine/standard-testcases/block-container_content_size_percentage.xml (working copy) @@ -61,9 +61,9 @@ <!-- from the spec: If that dimension is not specified explicitly (i.e., it depends on content's blockprogression-dimension), the value is interpreted as "auto". --> <!-- The 10% are ignored in this case. --> - <eval expected="28800" xpath="//flow/block[2]/@bpd"/> <!-- 2 lines --> + <eval expected="43200" xpath="//flow/block[2]/@bpd"/> <!-- 3 lines --> <eval expected="100000" xpath="//flow/block[2]/@ipd"/> - <eval expected="28800" xpath="//flow/block[2]/block[1]/block[1]/@bpd"/> + <eval expected="43200" xpath="//flow/block[2]/block[1]/block[1]/@bpd"/> <eval expected="50000" xpath="//flow/block[2]/block[1]/block[1]/@ipd"/> <!-- absolute --> @@ -76,9 +76,11 @@ <!-- from the spec: If that dimension is not specified explicitly (i.e., it depends on content's blockprogression-dimension), the value is interpreted as "auto". --> <!-- The 10% are ignored in this case. --> - <eval expected="43200" xpath="//flow/block[4]/@bpd"/> <!-- 3 lines --> + <eval expected="57600" xpath="//flow/block[4]/@bpd"/> <!-- 4 lines --> <eval expected="100000" xpath="//flow/block[4]/@ipd"/> - <eval expected="43200" xpath="//flow/block[4]/block[1]/block[1]/@bpd"/> + <eval expected="28800" xpath="//flow/block[4]/block[1]/block[1]/@bpd"/> <!-- the first 2 lines ... --> <eval expected="50000" xpath="//flow/block[4]/block[1]/block[1]/@ipd"/> + <eval expected="28800" xpath="//flow/block[4]/block[1]/block[2]/@bpd"/> <!-- ... and the other 2 lines --> + <eval expected="50000" xpath="//flow/block[4]/block[1]/block[2]/@ipd"/> </checks> </testcase> Index: src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java =================================================================== --- src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (revision 486104) +++ src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (working copy) @@ -1285,7 +1285,12 @@ (new KnuthGlue(lineStartBAP, 0, 0, new LeafPosition(this, -1), false)); } else { + // the first penalty is necessary in order to avoid the glue to be a feasible break + // while we are ignoring hyphenated breaks hyphenElements.add + (new KnuthPenalty(0, KnuthElement.INFINITE, false, + new LeafPosition(this, -1), false)); + hyphenElements.add (new KnuthGlue(0, 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, new LeafPosition(this, -1), false)); hyphenElements.add Index: src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java =================================================================== --- src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (revision 486104) +++ src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (working copy) @@ -545,6 +545,17 @@ log.debug("Could not find a set of breaking points " + threshold); return 0; } + // lastDeactivated was a "good" break, while lastTooShort and lastTooLong + // were "bad" breaks since the beginning; + // if it is not the node we just restarted from, lastDeactivated can + // replace either lastTooShort or lastTooLong + if (lastDeactivated != null && lastDeactivated != lastForced) { + if (lastDeactivated.adjustRatio > 0) { + lastTooShort = lastDeactivated; + } else { + lastTooLong = lastDeactivated; + } + } if (lastTooShort == null || lastForced.position == lastTooShort.position) { if (isPartOverflowRecoveryActivated()) { if (this.lastRecovered == null) {
Index: test/layoutengine/standard-testcases/block-container_content_size_percentage.xml =================================================================== --- test/layoutengine/standard-testcases/block-container_content_size_percentage.xml (revision 486106) +++ test/layoutengine/standard-testcases/block-container_content_size_percentage.xml (working copy) @@ -61,9 +61,9 @@ <!-- from the spec: If that dimension is not specified explicitly (i.e., it depends on content's blockprogression-dimension), the value is interpreted as "auto". --> <!-- The 10% are ignored in this case. --> - <eval expected="28800" xpath="//flow/block[2]/@bpd"/> <!-- 2 lines --> + <eval expected="43200" xpath="//flow/block[2]/@bpd"/> <!-- 3 lines --> <eval expected="100000" xpath="//flow/block[2]/@ipd"/> - <eval expected="28800" xpath="//flow/block[2]/block[1]/block[1]/@bpd"/> + <eval expected="43200" xpath="//flow/block[2]/block[1]/block[1]/@bpd"/> <eval expected="50000" xpath="//flow/block[2]/block[1]/block[1]/@ipd"/> <!-- absolute --> @@ -76,9 +76,11 @@ <!-- from the spec: If that dimension is not specified explicitly (i.e., it depends on content's blockprogression-dimension), the value is interpreted as "auto". --> <!-- The 10% are ignored in this case. --> - <eval expected="43200" xpath="//flow/block[4]/@bpd"/> <!-- 3 lines --> + <eval expected="57600" xpath="//flow/block[4]/@bpd"/> <!-- 4 lines --> <eval expected="100000" xpath="//flow/block[4]/@ipd"/> - <eval expected="43200" xpath="//flow/block[4]/block[1]/block[1]/@bpd"/> + <eval expected="28800" xpath="//flow/block[4]/block[1]/block[1]/@bpd"/> <!-- the first 2 lines ... --> <eval expected="50000" xpath="//flow/block[4]/block[1]/block[1]/@ipd"/> + <eval expected="28800" xpath="//flow/block[4]/block[1]/block[2]/@bpd"/> <!-- ... and the other 2 lines --> + <eval expected="50000" xpath="//flow/block[4]/block[1]/block[2]/@ipd"/> </checks> </testcase> Index: src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java =================================================================== --- src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (revision 486106) +++ src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (working copy) @@ -1292,7 +1292,12 @@ (new KnuthGlue(lineStartBAP, 0, 0, new LeafPosition(this, -1), false)); } else { + // the first penalty is necessary in order to avoid the glue to be a feasible break + // while we are ignoring hyphenated breaks hyphenElements.add + (new KnuthPenalty(0, KnuthElement.INFINITE, false, + new LeafPosition(this, -1), false)); + hyphenElements.add (new KnuthGlue(0, 3 * LineLayoutManager.DEFAULT_SPACE_WIDTH, 0, new LeafPosition(this, -1), false)); hyphenElements.add Index: src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java =================================================================== --- src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (revision 486106) +++ src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (working copy) @@ -491,6 +491,17 @@ log.debug("Could not find a set of breaking points " + threshold); return 0; } + // lastDeactivated was a "good" break, while lastTooShort and lastTooLong + // were "bad" breaks since the beginning; + // if it is not the node we just restarted from, lastDeactivated can + // replace either lastTooShort or lastTooLong + if (lastDeactivated != null && lastDeactivated != lastForced) { + if (lastDeactivated.adjustRatio > 0) { + lastTooShort = lastDeactivated; + } else { + lastTooLong = lastDeactivated; + } + } if (lastTooShort == null || lastForced.position == lastTooShort.position) { if (isPartOverflowRecoveryActivated()) { if (this.lastRecovered == null) {