Fix for 3923255, specified percentage heights of divs with overflow auto inside...
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Dec 2004 01:31:42 +0000 (01:31 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Dec 2004 01:31:42 +0000 (01:31 +0000)
        Reviewed by kocienda

        * khtml/rendering/render_box.cpp:
        (RenderBox::calcPercentageHeight):
        * khtml/rendering/render_table.cpp:
        (RenderTableSection::layoutRows):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8250 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/rendering/render_box.cpp
WebCore/khtml/rendering/render_table.cpp

index 6590754edb672bc3b90c98e1b393ea2a8aef532f..a380714b853ee7561414f6ba8ea475c882dd82e3 100644 (file)
@@ -1,3 +1,14 @@
+2004-12-17  David Hyatt  <hyatt@apple.com>
+
+       Fix for 3923255, specified percentage heights of divs with overflow auto inside tables not honored.
+       
+        Reviewed by kocienda
+
+        * khtml/rendering/render_box.cpp:
+        (RenderBox::calcPercentageHeight):
+        * khtml/rendering/render_table.cpp:
+        (RenderTableSection::layoutRows):
+
 2004-12-17  David Harrison  <harrison@apple.com>
 
         Reviewed by Ken Kocienda.
index cfb573b70c63297e09d1166d395c0c382fb5e425..f864511327fd3b1a5b992c3ee2890023247d3975 100644 (file)
@@ -1036,8 +1036,20 @@ int RenderBox::calcPercentageHeight(const Length& height)
     // be a percentage of the cell's current content height.
     if (cb->isTableCell()) {
         result = cb->overrideSize();
-        if (result == -1)
+        if (result == -1) {
+            // Normally we would let the cell size intrinsically, but scrolling overflow has to be
+            // treated differently, since WinIE lets scrolled overflow regions shrink as needed.
+            // While we can't get all cases right, we can at least detect when the cell has a specified
+            // height or when the table has a specified height.  In these cases we want to initially have
+            // no size and allow the flexing of the table or the cell to its specified height to cause us
+            // to grow to fill the space.  This could end up being wrong in some cases, but it is
+            // preferable to the alternative (sizing intrinsically and making the row end up too big).
+            RenderTableCell* cell = static_cast<RenderTableCell*>(cb);
+            if (scrollsOverflow() && 
+                (!cell->style()->height().isVariable() || !cell->table()->style()->height().isVariable()))
+                return 0;
             return -1;
+        }
         includeBorderPadding = true;
     }
 
index ae07eee7f7479ccf1a16f915afd594bae602f129..08df6f38a974b0b7d466426882ee315efcec847e 100644 (file)
@@ -1254,7 +1254,7 @@ int RenderTableSection::layoutRows( int toAdd )
                 (!table()->style()->height().isVariable() && rHeight != cell->height());
             RenderObject* o = cell->firstChild();
             while (o) {
-                if (!o->isText() && o->style()->height().isPercent() && (o->isReplaced() || flexAllChildren)) {
+                if (!o->isText() && o->style()->height().isPercent() && (o->isReplaced() || o->scrollsOverflow() || flexAllChildren)) {
                     // Tables with no sections do not flex.
                     if (!o->isTable() || static_cast<RenderTable*>(o)->hasSections()) {
                         o->setNeedsLayout(true, false);