Bug 984711 part 6: Add back special handling for min-width:auto in nsHTMLReflowState & getComputedStyle. (no review; just an unbitrotted backout)

This reverts changeset 1eae876d6c3a from bug 848539.
This commit is contained in:
Daniel Holbert 2014-07-22 08:24:35 -07:00
parent 79fb1eb22a
commit 875d23afcb
2 changed files with 25 additions and 6 deletions

View File

@ -2597,8 +2597,16 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
{ {
// Handle "min-width: auto" // Handle "min-width: auto"
if (eStyleUnit_Auto == mStylePosition->mMinWidth.GetUnit()) { if (eStyleUnit_Auto == mStylePosition->mMinWidth.GetUnit()) {
// XXXdholbert For flex items, this needs to behave like -moz-min-content. nsFlexContainerFrame* flexContainerFrame = GetFlexContainer(frame);
ComputedMinWidth() = 0; if (flexContainerFrame && flexContainerFrame->IsHorizontal()) {
ComputedMinWidth() =
ComputeWidthValue(aContainingBlockWidth,
mStylePosition->mBoxSizing,
nsStyleCoord(NS_STYLE_WIDTH_MIN_CONTENT,
eStyleUnit_Enumerated));
} else {
ComputedMinWidth() = 0;
}
} else { } else {
ComputedMinWidth() = ComputeWidthValue(aContainingBlockWidth, ComputedMinWidth() = ComputeWidthValue(aContainingBlockWidth,
mStylePosition->mBoxSizing, mStylePosition->mBoxSizing,

View File

@ -14,6 +14,8 @@
#include "nsError.h" #include "nsError.h"
#include "nsDOMString.h" #include "nsDOMString.h"
#include "nsIDOMCSSPrimitiveValue.h" #include "nsIDOMCSSPrimitiveValue.h"
#include "nsIFrame.h"
#include "nsIFrameInlines.h"
#include "nsStyleContext.h" #include "nsStyleContext.h"
#include "nsIScrollableFrame.h" #include "nsIScrollableFrame.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
@ -22,6 +24,7 @@
#include "nsDOMCSSRect.h" #include "nsDOMCSSRect.h"
#include "nsDOMCSSRGBColor.h" #include "nsDOMCSSRGBColor.h"
#include "nsDOMCSSValueList.h" #include "nsDOMCSSValueList.h"
#include "nsFlexContainerFrame.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
#include "nsHTMLReflowState.h" #include "nsHTMLReflowState.h"
#include "nsStyleUtil.h" #include "nsStyleUtil.h"
@ -4126,12 +4129,20 @@ nsComputedDOMStyle::DoGetMinWidth()
nsStyleCoord minWidth = StylePosition()->mMinWidth; nsStyleCoord minWidth = StylePosition()->mMinWidth;
if (eStyleUnit_Auto == minWidth.GetUnit()) { if (eStyleUnit_Auto == minWidth.GetUnit()) {
// In non-flexbox contexts, "min-width: auto" means "min-width: 0". // "min-width: auto" means "0", unless we're a flex item in a horizontal
// XXXdholbert For flex items, we should set |minWidth| to the // flex container, in which case it means "min-content"
// -moz-min-content keyword, instead of 0.
minWidth.SetCoordValue(0); minWidth.SetCoordValue(0);
} 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);
}
}
}
SetValueToCoord(val, minWidth, true, SetValueToCoord(val, minWidth, true,
&nsComputedDOMStyle::GetCBContentWidth, &nsComputedDOMStyle::GetCBContentWidth,
nsCSSProps::kWidthKTable); nsCSSProps::kWidthKTable);