Bug 1764640 - Apply implicit containment with container-type. r=dholbert

As per spec. This is a progression but there's still more work to do of
course.

Differential Revision: https://phabricator.services.mozilla.com/D153950
This commit is contained in:
Emilio Cobos Álvarez 2022-08-12 19:13:13 +00:00
Родитель 4cbc2911be
Коммит 83145e5efe
10 изменённых файлов: 47 добавлений и 26 удалений

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

@ -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;
}
};

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

@ -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

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

@ -1,3 +0,0 @@
[container-type-layout-invalidation.html]
[Changing container-type invalidates layout]
expected: FAIL

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

@ -0,0 +1,2 @@
[fieldset-legend-change.html]
expected: FAIL

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

@ -0,0 +1,3 @@
[fragmented-container-001.html]
[Children of fragmented inline-size container should match inline-size of first fragment]
expected: FAIL

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

@ -0,0 +1,3 @@
[inline-size-containment-vertical-rl.html]
[inline-size containment only]
expected: FAIL

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

@ -0,0 +1,3 @@
[inline-size-containment.html]
[inline-size containment only]
expected: FAIL

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

@ -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

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

@ -1,2 +1,3 @@
[top-layer-dialog-backdrop.html]
prefs: [dom.dialog_element.enabled:true]
max-asserts: 3

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

@ -1,5 +0,0 @@
[transition-scrollbars.html]
[Scrollbars do not cause a transition of background-color]
expected:
if os == "android": PASS
FAIL