Bug 1348857 part 2 - [css-grid] Propagate the ApplyAutoMinSize bit to nsFrame::ComputeSize (idempotent patch). r=dholbert

MozReview-Commit-ID: DBU4hDfCAdE
This commit is contained in:
Mats Palmgren 2017-04-18 22:35:04 +02:00
Родитель a243aa1c80
Коммит c02d9817f3
4 изменённых файлов: 27 добавлений и 0 удалений

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

@ -93,6 +93,9 @@ ReflowInput::ReflowInput(nsPresContext* aPresContext,
if (aFlags & B_CLAMP_MARGIN_BOX_MIN_SIZE) {
mFlags.mBClampMarginBoxMinSize = true;
}
if (aFlags & I_APPLY_AUTO_MIN_SIZE) {
mFlags.mApplyAutoMinSize = true;
}
if (!(aFlags & CALLER_WILL_INIT)) {
Init(aPresContext);
@ -242,6 +245,7 @@ ReflowInput::ReflowInput(
mFlags.mIOffsetsNeedCSSAlign = mFlags.mBOffsetsNeedCSSAlign = false;
mFlags.mIClampMarginBoxMinSize = !!(aFlags & I_CLAMP_MARGIN_BOX_MIN_SIZE);
mFlags.mBClampMarginBoxMinSize = !!(aFlags & B_CLAMP_MARGIN_BOX_MIN_SIZE);
mFlags.mApplyAutoMinSize = !!(aFlags & I_APPLY_AUTO_MIN_SIZE);
mDiscoveredClearance = nullptr;
mPercentBSizeObserver = (aParentReflowInput.mPercentBSizeObserver &&
@ -1666,6 +1670,10 @@ ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
computeSizeFlags = ComputeSizeFlags(computeSizeFlags |
ComputeSizeFlags::eBClampMarginBoxMinSize);
}
if (mFlags.mApplyAutoMinSize) {
computeSizeFlags = ComputeSizeFlags(computeSizeFlags |
ComputeSizeFlags::eIApplyAutoMinSize);
}
if (mFlags.mShrinkWrap) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
@ -2379,6 +2387,10 @@ ReflowInput::InitConstraints(nsPresContext* aPresContext,
computeSizeFlags = ComputeSizeFlags(computeSizeFlags |
ComputeSizeFlags::eBClampMarginBoxMinSize);
}
if (mFlags.mApplyAutoMinSize) {
computeSizeFlags = ComputeSizeFlags(computeSizeFlags |
ComputeSizeFlags::eIApplyAutoMinSize);
}
if (mFlags.mShrinkWrap) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);

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

@ -220,6 +220,7 @@ public:
bool mStaticPosIsCBOrigin : 1; // the STATIC_POS_IS_CB_ORIGIN ctor flag
bool mIClampMarginBoxMinSize : 1; // the I_CLAMP_MARGIN_BOX_MIN_SIZE ctor flag
bool mBClampMarginBoxMinSize : 1; // the B_CLAMP_MARGIN_BOX_MIN_SIZE ctor flag
bool mApplyAutoMinSize : 1; // the I_APPLY_AUTO_MIN_SIZE ctor flag
// If set, the following two flags indicate that:
// (1) this frame is absolutely-positioned (or fixed-positioned).
@ -739,6 +740,9 @@ public:
// Pass ComputeSizeFlags::eBClampMarginBoxMinSize to ComputeSize().
B_CLAMP_MARGIN_BOX_MIN_SIZE = (1<<6),
// Pass ComputeSizeFlags::eIApplyAutoMinSize to ComputeSize().
I_APPLY_AUTO_MIN_SIZE = (1<<7),
};
// This method initializes various data members. It is automatically

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

@ -5012,6 +5012,9 @@ nsGridContainerFrame::ReflowInFlowChild(nsIFrame* aChild,
} else {
aChild->Properties().Delete(BClampMarginBoxMinSizeProperty());
}
if ((aGridItemInfo->mState[childIAxis] & ItemState::eApplyAutoMinSize)) {
flags |= ReflowInput::I_APPLY_AUTO_MIN_SIZE;
}
}
if (!isConstrainedBSize) {

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

@ -2250,6 +2250,14 @@ public:
*/
eIClampMarginBoxMinSize = 1 << 2, // clamp in our inline axis
eBClampMarginBoxMinSize = 1 << 3, // clamp in our block axis
/**
* The frame is stretching (per CSS Box Alignment) and doesn't have an
* Automatic Minimum Size in the indicated axis.
* (may be used for both flex/grid items, but currently only used for Grid)
* https://drafts.csswg.org/css-grid/#min-size-auto
* https://drafts.csswg.org/css-align-3/#valdef-justify-self-stretch
*/
eIApplyAutoMinSize = 1 << 4, // only has an effect when eShrinkWrap is false
};
/**