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

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

Issue 2716453004: vh units shouldn't add controls height when controls are locked to hidden. (Closed)
Patch Set: Remove extra whitespace Created 3 years, 10 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 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 1393
1394 us.intersect(parentRect); 1394 us.intersect(parentRect);
1395 } 1395 }
1396 1396
1397 return us; 1397 return us;
1398 } 1398 }
1399 1399
1400 FloatSize FrameView::viewportSizeForViewportUnits() const { 1400 FloatSize FrameView::viewportSizeForViewportUnits() const {
1401 float zoom = frame().pageZoomFactor(); 1401 float zoom = frame().pageZoomFactor();
1402 1402
1403 FloatSize layoutSize;
1404
1405 LayoutViewItem layoutViewItem = this->layoutViewItem(); 1403 LayoutViewItem layoutViewItem = this->layoutViewItem();
1406 if (layoutViewItem.isNull()) 1404 if (layoutViewItem.isNull())
1407 return layoutSize; 1405 return FloatSize();
1408 1406
1407 FloatSize layoutSize;
1409 layoutSize.setWidth(layoutViewItem.viewWidth(IncludeScrollbars) / zoom); 1408 layoutSize.setWidth(layoutViewItem.viewWidth(IncludeScrollbars) / zoom);
1410 layoutSize.setHeight(layoutViewItem.viewHeight(IncludeScrollbars) / zoom); 1409 layoutSize.setHeight(layoutViewItem.viewHeight(IncludeScrollbars) / zoom);
1411 1410
1412 if (RuntimeEnabledFeatures::inertTopControlsEnabled()) { 1411 BrowserControls& browserControls = m_frame->host()->browserControls();
1412 if (RuntimeEnabledFeatures::inertTopControlsEnabled() &&
1413 browserControls.permittedState() != WebBrowserControlsHidden) {
1413 // We use the layoutSize rather than frameRect to calculate viewport units 1414 // We use the layoutSize rather than frameRect to calculate viewport units
1414 // so that we get correct results on mobile where the page is laid out into 1415 // so that we get correct results on mobile where the page is laid out into
1415 // a rect that may be larger than the viewport (e.g. the 980px fallback 1416 // a rect that may be larger than the viewport (e.g. the 980px fallback
1416 // width for desktop pages). Since the layout height is statically set to 1417 // width for desktop pages). Since the layout height is statically set to
1417 // be the viewport with browser controls showing, we add the browser 1418 // be the viewport with browser controls showing, we add the browser
1418 // controls height, compensating for page scale as well, since we want to 1419 // controls height, compensating for page scale as well, since we want to
1419 // use the viewport with browser controls hidden for vh (to match Safari). 1420 // use the viewport with browser controls hidden for vh (to match Safari).
1420 BrowserControls& browserControls = m_frame->host()->browserControls();
1421 int viewportWidth = m_frame->host()->visualViewport().size().width(); 1421 int viewportWidth = m_frame->host()->visualViewport().size().width();
1422 if (m_frame->isMainFrame() && layoutSize.width() && viewportWidth) { 1422 if (m_frame->isMainFrame() && layoutSize.width() && viewportWidth) {
1423 float pageScaleAtLayoutWidth = viewportWidth / layoutSize.width(); 1423 float pageScaleAtLayoutWidth = viewportWidth / layoutSize.width();
1424 layoutSize.expand(0, browserControls.height() / pageScaleAtLayoutWidth); 1424 layoutSize.expand(0, browserControls.height() / pageScaleAtLayoutWidth);
1425 } 1425 }
1426 } 1426 }
1427 1427
1428 return layoutSize; 1428 return layoutSize;
1429 } 1429 }
1430 1430
(...skipping 3772 matching lines...) Expand 10 before | Expand all | Expand 10 after
5203 void FrameView::setAnimationHost( 5203 void FrameView::setAnimationHost(
5204 std::unique_ptr<CompositorAnimationHost> host) { 5204 std::unique_ptr<CompositorAnimationHost> host) {
5205 m_animationHost = std::move(host); 5205 m_animationHost = std::move(host);
5206 } 5206 }
5207 5207
5208 LayoutUnit FrameView::caretWidth() const { 5208 LayoutUnit FrameView::caretWidth() const {
5209 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); 5209 return LayoutUnit(getHostWindow()->windowToViewportScalar(1));
5210 } 5210 }
5211 5211
5212 } // namespace blink 5212 } // 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