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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 // TODO(wjmaclean): find out why scrollbars fail to resize for complex | 515 // TODO(wjmaclean): find out why scrollbars fail to resize for complex |
516 // subframes after changing the zoom level. For now always calling | 516 // subframes after changing the zoom level. For now always calling |
517 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to | 517 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to |
518 // discover the deeper cause of this. http://crbug.com/607987. | 518 // discover the deeper cause of this. http://crbug.com/607987. |
519 updateScrollbarsIfNeeded(); | 519 updateScrollbarsIfNeeded(); |
520 | 520 |
521 frameRectsChanged(); | 521 frameRectsChanged(); |
522 | 522 |
523 updateParentScrollableAreaSet(); | 523 updateParentScrollableAreaSet(); |
524 | 524 |
525 if (LayoutViewItem layoutView = this->layoutViewItem()) { | |
526 // TODO(majidvp): It seems that this only needs to be called when size | |
527 // is updated ignoring any change in the location. | |
528 if (layoutView.usesCompositing()) | |
529 layoutView.compositor()->frameViewDidChangeSize(); | |
530 } | |
531 | |
532 if (frameSizeChanged) { | 525 if (frameSizeChanged) { |
533 viewportSizeChanged(newRect.width() != oldRect.width(), | 526 viewportSizeChanged(newRect.width() != oldRect.width(), |
534 newRect.height() != oldRect.height()); | 527 newRect.height() != oldRect.height()); |
535 | 528 |
536 if (m_frame->isMainFrame()) | 529 if (m_frame->isMainFrame()) |
537 m_frame->host()->visualViewport().mainFrameDidChangeSize(); | 530 m_frame->host()->visualViewport().mainFrameDidChangeSize(); |
538 | 531 |
539 frame().loader().restoreScrollPositionAndViewState(); | 532 frame().loader().restoreScrollPositionAndViewState(); |
540 } | 533 } |
541 } | 534 } |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1515 | 1508 |
1516 if (ScrollingCoordinator* scrollingCoordinator = | 1509 if (ScrollingCoordinator* scrollingCoordinator = |
1517 this->scrollingCoordinator()) | 1510 this->scrollingCoordinator()) |
1518 scrollingCoordinator->frameViewFixedObjectsDidChange(this); | 1511 scrollingCoordinator->frameViewFixedObjectsDidChange(this); |
1519 } | 1512 } |
1520 } | 1513 } |
1521 | 1514 |
1522 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) { | 1515 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) { |
1523 DCHECK(widthChanged || heightChanged); | 1516 DCHECK(widthChanged || heightChanged); |
1524 | 1517 |
| 1518 if (LayoutViewItem layoutView = this->layoutViewItem()) { |
| 1519 if (layoutView.usesCompositing()) |
| 1520 layoutView.compositor()->frameViewDidChangeSize(); |
| 1521 } |
| 1522 |
| 1523 // Ensure the root scroller compositing layers update geometry in response to |
| 1524 // the URL bar resizing. |
| 1525 if (m_frame->isMainFrame()) { |
| 1526 m_frame->document() |
| 1527 ->frameHost() |
| 1528 ->globalRootScrollerController() |
| 1529 .mainFrameViewResized(); |
| 1530 } |
| 1531 |
1525 showOverlayScrollbars(); | 1532 showOverlayScrollbars(); |
1526 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 1533 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
1527 // The background must be repainted when the FrameView is resized, even if | 1534 // The background must be repainted when the FrameView is resized, even if |
1528 // the initial containing block does not change (so we can't rely on layout | 1535 // the initial containing block does not change (so we can't rely on layout |
1529 // to issue the invalidation). This is because the background fills the | 1536 // to issue the invalidation). This is because the background fills the |
1530 // main GraphicsLayer, which takes the size of the layout viewport. | 1537 // main GraphicsLayer, which takes the size of the layout viewport. |
1531 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents | 1538 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents |
1532 // layer and avoid this invalidation (http://crbug.com/568847). | 1539 // layer and avoid this invalidation (http://crbug.com/568847). |
1533 LayoutViewItem lvi = layoutViewItem(); | 1540 LayoutViewItem lvi = layoutViewItem(); |
1534 if (!lvi.isNull()) | 1541 if (!lvi.isNull()) |
(...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3528 | 3535 |
3529 void FrameView::didAddScrollbar(Scrollbar& scrollbar, | 3536 void FrameView::didAddScrollbar(Scrollbar& scrollbar, |
3530 ScrollbarOrientation orientation) { | 3537 ScrollbarOrientation orientation) { |
3531 ScrollableArea::didAddScrollbar(scrollbar, orientation); | 3538 ScrollableArea::didAddScrollbar(scrollbar, orientation); |
3532 } | 3539 } |
3533 | 3540 |
3534 void FrameView::setBrowserControlsViewportAdjustment(float adjustment) { | 3541 void FrameView::setBrowserControlsViewportAdjustment(float adjustment) { |
3535 m_browserControlsViewportAdjustment = adjustment; | 3542 m_browserControlsViewportAdjustment = adjustment; |
3536 } | 3543 } |
3537 | 3544 |
| 3545 PaintLayer* FrameView::layer() const { |
| 3546 LayoutViewItem layoutView = layoutViewItem(); |
| 3547 if (layoutView.isNull() || !layoutView.compositor()) |
| 3548 return nullptr; |
| 3549 |
| 3550 return layoutView.compositor()->rootLayer(); |
| 3551 } |
| 3552 |
3538 IntSize FrameView::maximumScrollOffsetInt() const { | 3553 IntSize FrameView::maximumScrollOffsetInt() const { |
3539 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() | 3554 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() |
3540 // FIXME: We probably shouldn't be storing the bounds in a float. | 3555 // FIXME: We probably shouldn't be storing the bounds in a float. |
3541 // crbug.com/422331. | 3556 // crbug.com/422331. |
3542 IntSize visibleSize = | 3557 IntSize visibleSize = |
3543 visibleContentSize(ExcludeScrollbars) + browserControlsSize(); | 3558 visibleContentSize(ExcludeScrollbars) + browserControlsSize(); |
3544 IntSize contentBounds = contentsSize(); | 3559 IntSize contentBounds = contentsSize(); |
3545 IntSize maximumOffset = | 3560 IntSize maximumOffset = |
3546 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); | 3561 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); |
3547 return maximumOffset.expandedTo(minimumScrollOffsetInt()); | 3562 return maximumOffset.expandedTo(minimumScrollOffsetInt()); |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4579 DCHECK(m_frame->isMainFrame()); | 4594 DCHECK(m_frame->isMainFrame()); |
4580 return m_initialViewportSize.width(); | 4595 return m_initialViewportSize.width(); |
4581 } | 4596 } |
4582 | 4597 |
4583 int FrameView::initialViewportHeight() const { | 4598 int FrameView::initialViewportHeight() const { |
4584 DCHECK(m_frame->isMainFrame()); | 4599 DCHECK(m_frame->isMainFrame()); |
4585 return m_initialViewportSize.height(); | 4600 return m_initialViewportSize.height(); |
4586 } | 4601 } |
4587 | 4602 |
4588 } // namespace blink | 4603 } // namespace blink |
OLD | NEW |