Bug 848539 part 2: Back out de6a5c46a8ff, bug 666041 part 8 (special-handling for min-width:auto as min-content, for flex items). r=dbaron

This commit is contained in:
Daniel Holbert 2013-03-27 23:33:19 -07:00
parent 76e67c524b
commit 1ccacc57ca
2 changed files with 5 additions and 28 deletions

View File

@ -2505,22 +2505,10 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
nscoord aContainingBlockHeight,
const nsHTMLReflowState* aContainingBlockRS)
{
#ifdef MOZ_FLEXBOX
nsFlexContainerFrame* flexContainerFrame = GetFlexContainer(frame);
#endif // MOZ_FLEXBOX
// Handle "min-width: auto"
if (eStyleUnit_Auto == mStylePosition->mMinWidth.GetUnit()) {
// XXXdholbert For flex items, this needs to behave like -moz-min-content.
mComputedMinWidth = 0;
#ifdef MOZ_FLEXBOX
if (flexContainerFrame && flexContainerFrame->IsHorizontal()) {
mComputedMinWidth =
ComputeWidthValue(aContainingBlockWidth,
mStylePosition->mBoxSizing,
nsStyleCoord(NS_STYLE_WIDTH_MIN_CONTENT,
eStyleUnit_Enumerated));
}
#endif // MOZ_FLEXBOX
} else {
mComputedMinWidth = ComputeWidthValue(aContainingBlockWidth,
mStylePosition->mBoxSizing,

View File

@ -22,7 +22,6 @@
#include "nsDOMCSSRect.h"
#include "nsDOMCSSRGBColor.h"
#include "nsDOMCSSValueList.h"
#include "nsFlexContainerFrame.h"
#include "nsGkAtoms.h"
#include "nsHTMLReflowState.h"
#include "nsStyleUtil.h"
@ -3433,22 +3432,12 @@ nsComputedDOMStyle::DoGetMinWidth()
nsStyleCoord minWidth = StylePosition()->mMinWidth;
if (eStyleUnit_Auto == minWidth.GetUnit()) {
// "min-width: auto" means "0", unless we're a flex item in a horizontal
// flex container, in which case it means "min-content"
// In non-flexbox contexts, "min-width: auto" means "min-width: 0".
// XXXdholbert For flex items, we should set |minWidth| to the
// -moz-min-content keyword, instead of 0.
minWidth.SetCoordValue(0);
#ifdef MOZ_FLEXBOX
if (mOuterFrame && mOuterFrame->IsFlexItem()) {
nsIFrame* flexContainer = mOuterFrame->GetParent();
MOZ_ASSERT(flexContainer &&
flexContainer->GetType() == nsGkAtoms::flexContainerFrame,
"IsFlexItem() lied...?");
if (static_cast<nsFlexContainerFrame*>(flexContainer)->IsHorizontal()) {
minWidth.SetIntValue(NS_STYLE_WIDTH_MIN_CONTENT, eStyleUnit_Enumerated);
}
}
#endif // MOZ_FLEXBOX
}
SetValueToCoord(val, minWidth, true,
&nsComputedDOMStyle::GetCBContentWidth,
nsCSSProps::kWidthKTable);