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

Side by Side Diff: third_party/WebKit/Source/core/frame/DOMVisualViewport.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) 2016 Google Inc. All rights reserved. 2 * Copyright (C) 2016 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 float DOMVisualViewport::pageX() { 80 float DOMVisualViewport::pageX() {
81 LocalFrame* frame = m_window->frame(); 81 LocalFrame* frame = m_window->frame();
82 if (!frame) 82 if (!frame)
83 return 0; 83 return 0;
84 84
85 FrameView* view = frame->view(); 85 FrameView* view = frame->view();
86 if (!view) 86 if (!view)
87 return 0; 87 return 0;
88 88
89 frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 89 frame->document()->updateScrollPosition();
90 float viewportX = view->getScrollableArea()->scrollOffset().width(); 90 float viewportX = view->getScrollableArea()->scrollOffset().width();
91 return adjustScrollForAbsoluteZoom(viewportX, frame->pageZoomFactor()); 91 return adjustScrollForAbsoluteZoom(viewportX, frame->pageZoomFactor());
92 } 92 }
93 93
94 float DOMVisualViewport::pageY() { 94 float DOMVisualViewport::pageY() {
95 LocalFrame* frame = m_window->frame(); 95 LocalFrame* frame = m_window->frame();
96 if (!frame) 96 if (!frame)
97 return 0; 97 return 0;
98 98
99 FrameView* view = frame->view(); 99 FrameView* view = frame->view();
100 if (!view) 100 if (!view)
101 return 0; 101 return 0;
102 102
103 frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 103 frame->document()->updateScrollPosition();
104 float viewportY = view->getScrollableArea()->scrollOffset().height(); 104 float viewportY = view->getScrollableArea()->scrollOffset().height();
105 return adjustScrollForAbsoluteZoom(viewportY, frame->pageZoomFactor()); 105 return adjustScrollForAbsoluteZoom(viewportY, frame->pageZoomFactor());
106 } 106 }
107 107
108 double DOMVisualViewport::clientWidth() { 108 double DOMVisualViewport::clientWidth() {
109 LocalFrame* frame = m_window->frame(); 109 LocalFrame* frame = m_window->frame();
110 if (!frame) 110 if (!frame)
111 return 0; 111 return 0;
112 112
113 if (!frame->isMainFrame()) { 113 if (!frame->isMainFrame()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 if (!frame->isMainFrame()) 147 if (!frame->isMainFrame())
148 return 1; 148 return 1;
149 149
150 if (FrameHost* host = m_window->frame()->host()) 150 if (FrameHost* host = m_window->frame()->host())
151 return host->visualViewport().pageScale(); 151 return host->visualViewport().pageScale();
152 152
153 return 0; 153 return 0;
154 } 154 }
155 155
156 } // namespace blink 156 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698