diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 11425e27daa1..7ddd81d1b167 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -3630,6 +3630,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) @@ -3654,7 +3664,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); } }