View | Details | Raw Unified | Return to bug 44328
Collapse All | Expand All

(-)test/layoutengine/standard-testcases/markers_3.xml (-2 / +2 lines)
Lines 55-61 Link Here
55
          </fo:block>
55
          </fo:block>
56
        </fo:static-content>
56
        </fo:static-content>
57
        <fo:flow flow-name="xsl-region-body">
57
        <fo:flow flow-name="xsl-region-body">
58
          <fo:block>
58
          <fo:block widows="1" orphans="1">
59
            <fo:block font-size="14pt" font-weight="bold">
59
            <fo:block font-size="14pt" font-weight="bold">
60
              <fo:marker marker-class-name="PAGE">[PAGE]</fo:marker>
60
              <fo:marker marker-class-name="PAGE">[PAGE]</fo:marker>
61
              <fo:marker marker-class-name="PS">[PS]</fo:marker>
61
              <fo:marker marker-class-name="PS">[PS]</fo:marker>
Lines 96-102 Link Here
96
          </fo:block>
96
          </fo:block>
97
        </fo:static-content>
97
        </fo:static-content>
98
        <fo:flow flow-name="xsl-region-body">
98
        <fo:flow flow-name="xsl-region-body">
99
          <fo:block>
99
          <fo:block widows="1" orphans="1">
100
            <fo:block>sometext</fo:block>
100
            <fo:block>sometext</fo:block>
101
            <fo:block>sometext</fo:block>
101
            <fo:block>sometext</fo:block>
102
            <fo:block>sometext</fo:block>
102
            <fo:block>sometext</fo:block>
(-)test/layoutengine/standard-testcases/flow_changing-ipd_table-after-break.xml (-1 / +1 lines)
Lines 45-51 Link Here
45
            <fo:table-body>
45
            <fo:table-body>
46
              <fo:table-row>
46
              <fo:table-row>
47
                <fo:table-cell>
47
                <fo:table-cell>
48
                  <fo:block>
48
                  <fo:block widows="1" orphans="1">
49
                    <fo:block id="before_break">Block before the page break.</fo:block>
49
                    <fo:block id="before_break">Block before the page break.</fo:block>
50
                    <fo:block id="after_break">Block after the page break.</fo:block>
50
                    <fo:block id="after_break">Block after the page break.</fo:block>
51
                  </fo:block>
51
                  </fo:block>
(-)test/layoutengine/standard-testcases/block_padding_2.xml (-19 / +1 lines)
Lines 49-64 Link Here
49
      <penalty w="0" p="INF"/>
49
      <penalty w="0" p="INF"/>
50
      <glue w="30000"/>
50
      <glue w="30000"/>
51
      
51
      
52
      <box w="14400"/>
52
      <box w="14400"/>      
53
      
54
      <penalty w="0" p="INF"/>
55
      <glue w="30000"/> <!-- w="30000" is for the padding-after -->
56
      <penalty w="0" p="0"/>
57
      <glue w="-60000"/> <!-- difference between break and no-break situation -->
58
      <box w="0"/>
59
      <penalty w="0" p="INF"/>
60
      <glue w="30000"/> <!-- w="30000" is for the padding-before -->
61
      
62
      <box w="14400"/>
53
      <box w="14400"/>
63
      
54
      
64
      <penalty w="0" p="INF"/>
55
      <penalty w="0" p="INF"/>
Lines 90-104 Link Here
90
      <glue w="30000"/>
81
      <glue w="30000"/>
91
      
82
      
92
      <box w="14400"/>
83
      <box w="14400"/>
93
94
      <penalty w="0" p="INF"/>
95
      <glue w="30000"/>
96
      <penalty w="0" p="0"/>
97
      <glue w="-60000"/>
98
      <box w="0"/>
99
      <penalty w="0" p="INF"/>
100
      <glue w="30000"/>
101
      
102
      <box w="14400"/>
84
      <box w="14400"/>
103
      
85
      
104
      <box w="0"/>
86
      <box w="0"/>
(-)test/layoutengine/standard-testcases/inline_block_nested_4.xml (-7 / +1 lines)
Lines 52-70 Link Here
52
  <checks>
52
  <checks>
53
    <element-list category="breaker">
53
    <element-list category="breaker">
54
      <box w="12000"/>
54
      <box w="12000"/>
55
      <penalty w="0" p="0"/>
56
      <box w="12000"/>
55
      <box w="12000"/>
57
      <penalty w="0" p="0"/>
58
      <box w="12000"/>
56
      <box w="12000"/>
59
      <penalty w="0" p="0"/>
57
      <penalty w="0" p="0"/>
60
      <box w="12000"/>
58
      <box w="12000"/>
61
      <penalty w="0" p="0"/>
62
      <box w="12000"/>
59
      <box w="12000"/>
63
      <penalty w="0" p="0"/>
64
      <box w="12000"/>
60
      <box w="12000"/>
65
      <penalty w="0" p="1000"/>
61
      <skip>3</skip>
66
      <glue w="0"/>
67
      <penalty w="0" p="-1000"/>
68
    </element-list>
62
    </element-list>
69
    
63
    
70
    <!-- first block -->
64
    <!-- first block -->
(-)test/layoutengine/standard-testcases/block_border_bug43917.xml (-2 lines)
Lines 55-61 Link Here
55
      <glue w="1000"/> <!-- border-before -->
55
      <glue w="1000"/> <!-- border-before -->
56
      
56
      
57
      <box w="14400"/> <!-- Line 1 -->
57
      <box w="14400"/> <!-- Line 1 -->
58
      <penalty w="0" p="0"/> <!--SpaceHandlingBreakPosition-->
59
      <box w="14400"/> <!-- Line 2 -->
58
      <box w="14400"/> <!-- Line 2 -->
60
      
59
      
61
      <penalty w="0" p="INF"/>
60
      <penalty w="0" p="INF"/>
Lines 70-76 Link Here
70
      <glue w="1000"/> <!-- border-before -->
69
      <glue w="1000"/> <!-- border-before -->
71
      
70
      
72
      <box w="14400"/> <!-- Line 1 -->
71
      <box w="14400"/> <!-- Line 1 -->
73
      <penalty w="0" p="0"/> <!--SpaceHandlingBreakPosition-->
74
      <box w="14400"/> <!-- Line 2 -->
72
      <box w="14400"/> <!-- Line 2 -->
75
      
73
      
76
      <penalty w="0" p="INF"/>
74
      <penalty w="0" p="INF"/>
(-)test/layoutengine/standard-testcases/inline_block_nested_6.xml (-2 / +2 lines)
Lines 49-62 Link Here
49
  </fo>
49
  </fo>
50
  <checks>
50
  <checks>
51
    <element-list category="breaker">
51
    <element-list category="breaker">
52
      <skip>5</skip>
52
      <skip>3</skip>
53
      <!-- penalty between blocks b11 and b12, set by InlineLM in b1 -->
53
      <!-- penalty between blocks b11 and b12, set by InlineLM in b1 -->
54
      <penalty w="0" p="0"/>
54
      <penalty w="0" p="0"/>
55
      <skip>5</skip>
55
      <skip>5</skip>
56
      <!-- penalty between blocks b21 and b22, set by InlineLM in b2 -->
56
      <!-- penalty between blocks b21 and b22, set by InlineLM in b2 -->
57
      <!-- keep-together.within-page="always" -->
57
      <!-- keep-together.within-page="always" -->
58
      <penalty w="0" p="1000"/>
58
      <penalty w="0" p="1000"/>
59
      <skip>3</skip>
59
      <skip>5</skip>
60
      <!-- penalty between blocks b31 and b32, set by InlineLM in b3 -->
60
      <!-- penalty between blocks b31 and b32, set by InlineLM in b3 -->
61
      <!-- keep-with-next.within-page="always" -->
61
      <!-- keep-with-next.within-page="always" -->
62
      <penalty w="0" p="1000"/>
62
      <penalty w="0" p="1000"/>
(-)test/layoutengine/standard-testcases/table_border-collapse_separate_conditionals.xml (-9 / +9 lines)
Lines 48-54 Link Here
48
                  padding-after.conditionality="retain"
48
                  padding-after.conditionality="retain"
49
                  padding-before.length="2pt"
49
                  padding-before.length="2pt"
50
                  padding-before.conditionality="retain">
50
                  padding-before.conditionality="retain">
51
                  <fo:block background-color="yellow">
51
                  <fo:block background-color="yellow" widows="1" orphans="1">
52
                    <fo:block>Cell 1.1</fo:block>
52
                    <fo:block>Cell 1.1</fo:block>
53
                    <fo:block>Cell 1.1</fo:block>
53
                    <fo:block>Cell 1.1</fo:block>
54
                    <fo:block>Cell 1.1</fo:block>
54
                    <fo:block>Cell 1.1</fo:block>
Lines 60-66 Link Here
60
                  border-before-width.conditionality="retain"
60
                  border-before-width.conditionality="retain"
61
                  border-after-width.length="2pt"
61
                  border-after-width.length="2pt"
62
                  border-after-width.conditionality="retain">
62
                  border-after-width.conditionality="retain">
63
                  <fo:block background-color="yellow">
63
                  <fo:block background-color="yellow" widows="1" orphans="1">
64
                    <fo:block>Cell 1.2</fo:block>
64
                    <fo:block>Cell 1.2</fo:block>
65
                    <fo:block>Cell 1.2</fo:block>
65
                    <fo:block>Cell 1.2</fo:block>
66
                    <fo:block>Cell 1.2</fo:block>
66
                    <fo:block>Cell 1.2</fo:block>
Lines 87-93 Link Here
87
                  border-before-width.conditionality="retain"
87
                  border-before-width.conditionality="retain"
88
                  padding-after.length="5pt"
88
                  padding-after.length="5pt"
89
                  padding-after.conditionality="retain">
89
                  padding-after.conditionality="retain">
90
                  <fo:block background-color="yellow">
90
                  <fo:block background-color="yellow" widows="1" orphans="1">
91
                    <fo:block>Cell 1.1</fo:block>
91
                    <fo:block>Cell 1.1</fo:block>
92
                    <fo:block>Cell 1.1</fo:block>
92
                    <fo:block>Cell 1.1</fo:block>
93
                    <fo:block>Cell 1.1</fo:block>
93
                    <fo:block>Cell 1.1</fo:block>
Lines 99-105 Link Here
99
                  border-after-width.conditionality="retain"
99
                  border-after-width.conditionality="retain"
100
                  padding-before.length="7pt"
100
                  padding-before.length="7pt"
101
                  padding-before.conditionality="retain">
101
                  padding-before.conditionality="retain">
102
                  <fo:block background-color="yellow">
102
                  <fo:block background-color="yellow" widows="1" orphans="1">
103
                    <fo:block>Cell 1.2</fo:block>
103
                    <fo:block>Cell 1.2</fo:block>
104
                    <fo:block>Cell 1.2</fo:block>
104
                    <fo:block>Cell 1.2</fo:block>
105
                    <fo:block>Cell 1.2</fo:block>
105
                    <fo:block>Cell 1.2</fo:block>
Lines 130-136 Link Here
130
                  padding-before.conditionality="retain"
130
                  padding-before.conditionality="retain"
131
                  padding-after.length="1pt"
131
                  padding-after.length="1pt"
132
                  padding-after.conditionality="retain">
132
                  padding-after.conditionality="retain">
133
                  <fo:block background-color="yellow">
133
                  <fo:block background-color="yellow" widows="1" orphans="1">
134
                    <fo:block>Cell 1.1</fo:block>
134
                    <fo:block>Cell 1.1</fo:block>
135
                    <fo:block>Cell 1.1</fo:block>
135
                    <fo:block>Cell 1.1</fo:block>
136
                    <fo:block>Cell 1.1</fo:block>
136
                    <fo:block>Cell 1.1</fo:block>
Lines 138-144 Link Here
138
                  </fo:block>
138
                  </fo:block>
139
                </fo:table-cell>
139
                </fo:table-cell>
140
                <fo:table-cell border="4pt solid blue" padding="2pt">
140
                <fo:table-cell border="4pt solid blue" padding="2pt">
141
                  <fo:block background-color="yellow">
141
                  <fo:block background-color="yellow" widows="1" orphans="1">
142
                    <fo:block>Cell 1.2</fo:block>
142
                    <fo:block>Cell 1.2</fo:block>
143
                    <fo:block>Cell 1.2</fo:block>
143
                    <fo:block>Cell 1.2</fo:block>
144
                    <fo:block>Cell 1.2</fo:block>
144
                    <fo:block>Cell 1.2</fo:block>
Lines 165-171 Link Here
165
                  border-after-width.conditionality="retain"
165
                  border-after-width.conditionality="retain"
166
                  padding-after.length="9pt"
166
                  padding-after.length="9pt"
167
                  padding-after.conditionality="retain">
167
                  padding-after.conditionality="retain">
168
                  <fo:block background-color="yellow">
168
                  <fo:block background-color="yellow" widows="1" orphans="1">
169
                    <fo:block>Cell 1.1</fo:block>
169
                    <fo:block>Cell 1.1</fo:block>
170
                    <fo:block>Cell 1.1</fo:block>
170
                    <fo:block>Cell 1.1</fo:block>
171
                    <fo:block>Cell 1.1</fo:block>
171
                    <fo:block>Cell 1.1</fo:block>
Lines 177-183 Link Here
177
                  border-before-width.conditionality="retain"
177
                  border-before-width.conditionality="retain"
178
                  padding-before.length="11pt"
178
                  padding-before.length="11pt"
179
                  padding-before.conditionality="retain">
179
                  padding-before.conditionality="retain">
180
                  <fo:block background-color="yellow">
180
                  <fo:block background-color="yellow" widows="1" orphans="1">
181
                    <fo:block>Cell 1.2</fo:block>
181
                    <fo:block>Cell 1.2</fo:block>
182
                    <fo:block>Cell 1.2</fo:block>
182
                    <fo:block>Cell 1.2</fo:block>
183
                    <fo:block>Cell 1.2</fo:block>
183
                    <fo:block>Cell 1.2</fo:block>
Lines 201-207 Link Here
201
            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
201
            <fo:table-column column-width="proportional-column-width(1)" number-columns-repeated="2"/>
202
            <fo:table-body>
202
            <fo:table-body>
203
              <fo:table-row>
203
              <fo:table-row>
204
                <fo:table-cell border="2pt solid blue">
