зеркало из https://github.com/mozilla/gecko-dev.git
Bug 666041 patch 8: Add special handling for "min-width: auto" value on flex items. r=dbaron
This commit is contained in:
Родитель
e71e5f4161
Коммит
8d95ac617b
|
@ -2502,10 +2502,22 @@ 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,
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "nsCSSProps.h"
|
||||
#include "nsCSSKeywords.h"
|
||||
#include "nsDOMCSSRect.h"
|
||||
#include "nsFlexContainerFrame.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsHTMLReflowState.h"
|
||||
#include "nsThemeConstants.h"
|
||||
|
@ -3388,12 +3389,22 @@ nsComputedDOMStyle::DoGetMinWidth()
|
|||
nsStyleCoord minWidth = GetStylePosition()->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);
|
||||
}
|
||||
#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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче