OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |