Browse files

If a table had a margin-left and a margin-right set to auto with a wi…

…dth of at least 100%, it was badly reflowing

git-svn-id: http://dompdf.googlecode.com/svn/trunk@465 8e70de24-3a84-11de-b438-597f59cd7555
  • Loading branch information...
1 parent f41cf05 commit 1a601c821e835224fcbc1bce5c068beaaffd9898 @PhenX PhenX committed Jan 30, 2012
Showing with 15 additions and 10 deletions.
  1. +15 −10 dompdf/include/table_frame_reflower.cls.php
View
25 dompdf/include/table_frame_reflower.cls.php
@@ -414,21 +414,27 @@ function reflow(Frame_Decorator $block = null) {
$diff = $cb["w"] - $width;
- if ( $left === "auto" && $right === "auto" && $diff > 0 ) {
- $left = $right = $diff / 2;
+ if ( $left === "auto" && $right === "auto" ) {
+ if ( $diff < 0 ) {
+ $left = 0;
+ $right = $diff;
+ }
+ else {
+ $left = $right = $diff / 2;
+ }
+
$style->margin_left = "$left pt";
$style->margin_right = "$right pt";
} else {
- if ( $left === "auto" ) {
- $left = $style->length_in_pt($cb["w"] - $right - $width, $cb["w"]);
- }
- if ( $right === "auto" ) {
- $left = $style->length_in_pt($left, $cb["w"]);
- }
+ if ( $left === "auto" ) {
+ $left = $style->length_in_pt($cb["w"] - $right - $width, $cb["w"]);
+ }
+ if ( $right === "auto" ) {
+ $left = $style->length_in_pt($left, $cb["w"]);
+ }
}
-
list($x, $y) = $frame->get_position();
// Determine the content edge
@@ -443,7 +449,6 @@ function reflow(Frame_Decorator $block = null) {
else
$h = null;
-
$cellmap = $frame->get_cellmap();
$col =& $cellmap->get_column(0);
$col["x"] = $content_x;

0 comments on commit 1a601c8

Please sign in to comment.