204
                <fo:table-cell border="2pt solid blue" widows="1" orphans="1">
205
                  <fo:block>Cell 1.1</fo:block>
205
                  <fo:block>Cell 1.1</fo:block>
206
                  <fo:block>Cell 1.1</fo:block>
206
                  <fo:block>Cell 1.1</fo:block>
207
                  <fo:block>Cell 1.1</fo:block>
207
                  <fo:block>Cell 1.1</fo:block>
(-)test/layoutengine/standard-testcases/inline_block-level_nested_1.xml (-6 lines)
Lines 77-99 Link Here
77
  <checks>
77
  <checks>
78
    <element-list category="breaker">
78
    <element-list category="breaker">
79
      <box w="14400"/>
79
      <box w="14400"/>
80
      <penalty w="0" p="0"/>
81
      <box w="14400"/>
80
      <box w="14400"/>
82
      <penalty w="0" p="0"/>
83
      <box w="14400"/>
81
      <box w="14400"/>
84
      <penalty w="0" p="0"/>
82
      <penalty w="0" p="0"/>
85
      <glue w="6000" aux="true"/>
83
      <glue w="6000" aux="true"/>
86
      <box w="14400"/>
84
      <box w="14400"/>
87
      <penalty w="0" p="0"/>
88
      <box w="14400"/>
85
      <box w="14400"/>
89
      <penalty w="0" p="0"/>
90
      <box w="14400"/>
86
      <box w="14400"/>
91
      <penalty w="0" p="0"/>
87
      <penalty w="0" p="0"/>
92
      <glue w="6000" aux="true"/>
88
      <glue w="6000" aux="true"/>
93
      <box w="14400"/>
89
      <box w="14400"/>
94
      <penalty w="0" p="0"/>
95
      <box w="14400"/>
90
      <box w="14400"/>
96
      <penalty w="0" p="0"/>
97
      <box w="14400"/>
91
      <box w="14400"/>
98
      <skip>3</skip>
92
      <skip>3</skip>
99
    </element-list>
93
    </element-list>
(-)test/layoutengine/standard-testcases/table_border-collapse_collapse_conditionals.xml (-5 / +5 lines)
Lines 43-49 Link Here
43
            <fo:table-body>
43
            <fo:table-body>
44
              <fo:table-row border="5pt solid red">
44
              <fo:table-row border="5pt solid red">
45
                <fo:table-cell border="7pt solid blue" padding="2pt">
45
                <fo:table-cell border="7pt solid blue" padding="2pt">
46
                  <fo:block background-color="yellow">
46
                  <fo:block background-color="yellow" widows="1" orphans="1">
47
                    <fo:block>Cell 1.1</fo:block>
47
                    <fo:block>Cell 1.1</fo:block>
48
                    <fo:block>Cell 1.1</fo:block>
48
                    <fo:block>Cell 1.1</fo:block>
49
                  </fo:block>
49
                  </fo:block>
Lines 54-60 Link Here
54
                  border-before-width.conditionality="retain"
54
                  border-before-width.conditionality="retain"
55
                  padding-after.length="7pt"
55
                  padding-after.length="7pt"
56
                  padding-after.conditionality="retain">
56
                  padding-after.conditionality="retain">
57
                  <fo:block background-color="yellow">
57
                  <fo:block background-color="yellow" widows="1" orphans="1">
58
                    <fo:block>Cell 1.2</fo:block>
58
                    <fo:block>Cell 1.2</fo:block>
59
                    <fo:block>Cell 1.2</fo:block>
59
                    <fo:block>Cell 1.2</fo:block>
60
                    <fo:block>Cell 1.2</fo:block>
60
                    <fo:block>Cell 1.2</fo:block>
Lines 66-72 Link Here
66
                border-before-width.length="5pt"
66
                border-before-width.length="5pt"
67
                border-before-width.conditionality="retain">
67
                border-before-width.conditionality="retain">
68
                <fo:table-cell border="4pt solid green" padding="2pt">
68
                <fo:table-cell border="4pt solid green" padding="2pt">
69
                  <fo:block background-color="yellow">
69
                  <fo:block background-color="yellow" widows="1" orphans="1">
70
                    <fo:block>Cell 2.1</fo:block>
70
                    <fo:block>Cell 2.1</fo:block>
71
                    <fo:block>Cell 2.1</fo:block>
71
                    <fo:block>Cell 2.1</fo:block>
72
                  </fo:block>
72
                  </fo:block>
Lines 105-111 Link Here
105
                border-before-width.length="5pt"
105
                border-before-width.length="5pt"
106
                border-before-width.conditionality="retain">
106
                border-before-width.conditionality="retain">
107
                <fo:table-cell border="4pt solid green" padding="2pt">
107
                <fo:table-cell border="4pt solid green" padding="2pt">
108
                  <fo:block background-color="yellow">
108
                  <fo:block background-color="yellow" widows="1" orphans="1">
109
                    <fo:block>Cell 2.1</fo:block>
109
                    <fo:block>Cell 2.1</fo:block>
110
                    <fo:block>Cell 2.1</fo:block>
110
                    <fo:block>Cell 2.1</fo:block>
111
                  </fo:block>
111
                  </fo:block>
Lines 115-121 Link Here
115
                border-before-width.length="5pt"
115
                border-before-width.length="5pt"
116
                border-before-width.conditionality="retain">
116
                border-before-width.conditionality="retain">
117
                <fo:table-cell border="4pt solid green" padding="2pt">
117
                <fo:table-cell border="4pt solid green" padding="2pt">
118
                  <fo:block background-color="yellow">
118
                  <fo:block background-color="yellow" widows="1" orphans="1">
119
                    <fo:block>Cell 3.1</fo:block>
119
                    <fo:block>Cell 3.1</fo:block>
120
                    <fo:block>Cell 3.1</fo:block>
120
                    <fo:block>Cell 3.1</fo:block>
121
                  </fo:block>
121
                  </fo:block>
(-)test/layoutengine/standard-testcases/wrapper_inline_block.xml (-2 lines)
Lines 40-48 Link Here
40
    <!-- Just check if this really results in 3 lines. -->
40
    <!-- Just check if this really results in 3 lines. -->
41
    <element-list category="breaker">
41
    <element-list category="breaker">
42
      <box w="14400"/>
42
      <box w="14400"/>
43
      <penalty w="0" p="0"/>
44
      <box w="14400"/>
43
      <box w="14400"/>
45
      <penalty w="0" p="0"/>
46
      <box w="14400"/>
44
      <box w="14400"/>
47
      <skip>3</skip>
45
      <skip>3</skip>
48
    </element-list>
46
    </element-list>
(-)test/layoutengine/standard-testcases/flow_changing-ipd_no-restartable.xml (-3 / +3 lines)
Lines 53-59 Link Here
53
            <fo:table-body>
53
            <fo:table-body>
54
              <fo:table-row>
54
              <fo:table-row>
55
                <fo:table-cell>
55
                <fo:table-cell>
56
                  <fo:block>
56
                  <fo:block widows="1" orphans="1">
57
                    <fo:block>Before page break</fo:block>
57
                    <fo:block>Before page break</fo:block>
58
                    <fo:block>After page break</fo:block>
58
                    <fo:block>After page break</fo:block>
59
                  </fo:block>
