diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index cda927cf6662..428761b1e714 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -3647,6 +3647,16 @@ PresShell::ScheduleViewManagerFlush(PaintType aType) } } +bool +FlushLayoutRecursive(nsIDocument* aDocument, + void* aData = nullptr) +{ + MOZ_ASSERT(!aData); + aDocument->EnumerateSubDocuments(FlushLayoutRecursive, nullptr); + aDocument->FlushPendingNotifications(Flush_Layout); + return true; +} + void PresShell::DispatchSynthMouseMove(WidgetGUIEvent* aEvent, bool aFlushOnHoverChange) @@ -3671,7 +3681,10 @@ PresShell::DispatchSynthMouseMove(WidgetGUIEvent* aEvent, hoverGenerationBefore != restyleManager->AsGecko()->GetHoverGeneration()) { // Flush so that the resulting reflow happens now so that our caller // can suppress any synthesized mouse moves caused by that reflow. - FlushPendingNotifications(Flush_Layout); + // This code only ever runs for the root document, but :hover changes + // can happen in descendant documents too, so make sure we flush + // all of them. + FlushLayoutRecursive(mDocument); } }