Bug 1575138 - Do not schedule reconstruction for <slot> if there's no fallback. r=smaug

Just realized that we probably want this too.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-09-24 15:13:34 +00:00
Родитель ac737899a9
Коммит 28b566cf8f
2 изменённых файлов: 3 добавлений и 2 удалений

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

@ -638,7 +638,8 @@ void ShadowRoot::MaybeSlotHostChild(nsIContent& aChild) {
}
// Fallback content will go away, let layout know.
if (assignment.mSlot->AssignedNodes().IsEmpty()) {
if (assignment.mSlot->AssignedNodes().IsEmpty() &&
assignment.mSlot->HasChildren()) {
InvalidateStyleAndLayoutOnSubtree(assignment.mSlot);
}

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

@ -2860,7 +2860,7 @@ void PresShell::SlotAssignmentWillChange(Element& aElement,
if (aNewSlot) {
// If the new slot will stop showing fallback content, we need to reframe it
// altogether.
if (aNewSlot->AssignedNodes().IsEmpty()) {
if (aNewSlot->AssignedNodes().IsEmpty() && aNewSlot->HasChildren()) {
DestroyFramesForAndRestyle(aNewSlot);
// Otherwise we just care about the element, but we need to ensure that
// something takes care of traversing to the relevant slot, if needed.