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
This commit is contained in:
Emilio Cobos Álvarez
2019-09-24 15:13:34 +00:00
parent a9f29fb726
commit 0d9373b571
2 changed files with 3 additions and 2 deletions

View File

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

View File

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