bug 675490 - push nonplaced tfoots and mark them as nonrepeating r=bz
authorBernd <bmlk@gmx.de>
Sat, 13 Aug 2011 18:37:43 +0200
changeset 74380 6f4b90a6c2928ce049070a204acbdd6096a6eeff
parent 74379 bddfa5c83a6ea7bb1b2a29937db78975772aa0c2
child 75260 080fece621e42493e2cdaf17400e0486ef9df346
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersbz
bugs675490
milestone8.0a1
bug 675490 - push nonplaced tfoots and mark them as nonrepeating r=bz
layout/reftests/pagination/reftest.list
layout/reftests/pagination/table-tfoot-thead-1-ref.html
layout/reftests/pagination/table-tfoot-thead-1.html
layout/tables/nsTableFrame.cpp
--- a/layout/reftests/pagination/reftest.list
+++ b/layout/reftests/pagination/reftest.list
@@ -39,16 +39,17 @@ fails == float-continuations-000.html fl
 == table-page-break-after-always-1.html table-page-break-before-auto-2-ref.html
 == table-page-break-after-left-1.html table-page-break-before-auto-2-ref.html
 == table-page-break-after-right-1.html table-page-break-before-auto-2-ref.html
 == rowgroup-page-break-after-always-1.html table-page-break-before-auto-2-ref.html
 == row-page-break-after-always-1.html table-page-break-before-auto-2-ref.html
 == row-page-break-after-always-2.html table-page-break-before-auto-2-ref.html
 == rowgroup-thead-page-break-after-always-1.html table-page-break-before-auto-3-ref.html 
 == rowgroup-tfoot-page-break-after-always-1.html table-page-break-before-auto-3-ref.html
+== table-tfoot-thead-1.html table-tfoot-thead-1-ref.html
 == table-caption-splitrowgroup-1.html table-caption-splitrowgroup-1-ref.html
 == table-caption-splitaftercaption-1.html table-caption-splitaftercaption-1-ref.html
 == table-caption-splitaftercaption-2.html table-caption-splitaftercaption-2-ref.html
 == table-caption-splitaftercaption-3.html table-caption-splitaftercaption-3-ref.html
 == table-caption-splitaftercaption-4.html table-caption-splitaftercaption-4-ref.html
 == table-caption-splitaftercaption-5.html table-caption-splitaftercaption-5-ref.html
 == table-caption-splitaftercaption-6.html table-caption-splitaftercaption-6-ref.html
 == table-caption-splitaftercaption-7.html table-caption-splitaftercaption-7-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/table-tfoot-thead-1-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+   "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US" class="reftest-print">
