Bug 1606485 - Check containing parent frames for 'contain:layout/paint' in grid container frames. r=emilio

This prevents grid container frames from being considered subgrid (even when
they have contain:layout/paint) when they are themselves a grid item of a
contain grid.

Differential Revision: https://phabricator.services.mozilla.com/D59790

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emily McDonough 2020-01-14 01:06:56 +00:00
Родитель 90ddd3d541
Коммит 12a9d5c07e
1 изменённых файлов: 13 добавлений и 3 удалений

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

@ -7832,15 +7832,25 @@ void nsGridContainerFrame::UpdateSubgridFrameState() {
nsFrameState nsGridContainerFrame::ComputeSelfSubgridBits() const {
// 'contain:layout/paint' makes us an "independent formatting context",
// which prevents us from being a subgrid in this case (but not always).
// We will also need to check our containing scroll frame for this property.
// https://drafts.csswg.org/css-display-3/#establish-an-independent-formatting-context
auto* display = StyleDisplay();
if (display->IsContainLayout() || display->IsContainPaint()) {
return nsFrameState(0);
{
const auto* display = StyleDisplay();
if (display->IsContainLayout() || display->IsContainPaint()) {
return nsFrameState(0);
}
}
// skip our scroll frame and such if we have it
auto* parent = GetParent();
while (parent && parent->GetContent() == GetContent()) {
// If we find our containing frame has 'contain:layout/paint' we can't be
// subgrid, for the same reasons as above. This can happen when this frame
// is itself a grid item.
const auto* parentDisplay = parent->StyleDisplay();
if (parentDisplay->IsContainLayout() || parentDisplay->IsContainPaint()) {
return nsFrameState(0);
}
parent = parent->GetParent();
}
nsFrameState bits = nsFrameState(0);