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
Родитель 8830237118
Коммит eaec3c09b3
2 изменённых файлов: 25 добавлений и 6 удалений

Просмотреть файл

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

Просмотреть файл

@ -14,6 +14,8 @@
#include "nsError.h"
#include "nsDOMString.h"
#include "nsIDOMCSSPrimitiveValue.h"
#include "nsIFrame.h"
#include "nsIFrameInlines.h"
#include "nsStyleContext.h"
#include "nsIScrollableFrame.h"
#include "nsContentUtils.h"
@ -22,6 +24,7 @@
#include "nsDOMCSSRect.h"
#include "nsDOMCSSRGBColor.h"
#include "nsDOMCSSValueList.h"
#include "nsFlexContainerFrame.h"
#include "nsGkAtoms.h"
#include "nsHTMLReflowState.h"
#include "nsStyleUtil.h"
@ -4126,12 +4129,20 @@ nsComputedDOMStyle::DoGetMinWidth()
nsStyleCoord minWidth = StylePosition()->mMinWidth;
if (eStyleUnit_Auto == minWidth.GetUnit()) {
// 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.
// "min-width: auto" means "0", unless we're a flex item in a horizontal
// flex container, in which case it means "min-content"
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,
&nsComputedDOMStyle::GetCBContentWidth,
nsCSSProps::kWidthKTable);