@@ 119-143 (lines=25) @@ | ||
116 | } |
|
117 | ||
118 | // Collapse our first child's margin, if there is no border or padding |
|
119 | if ($style->get_border_top_width() == 0 && $style->length_in_pt($style->padding_top) == 0) { |
|
120 | $f = $this->_frame->get_first_child(); |
|
121 | if ( $f && !$f->is_block() && !$f->is_table() ) { |
|
122 | while ( $f = $f->get_next_sibling() ) { |
|
123 | if ( $f->is_block() || $f->is_table() ) { |
|
124 | break; |
|
125 | } |
|
126 | ||
127 | if ( !$f->get_first_child() ) { |
|
128 | $f = null; |
|
129 | break; |
|
130 | } |
|
131 | } |
|
132 | } |
|
133 | ||
134 | // Margin are collapsed only between block-level boxes |
|
135 | if ($f) { |
|
136 | $f_style = $f->get_style(); |
|
137 | $f_t = (float)$f_style->length_in_pt($f_style->margin_top, $cb["h"]); |
|
138 | ||
139 | $t = $this->_get_collapsed_margin_length($t, $f_t); |
|
140 | $style->margin_top = $t."pt"; |
|
141 | $f_style->margin_top = "0pt"; |
|
142 | } |
|
143 | } |
|
144 | ||
145 | // Collapse our last child's margin, if there is no border or padding |
|
146 | if ($style->get_border_bottom_width() == 0 && $style->length_in_pt($style->padding_bottom) == 0) { |
|
@@ 146-170 (lines=25) @@ | ||
143 | } |
|
144 | ||
145 | // Collapse our last child's margin, if there is no border or padding |
|
146 | if ($style->get_border_bottom_width() == 0 && $style->length_in_pt($style->padding_bottom) == 0) { |
|
147 | $l = $this->_frame->get_last_child(); |
|
148 | if ( $l && !$l->is_block() && !$l->is_table() ) { |
|
149 | while ( $l = $l->get_prev_sibling() ) { |
|
150 | if ( $l->is_block() || $l->is_table() ) { |
|
151 | break; |
|
152 | } |
|
153 | ||
154 | if ( !$l->get_last_child() ) { |
|
155 | $l = null; |
|
156 | break; |
|
157 | } |
|
158 | } |
|
159 | } |
|
160 | ||
161 | // Margin are collapsed only between block-level boxes |
|
162 | if ($l) { |
|
163 | $l_style = $l->get_style(); |
|
164 | $l_b = (float)$l_style->length_in_pt($l_style->margin_bottom, $cb["h"]); |
|
165 | ||
166 | $b = $this->_get_collapsed_margin_length($b, $l_b); |
|
167 | $style->margin_bottom = $b."pt"; |
|
168 | $l_style->margin_bottom = "0pt"; |
|
169 | } |
|
170 | } |
|
171 | } |
|
172 | ||
173 | /** |