59
                  </fo:block>
Lines 70-76 Link Here
70
            <fo:table-body>
70
            <fo:table-body>
71
              <fo:table-row>
71
              <fo:table-row>
72
                <fo:table-cell>
72
                <fo:table-cell>
73
                  <fo:block>
73
                  <fo:block widows="1" orphans="1">
74
                    <fo:block>Before page break</fo:block>
74
                    <fo:block>Before page break</fo:block>
75
                    <fo:block>After page break</fo:block>
75
                    <fo:block>After page break</fo:block>
76
                  </fo:block>
76
                  </fo:block>
Lines 122-128 Link Here
122
            <fo:table-body>
122
            <fo:table-body>
123
              <fo:table-row>
123
              <fo:table-row>
124
                <fo:table-cell>
124
                <fo:table-cell>
125
                  <fo:block>
125
                  <fo:block widows="1" orphans="1">
126
                    <fo:block>Before page break</fo:block>
126
                    <fo:block>Before page break</fo:block>
127
                    <fo:block>After page break</fo:block>
127
                    <fo:block>After page break</fo:block>
128
                  </fo:block>
128
                  </fo:block>
(-)test/layoutengine/standard-testcases/block_space-before_space-after_4.xml (-6 / +4 lines)
Lines 48-63 Link Here
48
      <penalty w="0" p="INF"/>
48
      <penalty w="0" p="INF"/>
49
      <glue w="5000"/>
49
      <glue w="5000"/>
50
      <box w="10000"/>
50
      <box w="10000"/>
51
      <penalty w="0" p="0"/>
52
      
53
      <box w="10000"/>
51
      <box w="10000"/>
54
      <penalty w="0" p="0"/>
52
      <penalty w="0" p="0"/>
55
53
56
      <!-- skip two more lines -->
54
      <!-- skip one line -->
57
      <skip>2</skip>
55
      <skip>2</skip>
58
      <skip>2</skip>
59
      
56
      
60
      <box w="10000"/>
57
      <box w="10000"/>
58
      <box w="10000"/>
61
      
59
      
62
      <skip>3</skip>
60
      <skip>3</skip>
63
    </element-list>
61
    </element-list>
Lines 69-76 Link Here
69
    <eval expected="1" xpath="count(//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
67
    <eval expected="1" xpath="count(//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
70
    <eval expected="1" xpath="count(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
68
    <eval expected="1" xpath="count(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block)"/>
71
    <eval expected="2" xpath="count(//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block)"/>
69
    <eval expected="2" xpath="count(//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block)"/>
72
    <eval expected="2" xpath="count(//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block)"/>
70
    <eval expected="1" xpath="count(//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block)"/>
73
    <eval expected="1" xpath="count(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block)"/>
71
    <eval expected="2" xpath="count(//pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/block)"/>
74
    
72
    
75
  </checks>
73
  </checks>
76
</testcase>
74
</testcase>
(-)test/layoutengine/standard-testcases/markers_2.xml (-3 / +3 lines)
Lines 55-61 Link Here
55
          </fo:block-container>
55
          </fo:block-container>
56
        </fo:static-content>
56
        </fo:static-content>
57
        <fo:flow flow-name="xsl-region-body">
57
        <fo:flow flow-name="xsl-region-body">
58
          <fo:block>
58
          <fo:block widows="1" orphans="1">
59
            <fo:marker marker-class-name="part1">
59
            <fo:marker marker-class-name="part1">
60
              <fo:block background-color="black" color="white" text-align="center">1</fo:block>
60
              <fo:block background-color="black" color="white" text-align="center">1</fo:block>
61
            </fo:marker>
61
            </fo:marker>
Lines 68-74 Link Here
68
            <fo:block>text1</fo:block>
68
            <fo:block>text1</fo:block>
69
            <fo:block>text1</fo:block>
69
            <fo:block>text1</fo:block>
70
          </fo:block>
70
          </fo:block>
71
          <fo:block>
71
          <fo:block widows="1" orphans="1">
72
            <fo:marker marker-class-name="part2">
72
            <fo:marker marker-class-name="part2">
73
              <fo:block background-color="black" color="white" text-align="center">2</fo:block>
73
              <fo:block background-color="black" color="white" text-align="center">2</fo:block>
74
            </fo:marker>
74
            </fo:marker>
Lines 78-84 Link Here
78
            <fo:block>text2</fo:block>
78
            <fo:block>text2</fo:block>
79
            <fo:block>text2</fo:block>
79
            <fo:block>text2</fo:block>
80
          </fo:block>
80
          </fo:block>
81
          <fo:block>
81
          <fo:block widows="1" orphans="1">
82
            <fo:marker marker-class-name="part3">
82
            <fo:marker marker-class-name="part3">
83
              <fo:block background-color="black" color="white" text-align="center">3</fo:block>
83
              <fo:block background-color="black" color="white" text-align="center">3</fo:block>
84
            </fo:marker>
84
            </fo:marker>
(-)test/layoutengine/standard-testcases/block_space-before_space-after_7.xml (-1 / +2 lines)
Lines 47-53 Link Here
47
      <glue w="7000"/>
47
      <glue w="7000"/>
48
      <box w="14400"/>
48
      <box w="14400"/>
49
      
49
      
50
      <penalty w="0" p="0"/>
50
      <box w="0"/>
51
      <penalty w="0" p="INF"/>
51
      
52
      
52
      <glue w="6000"/>
53
      <glue w="6000"/>
53
      <box w="14400"/>
54
      <box w="14400"/>
(-)test/layoutengine/standard-testcases/region-body_column-count_bug37828.xml (-3 / +3 lines)
Lines 62-70 Link Here
62
    <eval expected="57600" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span[2]/flow[1]/@bpd"/>
62
    <eval expected="57600" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span[2]/flow[1]/@bpd"/>
63
    <eval expected="57600" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span[2]/flow[2]/@bpd"/>
63
    <eval expected="57600" xpath="//pageViewport[@nr=1]/page/regionViewport/regionBody/mainReference/span[2]/flow[2]/@bpd"/>
64
64
65
    <eval expected="14400" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span[1]/@bpd"/>
65
    <eval expected="28800" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span[1]/@bpd"/>
66
    <eval expected="14400" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span[1]/flow[1]/@bpd"/>
66
    <eval expected="28800" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span[1]/flow[1]/@bpd"/>
67
    <eval expected="14400" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span[1]/flow[2]/@bpd"/>
67
    <eval expected="0" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span[1]/flow[2]/@bpd"/>
68
    <eval expected="14400" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span[2]/@bpd"/>
68
    <eval expected="14400" xpath="//pageViewport[@nr=2]/page/regionViewport/regionBody/mainReference/span[2]/@bpd"/>
69
  </checks>
69
  </checks>
70
</testcase>
70
</testcase>
(-)test/layoutengine/standard-testcases/block_space-before_space-after_6.xml (-2 / +3 lines)
Lines 33-39 Link Here
33
      <fo:page-sequence master-reference="normal" id="ex1">
33
      <fo:page-sequence master-reference="normal" id="ex1">
34
        <fo:flow flow-name="xsl-region-body">
34
        <fo:flow flow-name="xsl-region-body">
35
          <fo:block>first line</fo:block>
35
          <fo:block>first line</fo:block>
36
          <fo:block space-before="10pt">
36
          <fo:block space-before="10pt" orphans="1" widows="1">
37
            <fo:block>before break</fo:block>
37
            <fo:block>before break</fo:block>
38
            <fo:block>after break</fo:block>
38
            <fo:block>after break</fo:block>
39
          </fo:block>
39
          </fo:block>
Lines 42-48 Link Here
42
      <fo:page-sequence master-reference="normal" id="ex2">
42
      <fo:page-sequence master-reference="normal" id="ex2">
43
        <fo:flow flow-name="xsl-region-body">
43
        <fo:flow flow-name="xsl-region-body">
44
          <fo:block>first line</fo:block>
44
          <fo:block>first line</fo:block>
45
          <fo:block space-before="10pt" space-before.conditionality="retain">
45
          <fo:block space-before="10pt" space-before.conditionality="retain"
46
                    orphans="1" widows="1">
46
            <fo:block>before break</fo:block>
47
            <fo:block>before break</fo:block>
47
            <fo:block>after break</fo:block>
48
            <fo:block>after break</fo:block>
48
          </fo:block>
49
          </fo:block>
(-)test/layoutengine/standard-testcases/flow_changing-ipd_last-page.xml (-1 / +1 lines)
Lines 45-51 Link Here
45
      <fo:page-sequence master-reference="pages" font-size="8pt" line-height="10pt">
45
      <fo:page-sequence master-reference="pages" font-size="8pt" line-height="10pt">
46
        <fo:flow flow-name="xsl-region-body" text-align="justify">
46
        <fo:flow flow-name="xsl-region-body" text-align="justify">
47
          <fo:block space-after="140pt">First block</fo:block>
47
          <fo:block space-after="140pt">First block</fo:block>
48
          <fo:block id="surrounding">
48
          <fo:block id="surrounding" widows="1" orphans="1">
49
            <fo:block id="before">Block before the page break.</fo:block>
49
            <fo:block id="before">Block before the page break.</fo:block>
50
            <fo:block id="after">Block after the page break.</fo:block>
50
            <fo:block id="after">Block after the page break.</fo:block>
51
          </fo:block>
51
          </fo:block>
(-)test/layoutengine/standard-testcases/inline_block_nested_1.xml (-2 lines)
Lines 39-47 Link Here
39
  <checks>
39
  <checks>
40
    <element-list category="breaker">
40
    <element-list category="breaker">
41
      <box w="14400"/>
41
      <box w="14400"/>
42
      <penalty w="0" p="0"/>
43
      <box w="0" aux="true"/> <!-- this is from the empty block -->
42
      <box w="0" aux="true"/> <!-- this is from the empty block -->
44
      <penalty w="0" p="0"/>
45
      <box w="14400"/>
43
      <box w="14400"/>
46
      <skip>3</skip>
44
      <skip>3</skip>
47
    </element-list>
45
    </element-list>
(-)test/layoutengine/standard-testcases/block_space-before_space-after_bug38102.xml (-2 / +2 lines)
Lines 113-119 Link Here
113
    <element-list category="breaker" id="block">
113
    <element-list category="breaker" id="block">
114
      <box w="14400"/>
114
      <box w="14400"/>
115
      
115
      
116
      <penalty w="0" p="0"/>
116
      <box w="0"/>
117
      <penalty w="0" p="INF"/>
117
      
118
      
118
      <glue w="16000" y="0" z="0"/>
119
      <glue w="16000" y="0" z="0"/>
119
      <box w="14400"/>
120
      <box w="14400"/>
Lines 127-133 Link Here
127
      <box w="14400"/>
128
      <box w="14400"/>
128
      <penalty w="0" p="0"/>
129
      <penalty w="0" p="0"/>
129
      <box w="14400"/>
130
      <box w="14400"/>
130
      <penalty w="0" p="0"/>
131
      <box w="14400"/>
131
      <box w="14400"/>
132
      
132
      
133
      <skip>3</skip>
133
      <skip>3</skip>
(-)test/layoutengine/standard-testcases/block_space-before_space-after_9a.xml (-3 / +1 lines)
Lines 59-67 Link Here
59
    <element-list category="breaker" index="1">
59
    <element-list category="breaker" index="1">
60
      <box w="0"/> <!-- SpaceHandlingPosition -->
60
      <box w="0"/> <!-- SpaceHandlingPosition -->
61
      
61
      
62
      <box w="0"/> <!-- empty block used to cause the break-before -->
62
      <box w="0"/> <!-- empty block used to cause the break-before -->      
63
      <penalty w="0" p="0"/>
64
      
65
      <box w="14400"/>
63
      <box w="14400"/>
66
      
64
      
67
      <box w="0"/>
65
      <box w="0"/>
(-)src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (-7 / +170 lines)
Lines 66-71 Link Here
66
    private MinOptMax effSpaceBefore;
66
    private MinOptMax effSpaceBefore;
67
    private MinOptMax effSpaceAfter;
67
    private MinOptMax effSpaceAfter;
68
68
69
    private int orphans = 2;
70
    private int widows = 2;
71
69
    /**
72
    /**
70
     * Creates a new BlockLayoutManager.
73
     * Creates a new BlockLayoutManager.
71
     * @param inBlock the block FO object to create the layout manager for.
74
     * @param inBlock the block FO object to create the layout manager for.
Lines 97-102 Link Here
97
                                    .getOptimum(this).getLength().getValue(this);
100
                                    .getOptimum(this).getLength().getValue(this);
98
        adjustedSpaceAfter = fo.getCommonMarginBlock().spaceAfter.getSpace()
101
        adjustedSpaceAfter = fo.getCommonMarginBlock().spaceAfter.getSpace()
99
                                    .getOptimum(this).getLength().getValue(this);
102
                                    .getOptimum(this).getLength().getValue(this);
103
        orphans = fo.getOrphans();
104
        widows = fo.getWidows();
100
    }
105
    }
101
106
102
    /** {@inheritDoc} */
107
    /** {@inheritDoc} */
Lines 110-119 Link Here
110
    public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
115
    public List getNextKnuthElements(LayoutContext context, int alignment, Stack lmStack,
111
            Position restartPosition, LayoutManager restartAtLM) {
116
            Position restartPosition, LayoutManager restartAtLM) {
112
        resetSpaces();
117
        resetSpaces();
113
        return super.getNextKnuthElements(
118
119
        List<ListElement> contentList = super.getNextKnuthElements(
114
                context, alignment, lmStack, restartPosition, restartAtLM);
120
                context, alignment, lmStack, restartPosition, restartAtLM);
115
    }
