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

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

Issue 2616893004: 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/VisualViewportTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 FloatSize size(layoutSize(IncludeScrollbars)); 1372 FloatSize size(layoutSize(IncludeScrollbars));
1373 1373
1374 // We use the layoutSize rather than frameRect to calculate viewport units 1374 // We use the layoutSize rather than frameRect to calculate viewport units
1375 // so that we get correct results on mobile where the page is laid out into 1375 // so that we get correct results on mobile where the page is laid out into
1376 // a rect that may be larger than the viewport (e.g. the 980px fallback 1376 // a rect that may be larger than the viewport (e.g. the 980px fallback
1377 // width for desktop pages). Since the layout height is statically set to 1377 // width for desktop pages). Since the layout height is statically set to
1378 // be the viewport with browser controls showing, we add the browser controls 1378 // be the viewport with browser controls showing, we add the browser controls
1379 // height, compensating for page scale as well, since we want to use the 1379 // height, compensating for page scale as well, since we want to use the
1380 // viewport with browser controls hidden for vh (to match Safari). 1380 // viewport with browser controls hidden for vh (to match Safari).
1381 BrowserControls& browserControls = m_frame->host()->browserControls(); 1381 BrowserControls& browserControls = m_frame->host()->browserControls();
1382 if (m_frame->isMainFrame() && size.width()) { 1382 int viewportWidth = m_frame->host()->visualViewport().size().width();
1383 float pageScaleAtLayoutWidth = 1383 if (m_frame->isMainFrame() && size.width() && viewportWidth) {
1384 m_frame->host()->visualViewport().size().width() / size.width(); 1384 float pageScaleAtLayoutWidth = viewportWidth / size.width();
1385 size.expand(0, browserControls.height() / pageScaleAtLayoutWidth); 1385 size.expand(0, browserControls.height() / pageScaleAtLayoutWidth);
1386 } 1386 }
1387 1387
1388 size.scale(1 / zoom); 1388 size.scale(1 / zoom);
1389 return size; 1389 return size;
1390 } 1390 }
1391 1391
1392 DocumentLifecycle& FrameView::lifecycle() const { 1392 DocumentLifecycle& FrameView::lifecycle() const {
1393 DCHECK(m_frame); 1393 DCHECK(m_frame);
1394 DCHECK(m_frame->document()); 1394 DCHECK(m_frame->document());
(...skipping 3521 matching lines...) Expand 10 before | Expand all | Expand 10 after
4916 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount; 4916 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount;
4917 ++reason) { 4917 ++reason) {
4918 if (m_mainThreadScrollingReasonsCounter[reason] > 0) { 4918 if (m_mainThreadScrollingReasonsCounter[reason] > 0) {
4919 reasons |= 1 << (reason - 1); 4919 reasons |= 1 << (reason - 1);
4920 } 4920 }
4921 } 4921 }
4922 return reasons; 4922 return reasons;
4923 } 4923 }
4924 4924
4925 } // namespace blink 4925 } // namespace blink
OLDNEW
« 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