diff --git a/layout/generic/nsColumnSetFrame.cpp b/layout/generic/nsColumnSetFrame.cpp index d36b2c602a67..92a784516491 100644 --- a/layout/generic/nsColumnSetFrame.cpp +++ b/layout/generic/nsColumnSetFrame.cpp @@ -494,7 +494,11 @@ nsColumnSetFrame::GetMinISize(gfxContext *aRenderingContext) { nscoord iSize = 0; DISPLAY_MIN_WIDTH(this, iSize); - if (mFrames.FirstChild()) { + + if (mFrames.FirstChild() && !StyleDisplay()->IsContainSize()) { + // We want to ignore this in the case that we're size contained + // because our children should not contribute to our + // intrinsic size. iSize = mFrames.FirstChild()->GetMinISize(aRenderingContext); } const nsStyleColumn* colStyle = StyleColumn(); @@ -539,7 +543,10 @@ nsColumnSetFrame::GetPrefISize(gfxContext *aRenderingContext) nscoord colISize; if (colStyle->mColumnWidth.GetUnit() == eStyleUnit_Coord) { colISize = colStyle->mColumnWidth.GetCoordValue(); - } else if (mFrames.FirstChild()) { + } else if (mFrames.FirstChild() && !StyleDisplay()->IsContainSize()) { + // We want to ignore this in the case that we're size contained + // because our children should not contribute to our + // intrinsic size. colISize = mFrames.FirstChild()->GetPrefISize(aRenderingContext); } else { colISize = 0; @@ -908,6 +915,11 @@ nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize, } else { contentSize.BSize(wm) = aConfig.mComputedBSize; } + } else if (aReflowInput.mStyleDisplay->IsContainSize()) { + // If we are intrinsically sized, but are size contained, + // we need to behave as if we have no contents. Our BSize + // should be zero or minBSize if specified. + contentSize.BSize(wm) = aReflowInput.ApplyMinMaxBSize(0); } else { // We add the "consumed" block-size back in so that we're applying // constraints to the correct bSize value, then subtract it again diff --git a/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-002-ref.html b/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-002-ref.html new file mode 100644 index 000000000000..c1c9f1388edb --- /dev/null +++ b/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-002-ref.html @@ -0,0 +1,49 @@ + + + + + CSS Reftest Reference + + + + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + diff --git a/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-002.html b/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-002.html new file mode 100644 index 000000000000..0e35e2fed26d --- /dev/null +++ b/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-002.html @@ -0,0 +1,72 @@ + + + + + CSS Test: 'contain: size' on multicol elements should cause them to be sized as if they had no contents. + + + + + + + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+
+ + +
inner
+ + diff --git a/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-003-ref.html b/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-003-ref.html new file mode 100644 index 000000000000..a44a486fe1f1 --- /dev/null +++ b/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-003-ref.html @@ -0,0 +1,57 @@ + + + + + CSS Reftest Reference + + + + +
+ outside before
outside after +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+
+ + diff --git a/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-003.html b/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-003.html new file mode 100644 index 000000000000..2883d5f1df5b --- /dev/null +++ b/layout/reftests/w3c-css/submitted/contain/contain-size-multicol-003.html @@ -0,0 +1,73 @@ + + + + + CSS Test: 'contain: size' on multicol elements should cause them to be sized and baseline-aligned as if they had no contents. + + + + + + + +
+ outside before
inner
outside after +
+
+ + + +
inner
+
+ +
inner
+
+ +
inner
+
+ +
inner
+
+ +
+
+
inner
+
+
+
+ +
+
+
inner
+
+
+ + diff --git a/layout/reftests/w3c-css/submitted/contain/reftest.list b/layout/reftests/w3c-css/submitted/contain/reftest.list index c8c72b23181e..523565f38b37 100644 --- a/layout/reftests/w3c-css/submitted/contain/reftest.list +++ b/layout/reftests/w3c-css/submitted/contain/reftest.list @@ -23,3 +23,5 @@ pref(layout.css.overflow-clip-box.enabled,true) == contain-paint-clip-006.html c == contain-size-flex-001.html contain-size-flex-001-ref.html fuzzy-if(webrender&&winWidget,3,2) == contain-size-inline-flex-001.html contain-size-inline-flex-001-ref.html # bug 1474093 == contain-size-multicol-001.html contain-size-multicol-001-ref.html +== contain-size-multicol-002.html contain-size-multicol-002-ref.html +== contain-size-multicol-003.html contain-size-multicol-003-ref.html