Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Unified Diff: Source/core/loader/FrameLoader.cpp

Issue 1165233002: Apply :target styling even if fragment scrolling was skipped. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index e63eca19569d0a418ff100f0d677b7740187d16d..4557e00094eb4d32f2ebf28eb4c9575a9e6800d0 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -424,8 +424,7 @@ void FrameLoader::finishedParsing()
// Check if the scrollbars are really needed for the content.
// If not, remove them, relayout, and repaint.
m_frame->view()->restoreScrollbar();
- if (!documentLoader()->initialScrollState().didRestoreFromHistory)
- scrollToFragmentWithParentBoundary(m_frame->document()->url());
+ processFragment(m_frame->document()->url(), false);
}
static bool allDescendantsAreComplete(Frame* frame)
@@ -625,7 +624,7 @@ void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip
// We need to scroll to the fragment whether or not a hash change occurred, since
// the user might have scrolled since the previous navigation.
- scrollToFragmentWithParentBoundary(url);
+ processFragment(url, true);
checkCompleted();
m_frame->localDOMWindow()->statePopped(stateObject ? stateObject : SerializedScriptValue::nullValue());
@@ -1146,7 +1145,7 @@ bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S
&& !m_frame->document()->isFrameSet();
}
-void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url)
+void FrameLoader::processFragment(const KURL& url, bool isSameDocument)
{
FrameView* view = m_frame->view();
if (!view)
@@ -1159,7 +1158,9 @@ void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url)
if (boundaryFrame && boundaryFrame->isLocalFrame())
toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToParent(false);
- view->scrollToFragment(url);
+ view->processUrlFragment(url,
+ !isSameDocument && documentLoader()->initialScrollState().didRestoreFromHistory ?
+ FrameView::UrlFragmentDontScroll : FrameView::UrlFragmentScroll);
if (boundaryFrame && boundaryFrame->isLocalFrame())
toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToParent(true);

Powered by Google App Engine
This is Rietveld 408576698