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

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

Issue 2720743002: vh units shouldn't add controls height when controls are locked to hidden. (Closed)
Patch Set: Created 3 years, 9 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/BrowserControlsTest.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 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 1381
1382 us.intersect(parentRect); 1382 us.intersect(parentRect);
1383 } 1383 }
1384 1384
1385 return us; 1385 return us;
1386 } 1386 }
1387 1387
1388 FloatSize FrameView::viewportSizeForViewportUnits() const { 1388 FloatSize FrameView::viewportSizeForViewportUnits() const {
1389 float zoom = frame().pageZoomFactor(); 1389 float zoom = frame().pageZoomFactor();
1390 1390
1391 FloatSize layoutSize;
1392
1393 LayoutViewItem layoutViewItem = this->layoutViewItem(); 1391 LayoutViewItem layoutViewItem = this->layoutViewItem();
1394 if (layoutViewItem.isNull()) 1392 if (layoutViewItem.isNull())
1395 return layoutSize; 1393 return FloatSize();
1396 1394
1395 FloatSize layoutSize;
1397 layoutSize.setWidth(layoutViewItem.viewWidth(IncludeScrollbars) / zoom); 1396 layoutSize.setWidth(layoutViewItem.viewWidth(IncludeScrollbars) / zoom);
1398 layoutSize.setHeight(layoutViewItem.viewHeight(IncludeScrollbars) / zoom); 1397 layoutSize.setHeight(layoutViewItem.viewHeight(IncludeScrollbars) / zoom);
1399 1398
1400 if (RuntimeEnabledFeatures::inertTopControlsEnabled()) { 1399 BrowserControls& browserControls = m_frame->host()->browserControls();
1400 if (RuntimeEnabledFeatures::inertTopControlsEnabled() &&
1401 browserControls.permittedState() != WebBrowserControlsHidden) {
1401 // We use the layoutSize rather than frameRect to calculate viewport units 1402 // We use the layoutSize rather than frameRect to calculate viewport units
1402 // so that we get correct results on mobile where the page is laid out into 1403 // so that we get correct results on mobile where the page is laid out into
1403 // a rect that may be larger than the viewport (e.g. the 980px fallback 1404 // a rect that may be larger than the viewport (e.g. the 980px fallback
1404 // width for desktop pages). Since the layout height is statically set to 1405 // width for desktop pages). Since the layout height is statically set to
1405 // be the viewport with browser controls showing, we add the browser 1406 // be the viewport with browser controls showing, we add the browser
1406 // controls height, compensating for page scale as well, since we want to 1407 // controls height, compensating for page scale as well, since we want to
1407 // use the viewport with browser controls hidden for vh (to match Safari). 1408 // use the viewport with browser controls hidden for vh (to match Safari).
1408 BrowserControls& browserControls = m_frame->host()->browserControls();
1409 int viewportWidth = m_frame->host()->visualViewport().size().width(); 1409 int viewportWidth = m_frame->host()->visualViewport().size().width();
1410 if (m_frame->isMainFrame() && layoutSize.width() && viewportWidth) { 1410 if (m_frame->isMainFrame() && layoutSize.width() && viewportWidth) {
1411 float pageScaleAtLayoutWidth = viewportWidth / layoutSize.width(); 1411 float pageScaleAtLayoutWidth = viewportWidth / layoutSize.width();
1412 layoutSize.expand(0, browserControls.height() / pageScaleAtLayoutWidth); 1412 layoutSize.expand(0, browserControls.height() / pageScaleAtLayoutWidth);
1413 } 1413 }
1414 } 1414 }
1415 1415
1416 return layoutSize; 1416 return layoutSize;
1417 } 1417 }
1418 1418
(...skipping 3638 matching lines...) Expand 10 before | Expand all | Expand 10 after
5057 std::unique_ptr<CompositorAnimationTimeline> timeline) { 5057 std::unique_ptr<CompositorAnimationTimeline> timeline) {
5058 m_animationTimeline = std::move(timeline); 5058 m_animationTimeline = std::move(timeline);
5059 } 5059 }
5060 5060
5061 void FrameView::setAnimationHost( 5061 void FrameView::setAnimationHost(
5062 std::unique_ptr<CompositorAnimationHost> host) { 5062 std::unique_ptr<CompositorAnimationHost> host) {
5063 m_animationHost = std::move(host); 5063 m_animationHost = std::move(host);
5064 } 5064 }
5065 5065
5066 } // namespace blink 5066 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/BrowserControlsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698