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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp

Issue 2404393003: Tie scroll anchoring adjustments to frame lifecycle instead of layout. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 if (!frame() || !frame()->host()) 966 if (!frame() || !frame()->host())
967 return 0; 967 return 0;
968 968
969 if (!frame()->host()->settings().inertVisualViewport()) 969 if (!frame()->host()->settings().inertVisualViewport())
970 return m_visualViewport->pageX(); 970 return m_visualViewport->pageX();
971 971
972 FrameView* view = frame()->view(); 972 FrameView* view = frame()->view();
973 if (!view) 973 if (!view)
974 return 0; 974 return 0;
975 975
976 document()->updateStyleAndLayoutIgnorePendingStylesheets(); 976 document()->updateScrollPosition();
977 977
978 double viewportX = 978 double viewportX =
979 view->layoutViewportScrollableArea()->scrollOffset().width(); 979 view->layoutViewportScrollableArea()->scrollOffset().width();
980 return adjustScrollForAbsoluteZoom(viewportX, frame()->pageZoomFactor()); 980 return adjustScrollForAbsoluteZoom(viewportX, frame()->pageZoomFactor());
981 } 981 }
982 982
983 double LocalDOMWindow::scrollY() const { 983 double LocalDOMWindow::scrollY() const {
984 if (!frame() || !frame()->host()) 984 if (!frame() || !frame()->host())
985 return 0; 985 return 0;
986 986
987 if (!frame()->host()->settings().inertVisualViewport()) 987 if (!frame()->host()->settings().inertVisualViewport())
988 return m_visualViewport->pageY(); 988 return m_visualViewport->pageY();
989 989
990 FrameView* view = frame()->view(); 990 FrameView* view = frame()->view();
991 if (!view) 991 if (!view)
992 return 0; 992 return 0;
993 993
994 document()->updateStyleAndLayoutIgnorePendingStylesheets(); 994 document()->updateScrollPosition();
995 995
996 double viewportY = 996 double viewportY =
997 view->layoutViewportScrollableArea()->scrollOffset().height(); 997 view->layoutViewportScrollableArea()->scrollOffset().height();
998 return adjustScrollForAbsoluteZoom(viewportY, frame()->pageZoomFactor()); 998 return adjustScrollForAbsoluteZoom(viewportY, frame()->pageZoomFactor());
999 } 999 }
1000 1000
1001 DOMVisualViewport* LocalDOMWindow::visualViewport() { 1001 DOMVisualViewport* LocalDOMWindow::visualViewport() {
1002 if (!frame()) 1002 if (!frame())
1003 return nullptr; 1003 return nullptr;
1004 1004
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 1555
1556 LocalFrame* LocalDOMWindow::frame() const { 1556 LocalFrame* LocalDOMWindow::frame() const {
1557 // If the LocalDOMWindow still has a frame reference, that frame must point 1557 // If the LocalDOMWindow still has a frame reference, that frame must point
1558 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation 1558 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation
1559 // where script execution leaks between different LocalDOMWindows. 1559 // where script execution leaks between different LocalDOMWindows.
1560 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this); 1560 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this);
1561 return m_frame; 1561 return m_frame;
1562 } 1562 }
1563 1563
1564 } // namespace blink 1564 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698