+<head>
+<style type="text/css">
+div.filler {height:5px; width: 50px; border:thin solid blue;}
+div.spacer { height: 0px; width: 0px; padding: 5px;border:thin solid green;}
+tfoot div.spacer {border-color:orange;
+height: 10px}
+tbody div.spacer{border-width: 4px}
+thead div.spacer{height: 140px}
+</style>
+</head>
+<body>
+<div class="filler"></div>
+<table cellspacing="1" cellpadding="0">
+<thead><tr><td><div class="spacer"></div></td></tr></thead>
+<tbody><tr><td><div class="spacer"></div></td></tr></tbody>
+</table>
+
+<table cellspacing="1" cellpadding="0">
+<tbody> <tr><td><div class="spacer"></div></td></tr></tbody>
+<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
+</table>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/table-tfoot-thead-1.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+    "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US" class="reftest-print">
+<head>
+<style type="text/css">
+div.filler {height:5px; width: 50px; border:thin solid blue;}
+div.spacer { height: 0px; width: 0px; padding: 5px;border:thin solid green;}
+tfoot div.spacer {border-color:orange;
+height: 10px}
+tbody div.spacer{border-width: 4px}
+thead div.spacer{height: 140px}
+</style>
+</head>
+<body>
+<div class="filler"></div>
+<table cellspacing="1" cellpadding="0">
+<tfoot><tr><td><div class="spacer"></div></td></tr></tfoot>
+<tbody>
+ <tr><td><div class="spacer"></div></td></tr>
+ <tr><td><div class="spacer"></div></td></tr>
+</tbody>
+<thead><tr><td><div class="spacer"></div></td></tr></thead>
+</table>
+</body>
+</html>
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -2729,20 +2729,23 @@ nsTableFrame::ReflowChildren(nsTableRefl
     // Get the frame state bits
     // See if we should only reflow the dirty child frames
     if (reflowAllKids ||
         NS_SUBTREE_DIRTY(kidFrame) ||
         (aReflowState.reflowState.mFlags.mSpecialHeightReflow &&
          (isPaginated || (kidFrame->GetStateBits() &
                           NS_FRAME_CONTAINS_RELATIVE_HEIGHT)))) {
       if (pageBreak) {
-        PushChildren(rowGroups, childX);
         if (allowRepeatedFooter) {
           PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
         }
+        else if (tfoot && tfoot->IsRepeatable()) {
+          tfoot->SetRepeatable(PR_FALSE);
+        }
+        PushChildren(rowGroups, childX);
         aStatus = NS_FRAME_NOT_COMPLETE;
         break;
       }
 
       nsSize kidAvailSize(aReflowState.availSize);
       allowRepeatedFooter = PR_FALSE;
       if (isPaginated && (NS_UNCONSTRAINEDSIZE != kidAvailSize.height)) {
         nsTableRowGroupFrame* kidRG =
@@ -2811,28 +2814,34 @@ nsTableFrame::ReflowChildren(nsTableRefl
           if (childX+1 < rowGroups.Length()) {
             nsIFrame* nextRowGroupFrame = rowGroups[childX + 1];
             if (nextRowGroupFrame) {
               PlaceChild(aReflowState, kidFrame, desiredSize, oldKidRect,
                          oldKidVisualOverflow);
               if (allowRepeatedFooter) {
                 PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
               }
+              else if (tfoot && tfoot->IsRepeatable()) {
+                tfoot->SetRepeatable(PR_FALSE);
+              }
               aStatus = NS_FRAME_NOT_COMPLETE;
               PushChildren(rowGroups, childX + 1);
               aLastChildReflowed = kidFrame;
               break;
             }
           }
         }
         else { // we are not on top, push this rowgroup onto the next page
           if (prevKidFrame) { // we had a rowgroup before so push this
             if (allowRepeatedFooter) {
               PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
             }
+            else if (tfoot && tfoot->IsRepeatable()) {
+              tfoot->SetRepeatable(PR_FALSE);
+            }
             aStatus = NS_FRAME_NOT_COMPLETE;
             PushChildren(rowGroups, childX);
             aLastChildReflowed = prevKidFrame;
             break;
           }
           else { // we can't push so lets make clear how much space we need
             PlaceChild(aReflowState, kidFrame, desiredSize, oldKidRect,
                                      oldKidVisualOverflow);
@@ -2887,23 +2896,26 @@ nsTableFrame::ReflowChildren(nsTableRefl
         }
 
         // Put the nextinflow so that it will get pushed
         rowGroups.InsertElementAt(childX + 1,
                            static_cast <nsTableRowGroupFrame*>(kidNextInFlow));
 
         // We've used up all of our available space so push the remaining
         // children to the next-in-flow
+        if (allowRepeatedFooter) {
+          PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
+        }
+        else if (tfoot && tfoot->IsRepeatable()) {
+          tfoot->SetRepeatable(PR_FALSE);
+        }
         nsIFrame* nextSibling = kidFrame->GetNextSibling();
         if (nsnull != nextSibling) {
           PushChildren(rowGroups, childX + 1);
         }
-        if (allowRepeatedFooter) {
-          PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
-        }
         break;
       }
     }
     else { // it isn't being reflowed
       aReflowState.y += cellSpacingY;
       nsRect kidRect = kidFrame->GetRect();
       if (kidRect.y != aReflowState.y) {
         // invalidate the old position