Bug 775350 - Update the overflow areas of the lines containing floats based on the overflow areas of the floats in the containing block; r=dbaron
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 06 Nov 2012 12:11:50 -0500
changeset 112621 539bb6ca633ab494d229dcc3c33ea88350bb8bbe
parent 112620 3b52d2f7382990ad6ec2545d099934e124edffb6
child 112622 c25c93664add2f141ab81c04911b6d1aa13cf351
push id23833
push useremorley@mozilla.com
push dateThu, 08 Nov 2012 10:20:57 +0000
treeherdermozilla-central@e0d7b394462b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs775350
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 775350 - Update the overflow areas of the lines containing floats based on the overflow areas of the floats in the containing block; r=dbaron
layout/generic/nsBlockFrame.cpp
layout/reftests/floats/775350-1-ref.html
layout/reftests/floats/775350-1.html
layout/reftests/floats/reftest.list
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1496,16 +1496,23 @@ nsBlockFrame::UpdateOverflow()
     nsOverflowAreas lineAreas;
 
     int32_t n = line->GetChildCount();
     for (nsIFrame* lineFrame = line->mFirstChild;
          n > 0; lineFrame = lineFrame->GetNextSibling(), --n) {
       ConsiderChildOverflow(lineAreas, lineFrame);
     }
 
+    // Consider the overflow areas of the floats attached to the line as well
+    if (line->HasFloats()) {
+      for (nsFloatCache* fc = line->GetFirstFloat(); fc; fc = fc->Next()) {
+        ConsiderChildOverflow(lineAreas, fc->mFloat);
+      }
+    }
+
     line->SetOverflowAreas(lineAreas);
   }
 
   return nsBlockFrameSuper::UpdateOverflow();
 }
 
 void
 nsBlockFrame::MarkLineDirty(line_iterator aLine, const nsLineList* aLineList)
new file mode 100644
--- /dev/null
+++ b/layout/reftests/floats/775350-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<body>
+  <div id="top"></div>
+  <div>
+    <div style="float: left; position: relative;">
+      <div id="inner" style="display: block; top: 100px; width: 100px; height: 100px; background: pink; position:absolute;"></div>
+    </div>
+  </div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/floats/775350-1.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait">
+<head>
+  <script>
+
+function handleLoad() {
+  setTimeout(f1, 0);
+}
+
+function f1() {
+  document.getElementById("inner").style.top = "100px";
+  setTimeout(f2, 0);
+}
+
+function f2() {
+  document.getElementById("top").style.display = "block";
+  document.documentElement.removeAttribute("class");
+}
+
+  </script>
+</head>
+<body onload="handleLoad()">
+  <div id="top" style="display: none;"></div>
+  <div>
+    <div style="float: left; position: relative;">
+      <div id="inner" style="display: block; top: 110px; width: 100px; height: 100px; background: pink; position:absolute;"></div>
+    </div>
+  </div>
+</body>
+</html>
--- a/layout/reftests/floats/reftest.list
+++ b/layout/reftests/floats/reftest.list
@@ -10,8 +10,9 @@ fails == other-float-outside-rule-7-righ
 fails == zero-height-float.html zero-height-float-ref.html # bug 81710
 fails == 345369-1.html 345369-1-ref.html
 fails == 345369-2.html 345369-2-ref.html
 == 345369-3.html 345369-3-ref.html
 == 345369-4.html 345369-4-ref.html
 == 345369-5.html 345369-5-ref.html
 == 429974-1.html 429974-1-ref.html
 == 546048-1.html 546048-1-ref.html
+== 775350-1.html 775350-1-ref.html