fix border/padding and availableHeight calculations at page/column breaks, b=368079 r+sr=roc a=roc
authorfantasai.cvs@inkedblade.net
Tue, 15 Jan 2008 19:54:46 -0800
changeset 10321 4781e99003780da81774125b124c53d8c3fc26c3
parent 10320 b628433bd880675967933707bee543aeab8e5ced
child 10322 c4b347794761f6ebc5fbb87849de21a5ba70c62a
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs368079
milestone1.9b3pre
fix border/padding and availableHeight calculations at page/column breaks, b=368079 r+sr=roc a=roc
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockReflowState.cpp
layout/reftests/pagination/border-breaking-000-cols.ref.xhtml
layout/reftests/pagination/border-breaking-000-cols.xhtml
layout/reftests/pagination/border-breaking-001-cols.ref.xhtml
layout/reftests/pagination/border-breaking-001-cols.xhtml
layout/reftests/pagination/border-breaking-002-cols.ref.xhtml
layout/reftests/pagination/border-breaking-002-cols.xhtml
layout/reftests/pagination/border-breaking-003-cols.ref.xhtml
layout/reftests/pagination/border-breaking-003-cols.xhtml
layout/reftests/pagination/border-breaking-004-cols.xhtml
layout/reftests/pagination/reftest.list
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1343,17 +1343,17 @@ nsBlockFrame::ComputeFinalSize(const nsH
       // on its own on the last-in-flow, even if we ran out of height
       // here. We need GetSkipSides to check whether we ran out of content
       // height in the current frame, not whether it's last-in-flow.
     }
 
     // Don't carry out a bottom margin when our height is fixed.
     aMetrics.mCarriedOutBottomMargin.Zero();
   }
