diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index eaae7e84c7df..eab7cf936d73 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1683,22 +1683,42 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay { private: StyleContain EffectiveContainment() const { - // content-visibility and container-type values implicitly enable some - // containment flags. - // FIXME(dshin, bug 1764640): Add in the effect of `container-type` + auto contain = mContain; + // content-visibility and container-type implicitly enable some containment + // flags. + if (MOZ_LIKELY(!mContainerType) && + MOZ_LIKELY(mContentVisibility == StyleContentVisibility::Visible)) { + return contain; + } + switch (mContentVisibility) { case StyleContentVisibility::Visible: - // Most likely case. - return mContain; + break; case StyleContentVisibility::Auto: - return mContain | StyleContain::LAYOUT | StyleContain::PAINT | - StyleContain::STYLE; + contain |= + StyleContain::LAYOUT | StyleContain::PAINT | StyleContain::STYLE; + break; case StyleContentVisibility::Hidden: - return mContain | StyleContain::LAYOUT | StyleContain::PAINT | - StyleContain::SIZE | StyleContain::STYLE; + contain |= StyleContain::LAYOUT | StyleContain::PAINT | + StyleContain::SIZE | StyleContain::STYLE; + break; } - MOZ_ASSERT_UNREACHABLE("Invalid content visibility."); - return mContain; + + if (mContainerType & mozilla::StyleContainerType::SIZE) { + // https://drafts.csswg.org/css-contain-3/#valdef-container-type-size: + // Applies layout containment, style containment, and size containment + // to the principal box. + contain |= mozilla::StyleContain::LAYOUT | mozilla::StyleContain::STYLE | + mozilla::StyleContain::SIZE; + } else if (mContainerType & mozilla::StyleContainerType::INLINE_SIZE) { + // https://drafts.csswg.org/css-contain-3/#valdef-container-type-inline-size: + // Applies layout containment, style containment, and inline-size + // containment to the principal box. + contain |= mozilla::StyleContain::LAYOUT | mozilla::StyleContain::STYLE | + mozilla::StyleContain::INLINE_SIZE; + } + + return contain; } }; diff --git a/testing/web-platform/meta/css/css-contain/container-queries/container-type-containment.html.ini b/testing/web-platform/meta/css/css-contain/container-queries/container-type-containment.html.ini index 036d6c316b37..29038599b11f 100644 --- a/testing/web-platform/meta/css/css-contain/container-queries/container-type-containment.html.ini +++ b/testing/web-platform/meta/css/css-contain/container-queries/container-type-containment.html.ini @@ -1,12 +1,6 @@ [container-type-containment.html] - [container-type:inline-size turns on layout containment] - expected: FAIL - [container-type:inline-size turns on inline-size containment] expected: FAIL - [container-type:size turns on full size containment] - expected: FAIL - [container-type:inline/size turns on style containment] expected: FAIL diff --git a/testing/web-platform/meta/css/css-contain/container-queries/container-type-layout-invalidation.html.ini b/testing/web-platform/meta/css/css-contain/container-queries/container-type-layout-invalidation.html.ini deleted file mode 100644 index c2c554305735..000000000000 --- a/testing/web-platform/meta/css/css-contain/container-queries/container-type-layout-invalidation.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[container-type-layout-invalidation.html] - [Changing container-type invalidates layout] - expected: FAIL diff --git a/testing/web-platform/meta/css/css-contain/container-queries/fieldset-legend-change.html.ini b/testing/web-platform/meta/css/css-contain/container-queries/fieldset-legend-change.html.ini new file mode 100644 index 000000000000..9d5d377cd9c5 --- /dev/null +++ b/testing/web-platform/meta/css/css-contain/container-queries/fieldset-legend-change.html.ini @@ -0,0 +1,2 @@ +[fieldset-legend-change.html] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-contain/container-queries/fragmented-container-001.html.ini b/testing/web-platform/meta/css/css-contain/container-queries/fragmented-container-001.html.ini new file mode 100644 index 000000000000..06a25a08df23 --- /dev/null +++ b/testing/web-platform/meta/css/css-contain/container-queries/fragmented-container-001.html.ini @@ -0,0 +1,3 @@ +[fragmented-container-001.html] + [Children of fragmented inline-size container should match inline-size of first fragment] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-contain/container-queries/inline-size-containment-vertical-rl.html.ini b/testing/web-platform/meta/css/css-contain/container-queries/inline-size-containment-vertical-rl.html.ini new file mode 100644 index 000000000000..86c2ca29f21a --- /dev/null +++ b/testing/web-platform/meta/css/css-contain/container-queries/inline-size-containment-vertical-rl.html.ini @@ -0,0 +1,3 @@ +[inline-size-containment-vertical-rl.html] + [inline-size containment only] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-contain/container-queries/inline-size-containment.html.ini b/testing/web-platform/meta/css/css-contain/container-queries/inline-size-containment.html.ini new file mode 100644 index 000000000000..976a458f91b6 --- /dev/null +++ b/testing/web-platform/meta/css/css-contain/container-queries/inline-size-containment.html.ini @@ -0,0 +1,3 @@ +[inline-size-containment.html] + [inline-size containment only] + expected: FAIL diff --git a/testing/web-platform/meta/css/css-contain/container-queries/percentage-padding-orthogonal.html.ini b/testing/web-platform/meta/css/css-contain/container-queries/percentage-padding-orthogonal.html.ini index 915f6dea5ae8..56c3b6e727b0 100644 --- a/testing/web-platform/meta/css/css-contain/container-queries/percentage-padding-orthogonal.html.ini +++ b/testing/web-platform/meta/css/css-contain/container-queries/percentage-padding-orthogonal.html.ini @@ -8,5 +8,8 @@ [#container width 400px after padding is applied. #second is removed from the rendering] expected: FAIL - [#container width 399px after padding is applied. #second is removed from the rendering] + [#container height measured with 499px width. Both container children visible] + expected: FAIL + + [#container width 399x after padding is applied. #second is removed from the rendering] expected: FAIL diff --git a/testing/web-platform/meta/css/css-contain/container-queries/top-layer-dialog-backdrop.html.ini b/testing/web-platform/meta/css/css-contain/container-queries/top-layer-dialog-backdrop.html.ini index c2c634ac1e1b..84ffee1d4275 100644 --- a/testing/web-platform/meta/css/css-contain/container-queries/top-layer-dialog-backdrop.html.ini +++ b/testing/web-platform/meta/css/css-contain/container-queries/top-layer-dialog-backdrop.html.ini @@ -1,2 +1,3 @@ [top-layer-dialog-backdrop.html] prefs: [dom.dialog_element.enabled:true] + max-asserts: 3 diff --git a/testing/web-platform/meta/css/css-contain/container-queries/transition-scrollbars.html.ini b/testing/web-platform/meta/css/css-contain/container-queries/transition-scrollbars.html.ini deleted file mode 100644 index 741fa91363bb..000000000000 --- a/testing/web-platform/meta/css/css-contain/container-queries/transition-scrollbars.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[transition-scrollbars.html] - [Scrollbars do not cause a transition of background-color] - expected: - if os == "android": PASS - FAIL