Index: Source/core/editing/FrameSelection.cpp |
diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp |
index b4c9085c4eb5408e8f3114a93cfaefdd90f4f718..3e38a1dba4940b7a643d6482584d07ce911b9f6f 100644 |
--- a/Source/core/editing/FrameSelection.cpp |
+++ b/Source/core/editing/FrameSelection.cpp |
@@ -1751,6 +1751,14 @@ HTMLFormElement* FrameSelection::currentForm() const |
void FrameSelection::revealSelection(const ScrollAlignment& alignment, RevealExtentOption revealExtentOption) |
{ |
+ bool isLoading = !m_frame->document()->loadEventFinished(); |
+ HistoryItem* currentItem = m_frame->loader().currentItem(); |
+ FrameView* view = m_frame->view(); |
+ |
+ // Ignore scrolling to the focused element if the page already scrolled to stored scroll position in history while page is loading. |
+ if (view && isLoading && currentItem && !view->wasScrolledByUser() && currentItem->scrollPoint() != IntPoint::zero() && currentItem->scrollPoint() == view->scrollPosition()) |
+ return; |
+ |
LayoutRect rect; |
switch (selectionType()) { |