Bug 783470 part 5: Add assertion to ensure we don't create FlexItems for abspos children. rs=mats
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 21 Jan 2014 14:52:32 -0800
changeset 164530 da32dcdc4121dd09218de7557456896ab5bb1f71
parent 164529 a3651e87da6cb526d53f40c1c200926768b88b3b
child 164531 64d44d0d790cbeb3156bd1d7e8a8f94caea01bc1
push id38733
push userdholbert@mozilla.com
push dateTue, 21 Jan 2014 22:53:45 +0000
treeherdermozilla-inbound@da32dcdc4121 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs783470
milestone29.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 783470 part 5: Add assertion to ensure we don't create FlexItems for abspos children. rs=mats
layout/generic/nsFlexContainerFrame.cpp
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1044,17 +1044,19 @@ FlexItem::FlexItem(nsIFrame* aChildFrame
     mIsFrozen(false),
     mHadMinViolation(false),
     mHadMaxViolation(false),
     mHadMeasuringReflow(false),
     mIsStretched(false),
     mIsStrut(false),
     mAlignSelf(aChildFrame->StylePosition()->mAlignSelf)
 {
-  MOZ_ASSERT(aChildFrame, "expecting a non-null child frame");
+  MOZ_ASSERT(mFrame, "expecting a non-null child frame");
+  MOZ_ASSERT(!mFrame->IsAbsolutelyPositioned(),
+             "abspos child frames should not be treated as flex items");
 
   SetFlexBaseSizeAndMainSize(aFlexBaseSize);
 
   // Assert that any "auto" margin components are set to 0.
   // (We'll resolve them later; until then, we want to treat them as 0-sized.)
 #ifdef DEBUG
   {
     const nsStyleSides& styleMargin = mFrame->StyleMargin()->mMargin;
@@ -1112,19 +1114,22 @@ FlexItem::FlexItem(nsIFrame* aChildFrame
     mIsFrozen(true),
     mHadMinViolation(false),
     mHadMaxViolation(false),
     mHadMeasuringReflow(false),
     mIsStretched(false),
     mIsStrut(true), // (this is the constructor for making struts, after all)
     mAlignSelf(NS_STYLE_ALIGN_ITEMS_FLEX_START)
 {
+  MOZ_ASSERT(mFrame, "expecting a non-null child frame");
   MOZ_ASSERT(NS_STYLE_VISIBILITY_COLLAPSE ==
              mFrame->StyleVisibility()->mVisible,
              "Should only make struts for children with 'visibility:collapse'");
+  MOZ_ASSERT(!mFrame->IsAbsolutelyPositioned(),
+             "abspos child frames should not be treated as flex items");
 }
 
 nscoord
 FlexItem::GetBaselineOffsetFromOuterCrossStart(
   AxisOrientationType aCrossAxis) const
 {
   // NOTE: Currently, 'mAscent' (taken from reflow) is an inherently vertical
   // measurement -- it's the distance from the border-top edge of this FlexItem