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

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2619173003: Fix crash with viewport units when using auto resize mode. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/VisualViewportTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 90ef2c8c2707c8f5c56979a14115076ff86b0cb1..5d1e9dfb2da96e31980f6b3b9f2022dfe10e8919 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -1361,9 +1361,9 @@ FloatSize FrameView::viewportSizeForViewportUnits() const {
// height, compensating for page scale as well, since we want to use the
// viewport with browser controls hidden for vh (to match Safari).
BrowserControls& browserControls = m_frame->host()->browserControls();
- if (m_frame->isMainFrame() && size.width()) {
- float pageScaleAtLayoutWidth =
- m_frame->host()->visualViewport().size().width() / size.width();
+ int viewportWidth = m_frame->host()->visualViewport().size().width();
+ if (m_frame->isMainFrame() && size.width() && viewportWidth) {
+ float pageScaleAtLayoutWidth = viewportWidth / size.width();
size.expand(0, browserControls.height() / pageScaleAtLayoutWidth);
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/VisualViewportTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698