diff --git a/mozilla/content/base/public/mozFlushType.h b/mozilla/content/base/public/mozFlushType.h index 6dd9207f815..fd058a0afa9 100644 --- a/mozilla/content/base/public/mozFlushType.h +++ b/mozilla/content/base/public/mozFlushType.h @@ -47,8 +47,9 @@ enum mozFlushType { Flush_StyleReresolves = 0x4, /* flush style reresolution */ Flush_OnlyReflow = 0x8, /* flush reflows */ Flush_OnlyPaint = 0x10, /* flush painting */ - Flush_Frames = (Flush_Content | Flush_SinkNotifications), Flush_ContentAndNotify = (Flush_Content | Flush_SinkNotifications), + Flush_Frames = (Flush_Content | Flush_SinkNotifications | + Flush_StyleReresolves), Flush_Style = (Flush_Content | Flush_SinkNotifications | Flush_StyleReresolves), Flush_Layout = (Flush_Content | Flush_SinkNotifications | diff --git a/mozilla/content/base/src/nsContentSink.cpp b/mozilla/content/base/src/nsContentSink.cpp index 74672ef89d4..3e2ca6d1330 100644 --- a/mozilla/content/base/src/nsContentSink.cpp +++ b/mozilla/content/base/src/nsContentSink.cpp @@ -861,13 +861,9 @@ nsContentSink::ScrollToRef(PRBool aReallyScroll) for (i = 0; i < ns; i++) { nsIPresShell* shell = mDocument->GetShellAt(i); if (shell) { - // Scroll to the anchor - if (aReallyScroll) { - shell->FlushPendingNotifications(Flush_Layout); - } - // Check an empty string which might be caused by the UTF-8 conversion if (!ref.IsEmpty()) { + // Note that GoToAnchor will handle flushing layout as needed. rv = shell->GoToAnchor(ref, aReallyScroll); } else { rv = NS_ERROR_FAILURE; diff --git a/mozilla/content/shared/public/mozFlushType.h b/mozilla/content/shared/public/mozFlushType.h index 6dd9207f815..fd058a0afa9 100644 --- a/mozilla/content/shared/public/mozFlushType.h +++ b/mozilla/content/shared/public/mozFlushType.h @@ -47,8 +47,9 @@ enum mozFlushType { Flush_StyleReresolves = 0x4, /* flush style reresolution */ Flush_OnlyReflow = 0x8, /* flush reflows */ Flush_OnlyPaint = 0x10, /* flush painting */ - Flush_Frames = (Flush_Content | Flush_SinkNotifications), Flush_ContentAndNotify = (Flush_Content | Flush_SinkNotifications), + Flush_Frames = (Flush_Content | Flush_SinkNotifications | + Flush_StyleReresolves), Flush_Style = (Flush_Content | Flush_SinkNotifications | Flush_StyleReresolves), Flush_Layout = (Flush_Content | Flush_SinkNotifications | diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index ec00458215c..ad59ed94fce 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -4319,6 +4319,9 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame, } } + // Flush out pending reflows to make sure we scroll to the right place + mDocument->FlushPendingNotifications(Flush_OnlyReflow); + // This is a two-step process. // Step 1: Find the bounds of the rect we want to scroll into view. For // example, for an inline frame we may want to scroll in the whole diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index ec00458215c..ad59ed94fce 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -4319,6 +4319,9 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame, } } + // Flush out pending reflows to make sure we scroll to the right place + mDocument->FlushPendingNotifications(Flush_OnlyReflow); + // This is a two-step process. // Step 1: Find the bounds of the rect we want to scroll into view. For // example, for an inline frame we may want to scroll in the whole