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

Unified Diff: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp

Issue 1875943004: [DNS] Don't adjust the scroll position if the anchor element changes in size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 8 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: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
index dbefd1b256907f3901c8ce3c78e5c3360262ac94..596bc788cf2f4ab8a5e466e9b0406315fdf4267a 100644
--- a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
+++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
@@ -163,6 +163,7 @@ void ScrollAnchor::save()
m_anchorObject->setIsScrollAnchorObject();
m_savedRelativeOffset = computeRelativeOffset(m_anchorObject, m_scroller, m_corner);
+ m_savedAnchorSize = toLayoutBox(m_anchorObject)->size();
}
void ScrollAnchor::restore()
@@ -170,6 +171,11 @@ void ScrollAnchor::restore()
if (!m_anchorObject)
return;
+ if (toLayoutBox(m_anchorObject)->size() != m_savedAnchorSize) {
+ clear();
+ return;
+ }
+
LayoutSize adjustment = computeRelativeOffset(m_anchorObject, m_scroller, m_corner) - m_savedRelativeOffset;
if (!adjustment.isZero()) {
m_scroller->setScrollPosition(
« no previous file with comments | « third_party/WebKit/Source/core/layout/ScrollAnchor.h ('k') | third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698