121
122
        if (!this.hasNextChildLM()) {
123
            // handle widows
124
            int boxCount = 0;
125
            ListElement current, last = null;
126
            for (ListIterator<ListElement> it = contentList.listIterator(contentList.size());
127
                    it.hasPrevious();) {
128
                current = it.previous();
129
                if (current.isBox() && !((KnuthBox) current).isAuxiliary()) {
130
                    // non-auxiliary box => assume a 'line' and increase boxCount
131
                    boxCount++;
132
                    if (boxCount >= widows) {
133
                        break;
134
                    }
135
                } else if (current.isGlue()) {
136
                    if (it.hasPrevious() && it.previous().isBox()) {
137
                        // return to current
138
                        it.next();
139
                        it.next();
140
                        KnuthGlue glue = (KnuthGlue)current;
141
                        if (glue.getShrink() == 0 && glue.getStretch() == 0) {
142
                            // non-stretchable glue => convert to auxiliary box
143
                            it.set(new KnuthBox(glue.getWidth(), glue.getPosition(), true));
144
                        } else {
145
                            // stretchable glue => convert to auxiliary box
146
                            it.previous();
147
                            it.previous();
148
                            it.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, true));
149
                            it.previous();
150
                        }
151
                    }
152
                } else if (current.isPenalty() || current instanceof BreakElement
153
                            && !current.isForcedBreak()) {
154
                    if (last != null && last.isBox()
155
                            && it.hasPrevious() && it.previous().isBox()) {
156
                        // return to current
157
                        it.next();
158
                        it.next();
159
                        // penalty or BreakElement in between two boxes => remove
160
                        it.remove();
161
                    } else {
162
                        it.next();
163
                        if (current.isPenalty()) {
164
                            KnuthPenalty penalty = (KnuthPenalty)current;
165
                            //Convert penalty to break inhibitor
166
                            if (penalty.getPenalty() < KnuthPenalty.INFINITE) {
167
                                it.set(new KnuthPenalty(penalty.getWidth(), KnuthPenalty.INFINITE,
168
                                        penalty.isPenaltyFlagged(), penalty.getPosition(),
169
                                        penalty.isAuxiliary()));
170
                            }
171
                        } else {
172
                            // a BreakElement
173
                            BreakElement breakEl = (BreakElement)current;
174
                            if (breakEl.getPenaltyValue() < KnuthPenalty.INFINITE) {
175
                                breakEl.setPenaltyValue(KnuthPenalty.INFINITE);
176
                            }
177
                        }
178
                        it.previous();
179
                    }
180
                }
181
                last = current;
182
            }
183
        }
116
184
185
        return contentList;
186
    }
187
117
    /**
188
    /**
118
     * Overridden to take into account that the childLM may be the block's
189
     * Overridden to take into account that the childLM may be the block's
119
     * {@link LineLayoutManager}.
190
     * {@link LineLayoutManager}.
Lines 132-156 Link Here
132
            // nop; will have been properly set by makeChildLayoutContext()
203
            // nop; will have been properly set by makeChildLayoutContext()
133
        }
204
        }
134
205
135
        if (childLM == this.childLMs.get(0)) {
206
        boolean isFirst = childLM == this.childLMs.get(0);
207
        if (isFirst) {
136
            childLC.setFlags(LayoutContext.SUPPRESS_BREAK_BEFORE);
208
            childLC.setFlags(LayoutContext.SUPPRESS_BREAK_BEFORE);
137
            //Handled already by the parent (break collapsing, see above)
209
            //Handled already by the parent (break collapsing, see above)
138
        }
210
        }
139
211
212
        List<ListElement> childElements;
140
        if (lmStack == null) {
213
        if (lmStack == null) {
141
            return childLM.getNextKnuthElements(childLC, alignment);
214
            childElements = childLM.getNextKnuthElements(childLC, alignment);
142
        } else {
215
        } else {
143
            if (childLM instanceof LineLayoutManager) {
216
            if (childLM instanceof LineLayoutManager) {
144
                assert (restartPosition instanceof LeafPosition);
217
                assert (restartPosition instanceof LeafPosition);
145
                return ((LineLayoutManager) childLM).getNextKnuthElements(childLC, alignment,
218
                childElements = ((LineLayoutManager) childLM).getNextKnuthElements(childLC, alignment,
146
                        (LeafPosition) restartPosition);
219
                        (LeafPosition) restartPosition);
147
            } else {
220
            } else {
148
                return childLM.getNextKnuthElements(childLC, alignment,
221
                childElements = childLM.getNextKnuthElements(childLC, alignment,
149
                        lmStack, restartPosition, restartAtLM);
222
                        lmStack, restartPosition, restartAtLM);
150
            }
223
            }
151
        }
224
        }
152
    }
225
226
        if (isFirst) {
227
            // handle orphans
228
            int boxCount = 0;
229
            ListElement current, previous = null;
230
            for (ListIterator<ListElement> it = childElements.listIterator(); it.hasNext();) {
231
                current = it.next();
232
                if (current.isBox() && !((KnuthBox) current).isAuxiliary()) {
233
                    // non-auxiliary box => assume a 'line' and increase boxCount
234
                    boxCount++;
235
                    if (boxCount >= orphans) {
236
                        break;
237
                    }
238
                } else if (current.isGlue()) {
239
                    if (previous != null && previous.isBox()) {
240
                        KnuthGlue glue = (KnuthGlue) current;
241
                        if (glue.getStretch() == 0 && glue.getShrink() == 0) {
242
                            // non-stretchable glue => replace with a box of the same width
243
                            it.set(new KnuthBox(glue.getWidth(), glue.getPosition(), true));
244
                        } else {
245
                            // stretchable glue => add break-inhibitor
246
                            it.previous();
247
                            it.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, true));
248
                            it.next();
249
                        }
250
                    }
251
                } else if (current.isPenalty() || current instanceof BreakElement
252
                            && !current.isForcedBreak()) {
253
                    if (previous != null && previous.isBox()
254
                            && it.hasNext() && it.next().isBox()) {
255
                        // penalty or BreakElement in between boxes => remove
256
                        it.previous();
257
                        it.previous();
258
                        it.remove();
259
                    } else {
260
                        it.previous();
261
                        it.previous();
262
                        if (current.isPenalty()) {
263
                            KnuthPenalty penalty = (KnuthPenalty)current;
264
                            //Convert penalty to break inhibitor
265
                            if (penalty.getPenalty() < KnuthPenalty.INFINITE) {
266
                                it.set(new KnuthPenalty(penalty.getWidth(), KnuthPenalty.INFINITE,
267
                                        penalty.isPenaltyFlagged(), penalty.getPosition(),
268
                                        penalty.isAuxiliary()));
269
                            }
270
                        } else {
271
                            // a BreakElement
272
                            BreakElement breakEl = (BreakElement)current;
273
                            if (breakEl.getPenaltyValue() < KnuthPenalty.INFINITE) {
274
                                breakEl.setPenaltyValue(KnuthPenalty.INFINITE);
275
                            }
276
                        }
277
                    }
278
                }
279
                previous = current;
280
            }
281
        }
153
282
283
        return childElements;
284
    }
285
286
    /**
287
     * Overridden to deal with a special case for the "orphans" property.
288
     * {@inheritDoc}
289
     */
290
    @Override
291
    protected void addInBetweenBreak(List<ListElement> contentList, LayoutContext parentLC, LayoutContext childLC) {
292
293
        if (this.childLMs.size() > 1 &&
294
                this.curChildLM == this.childLMs.get(1)) {
295
            // special case: second childLM; if the first childLM did not produce enough
296
            // lines to satisfy this LM's orphans constraint, avoid adding a break possibility
297
            boolean orphansSatisfied = false;
298
            int boxCount = 0;
299
            for (ListElement el : contentList) {
300
                if (el.isBox() && !((KnuthBox) el).isAuxiliary()) {
301
                    boxCount++;
302
                    if (boxCount >= orphans) {
303
                        orphansSatisfied = true;
304
                        break;
305
                    }
306
                }
307
            }
308
309
            if (!orphansSatisfied) {
310
                return;
311
            }
312
        }
313
314
        super.addInBetweenBreak(contentList, parentLC, childLC);
315
    }