-  else {
+  else if (NS_FRAME_IS_COMPLETE(aState.mReflowStatus)) {
     nscoord autoHeight = aState.mY + nonCarriedOutVerticalMargin;
 
     // Shrink wrap our height around our contents.
     if (aState.GetFlag(BRS_ISBOTTOMMARGINROOT)) {
       // When we are a bottom-margin root make sure that our last
       // childs bottom margin is fully applied.
       // Apply the margin only if there's space for it.
       if (autoHeight < aState.mReflowState.availableHeight)
@@ -1378,16 +1378,19 @@ nsBlockFrame::ComputeFinalSize(const nsH
     if (autoHeight != oldAutoHeight) {
       // Our min-height or max-height made our height change.  Don't carry out
       // our kids' bottom margins.
       aMetrics.mCarriedOutBottomMargin.Zero();
     }
     autoHeight += borderPadding.top + borderPadding.bottom;
     aMetrics.height = autoHeight;
   }
+  else {
+    aMetrics.height = aReflowState.availableHeight;
+  }
 
   if (IS_TRUE_OVERFLOW_CONTAINER(this) &&
       NS_FRAME_IS_NOT_COMPLETE(aState.mReflowStatus)) {
     // Overflow containers can only be overflow complete.
     // Note that auto height overflow containers have no normal children
     NS_ASSERTION(aMetrics.height == 0, "overflow containers must be zero-height");
     NS_FRAME_SET_OVERFLOW_INCOMPLETE(aState.mReflowStatus);
   }
--- a/layout/generic/nsBlockReflowState.cpp
+++ b/layout/generic/nsBlockReflowState.cpp
@@ -198,17 +198,17 @@ nsBlockReflowState::ComputeBlockAvailSpa
 {
 #ifdef REALLY_NOISY_REFLOW
   printf("CBAS frame=%p has float count %d\n", aFrame, mBand.GetFloatCount());
   mBand.List();
 #endif
   aResult.y = mY;
   aResult.height = GetFlag(BRS_UNCONSTRAINEDHEIGHT)
     ? NS_UNCONSTRAINEDSIZE
-    : PR_MAX(0, mBottomEdge - mY);
+    : PR_MAX(0, mReflowState.availableHeight - mY);
   // mY might be greater than mBottomEdge if the block's top margin pushes
   // it off the page/column. Negative available height can confuse other code
   // and is nonsense in principle.
 
   const nsMargin& borderPadding = BorderPadding();
 
   // text controls are not splittable
   // XXXldb Why not just set the frame state bit?
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/border-breaking-000-cols.ref.xhtml
@@ -0,0 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>Pagination with Borders</title>
+  <style type="text/css">
+    body {
+      height: 200px;
+      width: 300px;
+      border: solid silver;
+      border-style: none solid;
+      background: green;
+    }
+  </style>
+ </head>
+ <body>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/border-breaking-000-cols.xhtml
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>Pagination with Borders</title>
+  <style type="text/css">
+    .container {
+      padding-bottom: 10px;
+      border-bottom: 10px solid transparent;
+    }
+
+    .box {
+      background: green;
+    }
+    p {
+      color: green;
+      font-size: 150px;
+      line-height: 1;
+      margin: 0;
+    }
+    p + p {
+      height: 200px;
+    }
+
+    body {
+      height: 200px;
+      width: 300px;
+      -moz-column-width: 150px;
+      -moz-column-gap: 0;
+      border: solid silver;
+      border-style: none solid;
+      background: red;
+    }
+  </style>
+ </head>
+ <body>
+  <div class="container">
+    <div class="box">
+      <p>.</p>
+      <p>.</p>
+    </div>
+  </div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/border-breaking-001-cols.ref.xhtml
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>Pagination with Borders</title>
+  <style type="text/css">
+    .container {
+      height: 500px;
+      background: lime;
+      border: 10px green;
+      border-style: none solid;
+    }
+    .long {
+      background: aqua;
+      width: 40px;
+      height: 500px;
+    }
+
+    body {
+      height: 200px;
+      width: 300px;
+      -moz-column-width: 100px;
+      -moz-column-gap: 0;
+      border: solid silver;
+      border-style: none solid;
+      background: yellow;
+    }
+  </style>
+ </head>
+ <body>
+  <div class="container">
+    <div class="long">
+    </div>
+  </div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/border-breaking-001-cols.xhtml
@@ -0,0 +1,74 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>Pagination with Borders</title>
+  <style type="text/css">
+    .container {
+      height: 0;
+      padding-bottom: 10px;
+      border-bottom: 10px solid transparent;
+      margin-bottom: -20px;
+    }
+    .overflow {
+      position: relative;
+      background: aqua;
+      height: 500px;
+      width: 40px;
+      border: 10px solid red;
+      border-style: none solid;
+    }
+    body > .container .overflow {
+      border-right: none;
+    }
+    .abs {
+      position: relative;
+    }
+    .abs .container {
+      position: absolute;
+      width: 100%;
+      margin-left: 50px;
+    }
+    .abs .overflow {
+      background: lime;
+      border-left: none;
+    }
+    .long {
+      position: relative;
+      height: 500px;
+      border: solid 10px green;
+      border-style: none solid;
+    }
+
+    .block {
+      background: yellow;
+      height: 100px;
+    }
+
+    body {
+      height: 200px;
+      width: 300px;
+      -moz-column-width: 100px;
+      -moz-column-gap: 0;
+      border: solid silver;
+      border-style: none solid;
+      background: red;
+    }
+  </style>
+ </head>
+ <body>
+  <div class="abs">
+    <div class="container">
+      <div class="overflow">
+      </div>
+    </div>
+  </div>
+  <div class="container">
+    <div class="overflow">
+    </div>
+  </div>
+  <div class="long">
+  </div>
+  <div class="block">
+  </div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/border-breaking-002-cols.ref.xhtml
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>Pagination with Borders</title>
+  <style type="text/css">
+    .container1 {
+      height: 190px;
+      border-top: 10px solid blue;
+    }
+    .container2 {
+      border-top: solid 10px aqua;
+    }
+
+    .multicol {
+      height: 200px;
+      width: 300px;
+      -moz-column-width: 150px;
+      -moz-column-gap: 0;
+      border: solid silver;
+    }
+  </style>
+ </head>
+ <body>
+  There must be a continuous 10px line at the top
+  of the gray box, the left half blue and the right
+  half aqua.
+  <div class="multicol">
+    <div class="container1">
+    </div>
+    <div class="container2">
+    </div>
+  </div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/border-breaking-002-cols.xhtml
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>Pagination with Borders</title>
+  <style type="text/css">
+    .container {
+      height: 0;
+      border-bottom: 10px solid blue;
+    }
+    .overflow {
+      height: 195px;
+      border-bottom: solid 10px aqua;
+    }
+
+    .multicol {
+      height: 200px;
+      width: 300px;
+      -moz-column-width: 150px;
+      -moz-column-gap: 0;
+      border: solid silver;
+    }
+  </style>
+ </head>
+ <body>
+  There must be a continuous 10px line at the top
+  of the gray box, the left half blue and the right
+  half aqua.
+  <div class="multicol">
+    <div class="container">
+      <div class="overflow">
+      </div>
+    </div>
+  </div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/border-breaking-003-cols.ref.xhtml
@@ -0,0 +1,31 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>Pagination with Borders</title>
+  <style type="text/css">
+    .container1 {
+      border-top: 10px solid blue;
+    }
+    .container2 {
+      border-top: solid 10px aqua;
+    }
+
+    .multicol {
+      height: 200px;
+      width: 300px;
+      border: solid silver;
+    }
+  </style>
+ </head>
+ <body>
+  There must be two continuous 10px lines at the top
+  of the gray box, the top one blue and the bottom one
+  aqua.
+  <div class="multicol">
+    <div class="container1">
+    </div>
+    <div class="container2">
+    </div>
+  </div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/border-breaking-003-cols.xhtml
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>Pagination with Borders</title>
+  <style type="text/css">
+    .container {
+      border-bottom: 10px solid aqua;
+    }
+    .overflow {
+      height: 175px;
+      border-bottom: solid 10px blue;
+    }
+    .rainbow {
+      border-top: 10px solid blue;
+      border-bottom: 10px solid aqua;
+    }
+
+    .multicol {
+      height: 200px;
+      width: 300px;
+      -moz-column-width: 150px;
+      -moz-column-gap: 0;
+      border: solid silver;
+    }
+  </style>
+ </head>
+ <body>
+  There must be two continuous 10px lines at the top
+  of the gray box, the top one blue and the bottom one
+  aqua.
+  <div class="multicol">
+    <div class="rainbow"></div>
+    <div class="container">
+      <div class="overflow">
+      </div>
+    </div>
+  </div>
+ </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/pagination/border-breaking-004-cols.xhtml
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <title>Pagination with Borders</title>
+  <style type="text/css">
+    .container {
+      border-bottom: 10px solid aqua;
+    }
+    .overflow {
+      height: 185px;
+      border-top: solid 10px blue;
+    }
+
+    .multicol {
+      height: 200px;
+      width: 300px;
+      -moz-column-width: 150px;
+      -moz-column-gap: 0;
+      border: solid silver;
+    }
+  </style>
+ </head>
+ <body>
+  There must be a continuous 10px line at the top
+  of the gray box, the left half blue and the right
+  half aqua.
+  <div class="multicol">
+    <div class="container">
+      <div class="overflow">
+      </div>
+    </div>
+  </div>
+ </body>
+</html>
--- a/layout/reftests/pagination/reftest.list
+++ b/layout/reftests/pagination/reftest.list
@@ -1,7 +1,12 @@
 # Sanity check
 == blank.html blank.html
 
 # 
 == abspos-overflow-01.xhtml abspos-overflow-01.ref.xhtml
 == abspos-overflow-01-cols.xhtml abspos-overflow-01-cols.ref.xhtml
 == dynamic-abspos-overflow-01-cols.xhtml dynamic-abspos-overflow-01-cols.ref.xhtml
+== border-breaking-000-cols.xhtml border-breaking-000-cols.ref.xhtml
+== border-breaking-001-cols.xhtml border-breaking-001-cols.ref.xhtml
+== border-breaking-002-cols.xhtml border-breaking-002-cols.ref.xhtml
+== border-breaking-003-cols.xhtml border-breaking-003-cols.ref.xhtml
+== border-breaking-004-cols.xhtml border-breaking-002-cols.ref.xhtml