Bug 1222783 - Make nsHTMLFramesetFrame::Reflow set firstTime based on what firstTime means. r=roc approval-mozilla-beta=lizzard
authorL. David Baron <dbaron@dbaron.org>
Tue, 10 Nov 2015 13:42:29 +0800
changeset 296732 7947f1e4ca76
parent 296731 844ff2b4f267
child 296733 d720ce07c464
push id5313
push userdbaron@mozilla.com
push date2015-11-16 15:22 +0000
treeherdermozilla-beta@7947f1e4ca76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1222783
milestone43.0
Bug 1222783 - Make nsHTMLFramesetFrame::Reflow set firstTime based on what firstTime means. r=roc approval-mozilla-beta=lizzard I confirmed locally that the new crashtest crashes in the harness without the patch, and passes in the harness with the patch.
layout/generic/crashtests/1222783.xhtml
layout/generic/crashtests/crashtests.list
layout/generic/nsFrameSetFrame.cpp
new file mode 100644
--- /dev/null
+++ b/layout/generic/crashtests/1222783.xhtml
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE html>
+<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
+<title>Test, bug 1222783</title>
+<body>
+
+
+<div id="container" style="width: 400px">
+  <div id="float1" style="float: left; height: 50px; width: 50px"></div>
+  <div id="float2" style="float: left; clear: left; height: 50px; width: 200px"></div>
+
+  <frameset cols="50%,50%">
+    <frame></frame>
+    <frame></frame>
+  </frameset>
+</div>
+
+</body>
+</html>
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -583,8 +583,9 @@ asserts(0-3) load 1134667.html
 load 1146103.html
 load 1146107.html
 load 1146114.html
 load 1156222.html
 load 1157011.html
 load 1169420-1.html
 load 1169420-2.html
 load 1183431.html
+load 1222783.xhtml
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -826,17 +826,23 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
   // Always get the size so that the caller knows how big we are
   GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
 
   nscoord width  = (aDesiredSize.Width() <= aReflowState.AvailableWidth())
     ? aDesiredSize.Width() : aReflowState.AvailableWidth();
   nscoord height = (aDesiredSize.Height() <= aReflowState.AvailableHeight())
     ? aDesiredSize.Height() : aReflowState.AvailableHeight();
 
-  bool firstTime = (GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
+  // We might be reflowed more than once with NS_FRAME_FIRST_REFLOW;
+  // that's allowed.  (Though it will only happen for misuse of frameset
+  // that includes it within other content.)  So measure firstTime by
+  // what we care about, which is whether we've processed the data we
+  // process below if firstTime is true.
+  MOZ_ASSERT(!mChildFrameborder == !mChildBorderColors);
+  bool firstTime = !!mChildFrameborder;
 
   // subtract out the width of all of the potential borders. There are
   // only borders between <frame>s. There are none on the edges (e.g the
   // leftmost <frame> has no left border).
   int32_t borderWidth = GetBorderWidth(aPresContext, true);
 
   width  -= (mNumCols - 1) * borderWidth;
   if (width < 0) width = 0;