branches/KDE/3.5/kdelibs/khtml/rendering

Allan Sandfeld Jensen kde at carewolf.com
Tue Jun 6 01:53:40 CEST 2006


SVN commit 548594 by carewolf:

Fix regression in WC-merge. 
Tables could not be positioned using bottom anymore.
CCMAIL: khtml-devel at kde.org


 M  +18 -7     render_box.cpp  


--- branches/KDE/3.5/kdelibs/khtml/rendering/render_box.cpp #548593:548594
@@ -1642,12 +1642,22 @@
     bool topIsAuto = top.isVariable();
     bool bottomIsAuto = bottom.isVariable();
 
-    // Height is never unsolved for tables.
     if (isTable() && heightIsAuto) {
-        height.setValue(Fixed, contentHeight);
+         // Height is never unsolved for tables. "auto" means shrink to fit.
+         // Use our height instead.
+        heightValue = contentHeight;
         heightIsAuto = false;
+    } else if (!heightIsAuto) {
+        heightValue = calcContentHeight(height.width(containerHeight));
+        if (contentHeight > heightValue) {
+            if (!isTable())
+                contentHeight = heightValue;
+            else
+                heightValue = contentHeight;
+        }
     }
 
+
     if (!topIsAuto && !heightIsAuto && !bottomIsAuto) {
         /*-----------------------------------------------------------------------*\
          * If none of the three are 'auto': If both 'margin-top' and 'margin-
@@ -1660,7 +1670,6 @@
         // NOTE:  It is not necessary to solve for 'bottom' in the over constrained
         // case because the value is not used for any further calculations.
 
-        heightValue = calcContentHeight(height.width(containerHeight));
         topValue = top.width(containerHeight);
 
         const int availableSpace = containerHeight - (topValue + heightValue + bottom.width(containerHeight) + bordersPlusPadding);
@@ -1721,13 +1730,16 @@
             // RULE 1: (height is content based, solve of top)
             heightValue = contentHeight;
             topValue = availableSpace - (heightValue + bottom.width(containerHeight));
-        } else if (!topIsAuto && heightIsAuto && bottomIsAuto) {
+        } 
+        else if (!topIsAuto && heightIsAuto && !bottomIsAuto) {
+            // RULE 2: (shouldn't happen)
+        }
+        else if (!topIsAuto && heightIsAuto && bottomIsAuto) {
             // RULE 3: (height is content based, no need solve of bottom)
+            heightValue = contentHeight;
             topValue = top.width(containerHeight);
-            heightValue = contentHeight;
         } else if (topIsAuto && !heightIsAuto && !bottomIsAuto) {
             // RULE 4: (solve of top)
-            heightValue = calcContentHeight(height.width(containerHeight));
             topValue = availableSpace - (heightValue + bottom.width(containerHeight));
         } else if (!topIsAuto && heightIsAuto && !bottomIsAuto) {
             // RULE 5: (solve of height)
@@ -1735,7 +1747,6 @@
             heightValue = kMax(0, availableSpace - (topValue + bottom.width(containerHeight)));
         } else if (!topIsAuto && !heightIsAuto && bottomIsAuto) {
             // RULE 6: (no need solve of bottom)
-            heightValue = calcContentHeight(height.width(containerHeight));
             topValue = top.width(containerHeight);
         }
     }


More information about the Khtml-devel mailing list