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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 // TODO(wjmaclean): find out why scrollbars fail to resize for complex | 516 // TODO(wjmaclean): find out why scrollbars fail to resize for complex |
517 // subframes after changing the zoom level. For now always calling | 517 // subframes after changing the zoom level. For now always calling |
518 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to | 518 // updateScrollbarsIfNeeded() here fixes the issue, but it would be good to |
519 // discover the deeper cause of this. http://crbug.com/607987. | 519 // discover the deeper cause of this. http://crbug.com/607987. |
520 updateScrollbarsIfNeeded(); | 520 updateScrollbarsIfNeeded(); |
521 | 521 |
522 frameRectsChanged(); | 522 frameRectsChanged(); |
523 | 523 |
524 updateParentScrollableAreaSet(); | 524 updateParentScrollableAreaSet(); |
525 | 525 |
526 if (LayoutViewItem layoutView = this->layoutViewItem()) { | |
527 // TODO(majidvp): It seems that this only needs to be called when size | |
528 // is updated ignoring any change in the location. | |
529 if (layoutView.usesCompositing()) | |
530 layoutView.compositor()->frameViewDidChangeSize(); | |
531 } | |
532 | |
533 if (frameSizeChanged) { | 526 if (frameSizeChanged) { |
534 viewportSizeChanged(newRect.width() != oldRect.width(), | 527 viewportSizeChanged(newRect.width() != oldRect.width(), |
535 newRect.height() != oldRect.height()); | 528 newRect.height() != oldRect.height()); |
536 | 529 |
537 if (m_frame->isMainFrame()) | 530 if (m_frame->isMainFrame()) |
538 m_frame->host()->visualViewport().mainFrameDidChangeSize(); | 531 m_frame->host()->visualViewport().mainFrameDidChangeSize(); |
539 | 532 |
540 frame().loader().restoreScrollPositionAndViewState(); | 533 frame().loader().restoreScrollPositionAndViewState(); |
541 } | 534 } |
542 } | 535 } |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 | 1509 |
1517 if (ScrollingCoordinator* scrollingCoordinator = | 1510 if (ScrollingCoordinator* scrollingCoordinator = |
1518 this->scrollingCoordinator()) | 1511 this->scrollingCoordinator()) |
1519 scrollingCoordinator->frameViewFixedObjectsDidChange(this); | 1512 scrollingCoordinator->frameViewFixedObjectsDidChange(this); |
1520 } | 1513 } |
1521 } | 1514 } |
1522 | 1515 |
1523 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) { | 1516 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) { |
1524 DCHECK(widthChanged || heightChanged); | 1517 DCHECK(widthChanged || heightChanged); |
1525 | 1518 |
| 1519 if (LayoutViewItem layoutView = this->layoutViewItem()) { |
| 1520 if (layoutView.usesCompositing()) |
| 1521 layoutView.compositor()->frameViewDidChangeSize(); |
| 1522 } |
| 1523 |
| 1524 // Ensure the root scroller compositing layers update geometry in response to |
| 1525 // the URL bar resizing. |
| 1526 if (m_frame->isMainFrame()) { |
| 1527 m_frame->document() |
| 1528 ->frameHost() |
| 1529 ->globalRootScrollerController() |
| 1530 .mainFrameViewResized(); |
| 1531 } |
| 1532 |
1526 showOverlayScrollbars(); | 1533 showOverlayScrollbars(); |
1527 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 1534 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
1528 // The background must be repainted when the FrameView is resized, even if | 1535 // The background must be repainted when the FrameView is resized, even if |
1529 // the initial containing block does not change (so we can't rely on layout | 1536 // the initial containing block does not change (so we can't rely on layout |
1530 // to issue the invalidation). This is because the background fills the | 1537 // to issue the invalidation). This is because the background fills the |
1531 // main GraphicsLayer, which takes the size of the layout viewport. | 1538 // main GraphicsLayer, which takes the size of the layout viewport. |
1532 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents | 1539 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents |
1533 // layer and avoid this invalidation (http://crbug.com/568847). | 1540 // layer and avoid this invalidation (http://crbug.com/568847). |
1534 LayoutViewItem lvi = layoutViewItem(); | 1541 LayoutViewItem lvi = layoutViewItem(); |
1535 if (!lvi.isNull()) | 1542 if (!lvi.isNull()) |
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3516 if (!m_frame->settings() || !m_frame->settings()->viewportEnabled() || | 3523 if (!m_frame->settings() || !m_frame->settings()->viewportEnabled() || |
3517 !m_frame->document() || !m_frame->host()) | 3524 !m_frame->document() || !m_frame->host()) |
3518 return false; | 3525 return false; |
3519 | 3526 |
3520 const TopDocumentRootScrollerController& controller = | 3527 const TopDocumentRootScrollerController& controller = |
3521 m_frame->host()->globalRootScrollerController(); | 3528 m_frame->host()->globalRootScrollerController(); |
3522 | 3529 |
3523 if (!controller.globalRootScroller()) | 3530 if (!controller.globalRootScroller()) |
3524 return false; | 3531 return false; |
3525 | 3532 |
3526 return RootScrollerUtil::scrollableAreaFor( | 3533 return RootScrollerUtil::scrollableAreaForRootScroller( |
3527 *controller.globalRootScroller()) == | 3534 *controller.globalRootScroller()) == |
3528 layoutViewportScrollableArea(); | 3535 layoutViewportScrollableArea(); |
3529 } | 3536 } |
3530 | 3537 |
3531 AXObjectCache* FrameView::axObjectCache() const { | 3538 AXObjectCache* FrameView::axObjectCache() const { |
3532 if (frame().document()) | 3539 if (frame().document()) |
3533 return frame().document()->existingAXObjectCache(); | 3540 return frame().document()->existingAXObjectCache(); |
3534 return nullptr; | 3541 return nullptr; |
3535 } | 3542 } |
3536 | 3543 |
(...skipping 24 matching lines...) Expand all Loading... |
3561 | 3568 |
3562 void FrameView::didAddScrollbar(Scrollbar& scrollbar, | 3569 void FrameView::didAddScrollbar(Scrollbar& scrollbar, |
3563 ScrollbarOrientation orientation) { | 3570 ScrollbarOrientation orientation) { |
3564 ScrollableArea::didAddScrollbar(scrollbar, orientation); | 3571 ScrollableArea::didAddScrollbar(scrollbar, orientation); |
3565 } | 3572 } |
3566 | 3573 |
3567 void FrameView::setBrowserControlsViewportAdjustment(float adjustment) { | 3574 void FrameView::setBrowserControlsViewportAdjustment(float adjustment) { |
3568 m_browserControlsViewportAdjustment = adjustment; | 3575 m_browserControlsViewportAdjustment = adjustment; |
3569 } | 3576 } |
3570 | 3577 |
| 3578 PaintLayer* FrameView::layer() const { |
| 3579 LayoutViewItem layoutView = layoutViewItem(); |
| 3580 if (layoutView.isNull() || !layoutView.compositor()) |
| 3581 return nullptr; |
| 3582 |
| 3583 return layoutView.compositor()->rootLayer(); |
| 3584 } |
| 3585 |
3571 IntSize FrameView::maximumScrollOffsetInt() const { | 3586 IntSize FrameView::maximumScrollOffsetInt() const { |
3572 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() | 3587 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() |
3573 // FIXME: We probably shouldn't be storing the bounds in a float. | 3588 // FIXME: We probably shouldn't be storing the bounds in a float. |
3574 // crbug.com/422331. | 3589 // crbug.com/422331. |
3575 IntSize visibleSize = | 3590 IntSize visibleSize = |
3576 visibleContentSize(ExcludeScrollbars) + browserControlsSize(); | 3591 visibleContentSize(ExcludeScrollbars) + browserControlsSize(); |
3577 IntSize contentBounds = contentsSize(); | 3592 IntSize contentBounds = contentsSize(); |
3578 IntSize maximumOffset = | 3593 IntSize maximumOffset = |
3579 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); | 3594 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); |
3580 return maximumOffset.expandedTo(minimumScrollOffsetInt()); | 3595 return maximumOffset.expandedTo(minimumScrollOffsetInt()); |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4613 DCHECK(m_frame->isMainFrame()); | 4628 DCHECK(m_frame->isMainFrame()); |
4614 return m_initialViewportSize.width(); | 4629 return m_initialViewportSize.width(); |
4615 } | 4630 } |
4616 | 4631 |
4617 int FrameView::initialViewportHeight() const { | 4632 int FrameView::initialViewportHeight() const { |
4618 DCHECK(m_frame->isMainFrame()); | 4633 DCHECK(m_frame->isMainFrame()); |
4619 return m_initialViewportSize.height(); | 4634 return m_initialViewportSize.height(); |
4620 } | 4635 } |
4621 | 4636 |
4622 } // namespace blink | 4637 } // namespace blink |
OLD | NEW |