Chromium Code Reviews| 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 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1398 if (parentRect.isEmpty()) | 1398 if (parentRect.isEmpty()) |
| 1399 return IntRect(); | 1399 return IntRect(); |
| 1400 | 1400 |
| 1401 us.intersect(parentRect); | 1401 us.intersect(parentRect); |
| 1402 } | 1402 } |
| 1403 | 1403 |
| 1404 return us; | 1404 return us; |
| 1405 } | 1405 } |
| 1406 | 1406 |
| 1407 FloatSize FrameView::viewportSizeForViewportUnits() const { | 1407 FloatSize FrameView::viewportSizeForViewportUnits() const { |
| 1408 float zoom = frame().pageZoomFactor(); | 1408 float zoom = 1; |
| 1409 if (!m_frame->document() || !m_frame->document()->printing()) | |
| 1410 zoom = frame().pageZoomFactor(); | |
|
rune
2017/03/09 22:04:55
I have kept this change since this is what fixes i
bokan
2017/03/09 22:58:06
Acknowledged.
| |
| 1409 | 1411 |
| 1410 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 1412 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
| 1411 if (layoutViewItem.isNull()) | 1413 if (layoutViewItem.isNull()) |
| 1412 return FloatSize(); | 1414 return FloatSize(); |
| 1413 | 1415 |
| 1414 FloatSize layoutSize; | 1416 FloatSize layoutSize; |
| 1415 layoutSize.setWidth(layoutViewItem.viewWidth(IncludeScrollbars) / zoom); | 1417 layoutSize.setWidth(layoutViewItem.viewWidth(IncludeScrollbars) / zoom); |
| 1416 layoutSize.setHeight(layoutViewItem.viewHeight(IncludeScrollbars) / zoom); | 1418 layoutSize.setHeight(layoutViewItem.viewHeight(IncludeScrollbars) / zoom); |
| 1417 | 1419 |
| 1418 BrowserControls& browserControls = m_frame->page()->browserControls(); | 1420 BrowserControls& browserControls = m_frame->page()->browserControls(); |
| 1419 if (RuntimeEnabledFeatures::inertTopControlsEnabled() && | 1421 if (RuntimeEnabledFeatures::inertTopControlsEnabled() && |
| 1420 browserControls.permittedState() != WebBrowserControlsHidden) { | 1422 browserControls.permittedState() != WebBrowserControlsHidden) { |
| 1421 // We use the layoutSize rather than frameRect to calculate viewport units | 1423 // We use the layoutSize rather than frameRect to calculate viewport units |
| 1422 // so that we get correct results on mobile where the page is laid out into | 1424 // so that we get correct results on mobile where the page is laid out into |
| 1423 // a rect that may be larger than the viewport (e.g. the 980px fallback | 1425 // a rect that may be larger than the viewport (e.g. the 980px fallback |
| 1424 // width for desktop pages). Since the layout height is statically set to | 1426 // width for desktop pages). Since the layout height is statically set to |
| 1425 // be the viewport with browser controls showing, we add the browser | 1427 // be the viewport with browser controls showing, we add the browser |
| 1426 // controls height, compensating for page scale as well, since we want to | 1428 // controls height, compensating for page scale as well, since we want to |
| 1427 // use the viewport with browser controls hidden for vh (to match Safari). | 1429 // use the viewport with browser controls hidden for vh (to match Safari). |
| 1428 int viewportWidth = m_frame->host()->visualViewport().size().width(); | 1430 int viewportWidth = m_frame->host()->visualViewport().size().width(); |
| 1429 if (m_frame->isMainFrame() && layoutSize.width() && viewportWidth) { | 1431 if (m_frame->isMainFrame() && layoutSize.width() && viewportWidth) { |
| 1430 float pageScaleAtLayoutWidth = viewportWidth / layoutSize.width(); | 1432 float pageScaleAtLayoutWidth = viewportWidth / layoutSize.width(); |
| 1431 layoutSize.expand(0, browserControls.height() / pageScaleAtLayoutWidth); | 1433 layoutSize.expand(0, browserControls.height() / pageScaleAtLayoutWidth); |
| 1432 } | 1434 } |
| 1433 } | 1435 } |
| 1434 | 1436 |
| 1435 return layoutSize; | 1437 return layoutSize; |
| 1436 } | 1438 } |
| 1437 | 1439 |
| 1440 FloatSize FrameView::viewportSizeForMediaQueries() const { | |
| 1441 FloatSize viewportSize(layoutSize()); | |
| 1442 if (!m_frame->document() || !m_frame->document()->printing()) | |
| 1443 viewportSize.scale(1 / frame().pageZoomFactor()); | |
| 1444 return viewportSize; | |
| 1445 } | |
| 1446 | |
| 1438 DocumentLifecycle& FrameView::lifecycle() const { | 1447 DocumentLifecycle& FrameView::lifecycle() const { |
| 1439 DCHECK(m_frame); | 1448 DCHECK(m_frame); |
| 1440 DCHECK(m_frame->document()); | 1449 DCHECK(m_frame->document()); |
| 1441 return m_frame->document()->lifecycle(); | 1450 return m_frame->document()->lifecycle(); |
| 1442 } | 1451 } |
| 1443 | 1452 |
| 1444 LayoutReplaced* FrameView::embeddedReplacedContent() const { | 1453 LayoutReplaced* FrameView::embeddedReplacedContent() const { |
| 1445 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 1454 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
| 1446 if (layoutViewItem.isNull()) | 1455 if (layoutViewItem.isNull()) |
| 1447 return nullptr; | 1456 return nullptr; |
| (...skipping 3805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5253 void FrameView::setAnimationHost( | 5262 void FrameView::setAnimationHost( |
| 5254 std::unique_ptr<CompositorAnimationHost> host) { | 5263 std::unique_ptr<CompositorAnimationHost> host) { |
| 5255 m_animationHost = std::move(host); | 5264 m_animationHost = std::move(host); |
| 5256 } | 5265 } |
| 5257 | 5266 |
| 5258 LayoutUnit FrameView::caretWidth() const { | 5267 LayoutUnit FrameView::caretWidth() const { |
| 5259 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); | 5268 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); |
| 5260 } | 5269 } |
| 5261 | 5270 |
| 5262 } // namespace blink | 5271 } // namespace blink |
| OLD | NEW |