316
154
    private void resetSpaces() {
317
    private void resetSpaces() {
155
        this.discardBorderBefore = false;
318
        this.discardBorderBefore = false;
156
        this.discardBorderAfter = false;
319
        this.discardBorderAfter = false;
(-)src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (-31 / +28 lines)
Lines 155-161 Link Here
155
    private final int follow;
155
    private final int follow;
156
    private AlignmentContext alignmentContext;
156
    private AlignmentContext alignmentContext;
157
157
158
    private List knuthParagraphs;
158
    private List<KnuthSequence> knuthParagraphs;
159
159
160
    private LineLayoutPossibilities lineLayouts;
160
    private LineLayoutPossibilities lineLayouts;
161
    private LineLayoutPossibilities[] lineLayoutsList;
161
    private LineLayoutPossibilities[] lineLayoutsList;
Lines 400-406 Link Here
400
            // true if this line contains only zero-height, auxiliary boxes
400
            // true if this line contains only zero-height, auxiliary boxes
401
            // and the actual line width is 0; in this case, the line "collapses"
401
            // and the actual line width is 0; in this case, the line "collapses"
402
            // i.e. the line area will have bpd = 0
402
            // i.e. the line area will have bpd = 0
403
            boolean bZeroHeightLine = (difference == ipd);
403
            boolean isZeroHeightLine = (difference == ipd);
404
404
405
            // if line-stacking-strategy is "font-height", the line height
405
            // if line-stacking-strategy is "font-height", the line height
406
            // is not affected by its content
406
            // is not affected by its content
Lines 436-444 Link Here
436
                            }
436
                            }
437
                            lastAC = ac;
437
                            lastAC = ac;
438
                        }
438
                        }
439
                        if (bZeroHeightLine
439
                        if (isZeroHeightLine
440
                            && (!element.isAuxiliary() || ac != null && ac.getHeight() > 0)) {
440
                            && (!element.isAuxiliary() || ac != null && ac.getHeight() > 0)) {
441
                            bZeroHeightLine = false;
441
                            isZeroHeightLine = false;
442
                        }
442
                        }
443
                    }
443
                    }
444
                }
444
                }
Lines 450-456 Link Here
450
450
451
            constantLineHeight = lineLead + lineFollow;
451
            constantLineHeight = lineLead + lineFollow;
