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 b9b322be5b1dbb6d6cfec3aee598b8d28b9381ab..0acb140fc89981e6b37d121bd0a78ad26222cc16 100644 |
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp |
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp |
@@ -1379,9 +1379,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); |
} |