452
452
453
            if (bZeroHeightLine) {
453
            if (isZeroHeightLine) {
454
                return new LineBreakPosition(thisLLM,
454
                return new LineBreakPosition(thisLLM,
455
                                             knuthParagraphs.indexOf(par),
455
                                             knuthParagraphs.indexOf(par),
456
                                             firstElementIndex, lastElementIndex,
456
                                             firstElementIndex, lastElementIndex,
Lines 580-586 Link Here
580
        //PHASE 1: Create Knuth elements
580
        //PHASE 1: Create Knuth elements
581
        if (knuthParagraphs == null) {
581
        if (knuthParagraphs == null) {
582
            // it's the first time this method is called
582
            // it's the first time this method is called
583
            knuthParagraphs = new ArrayList();
583
            knuthParagraphs = new ArrayList<KnuthSequence>();
584
584
585
            // here starts Knuth's algorithm
585
            // here starts Knuth's algorithm
586
            collectInlineKnuthElements(context);
586
            collectInlineKnuthElements(context);
Lines 612-623 Link Here
612
            LeafPosition restartPosition) {
612
            LeafPosition restartPosition) {
613
        log.trace("Restarting line breaking from index " + restartPosition.getIndex());
613
        log.trace("Restarting line breaking from index " + restartPosition.getIndex());
614
        int parIndex = restartPosition.getLeafPos();
614
        int parIndex = restartPosition.getLeafPos();
615
        Paragraph paragraph = (Paragraph) knuthParagraphs.get(parIndex);
615
        KnuthSequence paragraph = knuthParagraphs.get(parIndex);
616
        for (int i = 0; i <= restartPosition.getIndex(); i++) {
616
        paragraph.subList(0, restartPosition.getIndex()).clear();
617
            paragraph.remove(0);
617
        Iterator<KnuthElement> iter = paragraph.iterator();
618
        }
618
        while (iter.hasNext() && !iter.next().isBox()) {
619
        Iterator iter = paragraph.iterator();
620
        while (iter.hasNext() && !((KnuthElement) iter.next()).isBox()) {
621
            iter.remove();
619
            iter.remove();
622
        }
620
        }
623
        if (!iter.hasNext()) {
621
        if (!iter.hasNext()) {
Lines 650-657 Link Here
650
648
651
        Paragraph lastPar = null;
649
        Paragraph lastPar = null;
652
650
653
        InlineLevelLayoutManager curLM;
651
        InlineLevelLayoutManager curLM = (InlineLevelLayoutManager) getChildLM();
654
        while ((curLM = (InlineLevelLayoutManager) getChildLM()) != null) {
652
        while (curLM != null) {
655
            List inlineElements = curLM.getNextKnuthElements(inlineLC, effectiveAlignment);
653
            List inlineElements = curLM.getNextKnuthElements(inlineLC, effectiveAlignment);
656
            if (inlineElements == null || inlineElements.size() == 0) {
654
            if (inlineElements == null || inlineElements.size() == 0) {
657
                /* curLM.getNextKnuthElements() returned null or an empty list;
655
                /* curLM.getNextKnuthElements() returned null or an empty list;
Lines 748-754 Link Here
748
                    }
746
                    }
749
                }
747
                }
750
            } // end of loop over returnedList
748
            } // end of loop over returnedList
749
            curLM = (InlineLevelLayoutManager) getChildLM();
751
        }
750
        }
751
752
        if (lastPar != null) {
752
        if (lastPar != null) {
753
            lastPar.endParagraph();
753
            lastPar.endParagraph();
754
            ElementListObserver.observe(lastPar, "line", fobj.getId());
754
            ElementListObserver.observe(lastPar, "line", fobj.getId());
Lines 765-777 Link Here
765
     * @param context the layout context
765
     * @param context the layout context
766
     * @return a list of Knuth elements representing broken lines
766
     * @return a list of Knuth elements representing broken lines
767
     */
767
     */
768
    private List createLineBreaks(int alignment, LayoutContext context) {
768
    private List<ListElement> createLineBreaks(int alignment, LayoutContext context) {
769
        // find the optimal line breaking points for each paragraph
769
        // find the optimal line breaking points for each paragraph
770
        Iterator paragraphsIterator = knuthParagraphs.iterator();
770
        Iterator<KnuthSequence> paragraphsIterator = knuthParagraphs.iterator();
771
        lineLayoutsList = new LineLayoutPossibilities[knuthParagraphs.size()];
771
        lineLayoutsList = new LineLayoutPossibilities[knuthParagraphs.size()];
772
        LineLayoutPossibilities llPoss;
772
        LineLayoutPossibilities llPoss;
773
        for (int i = 0; paragraphsIterator.hasNext(); i++) {
773
        for (int i = 0; paragraphsIterator.hasNext(); i++) {
774
            KnuthSequence seq = (KnuthSequence) paragraphsIterator.next();
774
            KnuthSequence seq = paragraphsIterator.next();
775
            if (!seq.isInlineSequence()) {
775
            if (!seq.isInlineSequence()) {
776
                // This set of line layout possibilities does not matter;
776
                // This set of line layout possibilities does not matter;
777
                // we only need an entry in lineLayoutsList.
777
                // we only need an entry in lineLayoutsList.
Lines 807-813 Link Here
807
                                        lineHeight.getValue(this), lead, follow,
807
                                        lineHeight.getValue(this), lead, follow,
808
                                        (knuthParagraphs.indexOf(currPar) == 0),
808
                                        (knuthParagraphs.indexOf(currPar) == 0),
809
                                        hyphenationLadderCount.getEnum() == EN_NO_LIMIT
809
                                        hyphenationLadderCount.getEnum() == EN_NO_LIMIT
810
                                        ? 0 : hyphenationLadderCount.getValue(),
810
                                            ? 0 : hyphenationLadderCount.getValue(),
811
                                        this);
811
                                        this);
812
        alg.setConstantLineWidth(ipd);
812
        alg.setConstantLineWidth(ipd);
813
        boolean canWrap = (wrapOption != EN_NO_WRAP);
813
        boolean canWrap = (wrapOption != EN_NO_WRAP);
Lines 873-884 Link Here
873
     * @param context the layout context
873
     * @param context the layout context
874
     * @return the newly built element list
874
     * @return the newly built element list
875
     */
875
     */
876
    private List postProcessLineBreaks(int alignment, LayoutContext context) {
876
    private List<ListElement> postProcessLineBreaks(int alignment, LayoutContext context) {
877
877
878
        List<ListElement> returnList = new LinkedList<ListElement>();
878
        List<ListElement> returnList = new LinkedList<ListElement>();
879
879
880
        int endIndex = -1;
880
        int endIndex = -1;
881
        for (int p = 0; p < knuthParagraphs.size(); p++) {
881
        for (int p = 0; p < knuthParagraphs.size(); p++) {
882
883
            KnuthSequence seq = knuthParagraphs.get(p);
884
            LineLayoutPossibilities llPoss = lineLayoutsList[p];
882
            // penalty between paragraphs
885
            // penalty between paragraphs
883
            if (p > 0) {
886
            if (p > 0) {
884
                Keep keep = getKeepTogether();
887
                Keep keep = getKeepTogether();
Lines 889-897 Link Here
889
                            context));
892
                            context));
890
            }
893
            }
891
894
892
            LineLayoutPossibilities llPoss = lineLayoutsList[p];
893
            KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(p);
894
895
            if (!seq.isInlineSequence()) {
895
            if (!seq.isInlineSequence()) {
896
                List<ListElement> targetList = new LinkedList<ListElement>();
896
                List<ListElement> targetList = new LinkedList<ListElement>();
897
                ListIterator listIter = seq.listIterator();
897
                ListIterator listIter = seq.listIterator();
Lines 918-927 Link Here
918
                for (int i = 0;
918
                for (int i = 0;
919
                        i < llPoss.getChosenLineCount();
919
                        i < llPoss.getChosenLineCount();
920
                        i++) {
920
                        i++) {
921
                    if (returnList.size() > 0
921
                    if (returnList.size() > 0 && i > 0) {
922
                            && i > 0 //if i==0 break generated above already
923
                            && i >= fobj.getOrphans()
924
                            && i <= llPoss.getChosenLineCount() - fobj.getWidows()) {
925
                        // penalty allowing a page break between lines
922
                        // penalty allowing a page break between lines
926
                        Keep keep = getKeepTogether();
923
                        Keep keep = getKeepTogether();
927
                        returnList.add(new BreakElement(
924
                        returnList.add(new BreakElement(
Lines 1149-1155 Link Here
1149
1146
1150
    /** {@inheritDoc} */
1147
    /** {@inheritDoc} */
1151
    public List getChangedKnuthElements(List oldList, int alignment) {
1148
    public List getChangedKnuthElements(List oldList, int alignment) {
1152
        List returnList = new LinkedList();
1149
        List<KnuthElement> returnList = new LinkedList<KnuthElement>();
1153
        for (int p = 0; p < knuthParagraphs.size(); p++) {
1150
        for (int p = 0; p < knuthParagraphs.size(); p++) {
1154
            LineLayoutPossibilities llPoss = lineLayoutsList[p];
1151
            LineLayoutPossibilities llPoss = lineLayoutsList[p];
1155
            //log.debug("demerits of the chosen layout: " + llPoss.getChosenDemerits());
1152
            //log.debug("demerits of the chosen layout: " + llPoss.getChosenDemerits());
Lines 1392-1398 Link Here
1392
    public void addAreas(PositionIterator parentIter,
1389
    public void addAreas(PositionIterator parentIter,
1393
                         LayoutContext context) {
1390
                         LayoutContext context) {
1394
        while (parentIter.hasNext()) {
1391
        while (parentIter.hasNext()) {
1395
            Position pos = (Position) parentIter.next();
1392
            Position pos = parentIter.next();
1396
            boolean isLastPosition = !parentIter.hasNext();
1393
            boolean isLastPosition = !parentIter.hasNext();
1397
            if (pos instanceof LineBreakPosition) {
1394
            if (pos instanceof LineBreakPosition) {
1398
                addInlineArea(context, (LineBreakPosition) pos, isLastPosition);
1395
                addInlineArea(context, (LineBreakPosition) pos, isLastPosition);
Lines 1426-1437 Link Here
1426
                (lbp.getLeafPos() < seq.size() - 1 ? textAlignment : textAlignmentLast),
1423
                (lbp.getLeafPos() < seq.size() - 1 ? textAlignment : textAlignmentLast),
1427
                lbp.difference, lbp.availableStretch, lbp.availableShrink);
1424
                lbp.difference, lbp.availableStretch, lbp.availableShrink);
1428
        if (lbp.startIndent != 0) {
1425
        if (lbp.startIndent != 0) {
1429
            lineArea.addTrait(Trait.START_INDENT, new Integer(lbp.startIndent));
1426
            lineArea.addTrait(Trait.START_INDENT, lbp.startIndent);
1430
        }
1427
        }
1431
        lineArea.setBPD(lbp.lineHeight);
1428
        lineArea.setBPD(lbp.lineHeight);
1432
        lineArea.setIPD(lbp.lineWidth);
1429
        lineArea.setIPD(lbp.lineWidth);
1433
        lineArea.addTrait(Trait.SPACE_BEFORE, new Integer(lbp.spaceBefore));
1430
        lineArea.addTrait(Trait.SPACE_BEFORE, lbp.spaceBefore);
1434
        lineArea.addTrait(Trait.SPACE_AFTER, new Integer(lbp.spaceAfter));
1431
        lineArea.addTrait(Trait.SPACE_AFTER, lbp.spaceAfter);
1435
        alignmentContext.resizeLine(lbp.lineHeight, lbp.baseline);
1432
        alignmentContext.resizeLine(lbp.lineHeight, lbp.baseline);
1436
1433
1437
        if (seq instanceof Paragraph) {
1434
        if (seq instanceof Paragraph) {

Return to bug 44328