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 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1635 if (!layoutViewItem.isNull() && layoutViewItem.needsLayout()) | 1635 if (!layoutViewItem.isNull() && layoutViewItem.needsLayout()) |
1636 layout(); | 1636 layout(); |
1637 else | 1637 else |
1638 scrollToFragmentAnchor(); | 1638 scrollToFragmentAnchor(); |
1639 } | 1639 } |
1640 | 1640 |
1641 void FrameView::clearFragmentAnchor() { | 1641 void FrameView::clearFragmentAnchor() { |
1642 m_fragmentAnchor = nullptr; | 1642 m_fragmentAnchor = nullptr; |
1643 } | 1643 } |
1644 | 1644 |
1645 void FrameView::setScrollPosition(const DoublePoint& scrollPoint, | |
1646 ScrollType scrollType, | |
1647 ScrollBehavior scrollBehavior) { | |
1648 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint); | |
1649 if (newScrollPosition == scrollPositionDouble()) | |
1650 return; | |
1651 | |
1652 if (scrollBehavior == ScrollBehaviorAuto) | |
1653 scrollBehavior = scrollBehaviorStyle(); | |
1654 | |
1655 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, | |
1656 scrollBehavior); | |
1657 } | |
1658 | |
1659 void FrameView::didUpdateElasticOverscroll() { | 1645 void FrameView::didUpdateElasticOverscroll() { |
1660 Page* page = frame().page(); | 1646 Page* page = frame().page(); |
1661 if (!page) | 1647 if (!page) |
1662 return; | 1648 return; |
1663 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); | 1649 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); |
1664 if (m_horizontalScrollbar) { | 1650 if (m_horizontalScrollbar) { |
1665 float delta = | 1651 float delta = |
1666 elasticOverscroll.width() - m_horizontalScrollbar->elasticOverscroll(); | 1652 elasticOverscroll.width() - m_horizontalScrollbar->elasticOverscroll(); |
1667 if (delta != 0) { | 1653 if (delta != 0) { |
1668 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width()); | 1654 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width()); |
(...skipping 24 matching lines...) Expand all Loading... | |
1693 | 1679 |
1694 setLayoutSizeInternal(size); | 1680 setLayoutSizeInternal(size); |
1695 } | 1681 } |
1696 | 1682 |
1697 void FrameView::didScrollTimerFired(TimerBase*) { | 1683 void FrameView::didScrollTimerFired(TimerBase*) { |
1698 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull()) | 1684 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull()) |
1699 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); | 1685 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); |
1700 } | 1686 } |
1701 | 1687 |
1702 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded( | 1688 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded( |
1703 const DoubleSize& scrollDelta) { | 1689 const ScrollOffset& scrollDelta) { |
1704 // Nothing to do after scrolling if there are no fixed position elements. | 1690 // Nothing to do after scrolling if there are no fixed position elements. |
1705 if (!hasViewportConstrainedObjects()) | 1691 if (!hasViewportConstrainedObjects()) |
1706 return; | 1692 return; |
1707 | 1693 |
1708 // Update sticky position objects which are stuck to the viewport. | 1694 // Update sticky position objects which are stuck to the viewport. |
1709 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { | 1695 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { |
1710 LayoutObject* layoutObject = viewportConstrainedObject; | 1696 LayoutObject* layoutObject = viewportConstrainedObject; |
1711 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); | 1697 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); |
1712 if (layoutObject->style()->position() == StickyPosition) { | 1698 if (layoutObject->style()->position() == StickyPosition) { |
1713 // TODO(skobes): Resolve circular dependency between scroll offset and | 1699 // TODO(skobes): Resolve circular dependency between scroll offset and |
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3058 overflow); // This is how we clip in case we overflow again. | 3044 overflow); // This is how we clip in case we overflow again. |
3059 } | 3045 } |
3060 } | 3046 } |
3061 | 3047 |
3062 adjustViewSizeAndLayout(); | 3048 adjustViewSizeAndLayout(); |
3063 } | 3049 } |
3064 | 3050 |
3065 IntRect FrameView::convertFromLayoutObject( | 3051 IntRect FrameView::convertFromLayoutObject( |
3066 const LayoutObject& layoutObject, | 3052 const LayoutObject& layoutObject, |
3067 const IntRect& layoutObjectRect) const { | 3053 const IntRect& layoutObjectRect) const { |
3068 IntRect rect = pixelSnappedIntRect(enclosingLayoutRect( | 3054 // Convert from page ("absolute") to FrameView coordinates. |
3055 LayoutRect rect = enclosingLayoutRect( | |
3069 layoutObject.localToAbsoluteQuad(FloatRect(layoutObjectRect)) | 3056 layoutObject.localToAbsoluteQuad(FloatRect(layoutObjectRect)) |
3070 .boundingBox())); | 3057 .boundingBox()); |
3071 | 3058 rect.moveBy(LayoutPoint(FloatPoint(-scrollOffset()))); |
bokan
2016/10/02 19:47:50
Use move() (here and the changes below)
szager1
2016/10/05 07:43:36
Done.
| |
3072 // Convert from page ("absolute") to FrameView coordinates. | 3059 return pixelSnappedIntRect(rect); |
3073 rect.moveBy(-scrollPosition()); | |
3074 | |
3075 return rect; | |
3076 } | 3060 } |
3077 | 3061 |
3078 IntRect FrameView::convertToLayoutObject(const LayoutObject& layoutObject, | 3062 IntRect FrameView::convertToLayoutObject(const LayoutObject& layoutObject, |
3079 const IntRect& frameRect) const { | 3063 const IntRect& frameRect) const { |
3080 IntRect rectInContent = frameToContents(frameRect); | 3064 IntRect rectInContent = frameToContents(frameRect); |
3081 | 3065 |
3082 // Convert from FrameView coords into page ("absolute") coordinates. | 3066 // Convert from FrameView coords into page ("absolute") coordinates. |
3083 rectInContent.moveBy(scrollPosition()); | 3067 rectInContent.moveBy(IntPoint(scrollOffsetInt())); |
3084 | 3068 |
3085 // FIXME: we don't have a way to map an absolute rect down to a local quad, so just | 3069 // FIXME: we don't have a way to map an absolute rect down to a local quad, so just |
3086 // move the rect for now. | 3070 // move the rect for now. |
3087 rectInContent.setLocation(roundedIntPoint( | 3071 rectInContent.setLocation(roundedIntPoint( |
3088 layoutObject.absoluteToLocal(rectInContent.location(), UseTransforms))); | 3072 layoutObject.absoluteToLocal(rectInContent.location(), UseTransforms))); |
3089 return rectInContent; | 3073 return rectInContent; |
3090 } | 3074 } |
3091 | 3075 |
3092 IntPoint FrameView::convertFromLayoutObject( | 3076 IntPoint FrameView::convertFromLayoutObject( |
3093 const LayoutObject& layoutObject, | 3077 const LayoutObject& layoutObject, |
3094 const IntPoint& layoutObjectPoint) const { | 3078 const IntPoint& layoutObjectPoint) const { |
3095 IntPoint point = roundedIntPoint( | 3079 IntPoint point = roundedIntPoint( |
3096 layoutObject.localToAbsolute(layoutObjectPoint, UseTransforms)); | 3080 layoutObject.localToAbsolute(layoutObjectPoint, UseTransforms)); |
3097 | 3081 |
3098 // Convert from page ("absolute") to FrameView coordinates. | 3082 // Convert from page ("absolute") to FrameView coordinates. |
3099 point.moveBy(-scrollPosition()); | 3083 point.moveBy(IntPoint(-scrollOffsetInt())); |
3100 return point; | 3084 return point; |
3101 } | 3085 } |
3102 | 3086 |
3103 IntPoint FrameView::convertToLayoutObject(const LayoutObject& layoutObject, | 3087 IntPoint FrameView::convertToLayoutObject(const LayoutObject& layoutObject, |
3104 const IntPoint& framePoint) const { | 3088 const IntPoint& framePoint) const { |
3105 IntPoint point = framePoint; | 3089 IntPoint point = framePoint; |
3106 | 3090 |
3107 // Convert from FrameView coords into page ("absolute") coordinates. | 3091 // Convert from FrameView coords into page ("absolute") coordinates. |
3108 point += IntSize(scrollX(), scrollY()); | 3092 point += IntSize(scrollX(), scrollY()); |
3109 | 3093 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3363 | 3347 |
3364 void FrameView::didAddScrollbar(Scrollbar& scrollbar, | 3348 void FrameView::didAddScrollbar(Scrollbar& scrollbar, |
3365 ScrollbarOrientation orientation) { | 3349 ScrollbarOrientation orientation) { |
3366 ScrollableArea::didAddScrollbar(scrollbar, orientation); | 3350 ScrollableArea::didAddScrollbar(scrollbar, orientation); |
3367 } | 3351 } |
3368 | 3352 |
3369 void FrameView::setTopControlsViewportAdjustment(float adjustment) { | 3353 void FrameView::setTopControlsViewportAdjustment(float adjustment) { |
3370 m_topControlsViewportAdjustment = adjustment; | 3354 m_topControlsViewportAdjustment = adjustment; |
3371 } | 3355 } |
3372 | 3356 |
3373 IntPoint FrameView::maximumScrollPosition() const { | 3357 IntSize FrameView::maximumScrollOffsetInt() const { |
3374 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() | 3358 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() |
3375 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/42 2331. | 3359 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/42 2331. |
3376 IntSize visibleSize = | 3360 IntSize visibleSize = |
3377 visibleContentSize(ExcludeScrollbars) + topControlsSize(); | 3361 visibleContentSize(ExcludeScrollbars) + topControlsSize(); |
3378 IntSize contentBounds = contentsSize(); | 3362 IntSize contentBounds = contentsSize(); |
3379 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); | 3363 IntSize maximumOffset = |
3380 return maximumPosition.expandedTo(minimumScrollPosition()); | 3364 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); |
3365 return maximumOffset.expandedTo(minimumScrollOffsetInt()); | |
3381 } | 3366 } |
3382 | 3367 |
3383 void FrameView::addChild(Widget* child) { | 3368 void FrameView::addChild(Widget* child) { |
3384 ASSERT(child != this && !child->parent()); | 3369 ASSERT(child != this && !child->parent()); |
3385 child->setParent(this); | 3370 child->setParent(this); |
3386 m_children.add(child); | 3371 m_children.add(child); |
3387 } | 3372 } |
3388 | 3373 |
3389 void FrameView::setHasHorizontalScrollbar(bool hasBar) { | 3374 void FrameView::setHasHorizontalScrollbar(bool hasBar) { |
3390 DCHECK(m_frame->settings()); | 3375 DCHECK(m_frame->settings()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3489 | 3474 |
3490 IntSize FrameView::visibleContentSize( | 3475 IntSize FrameView::visibleContentSize( |
3491 IncludeScrollbarsInRect scrollbarInclusion) const { | 3476 IncludeScrollbarsInRect scrollbarInclusion) const { |
3492 return scrollbarInclusion == ExcludeScrollbars | 3477 return scrollbarInclusion == ExcludeScrollbars |
3493 ? excludeScrollbars(frameRect().size()) | 3478 ? excludeScrollbars(frameRect().size()) |
3494 : frameRect().size(); | 3479 : frameRect().size(); |
3495 } | 3480 } |
3496 | 3481 |
3497 IntRect FrameView::visibleContentRect( | 3482 IntRect FrameView::visibleContentRect( |
3498 IncludeScrollbarsInRect scrollbarInclusion) const { | 3483 IncludeScrollbarsInRect scrollbarInclusion) const { |
3499 return IntRect(flooredIntPoint(m_scrollPosition), | 3484 return IntRect(IntPoint(flooredIntSize(m_scrollOffset)), |
3500 visibleContentSize(scrollbarInclusion)); | 3485 visibleContentSize(scrollbarInclusion)); |
3501 } | 3486 } |
3502 | 3487 |
3503 IntSize FrameView::contentsSize() const { | 3488 IntSize FrameView::contentsSize() const { |
3504 return m_contentsSize; | 3489 return m_contentsSize; |
3505 } | 3490 } |
3506 | 3491 |
3507 void FrameView::clipPaintRect(FloatRect* paintRect) const { | 3492 void FrameView::clipPaintRect(FloatRect* paintRect) const { |
3508 // Paint the whole rect if "mainFrameClipsContent" is false, meaning that | 3493 // Paint the whole rect if "mainFrameClipsContent" is false, meaning that |
3509 // WebPreferences::record_whole_document is true. | 3494 // WebPreferences::record_whole_document is true. |
3510 if (!m_frame->settings()->mainFrameClipsContent()) | 3495 if (!m_frame->settings()->mainFrameClipsContent()) |
3511 return; | 3496 return; |
3512 | 3497 |
3513 paintRect->intersect( | 3498 paintRect->intersect( |
3514 page()->chromeClient().visibleContentRectForPainting().value_or( | 3499 page()->chromeClient().visibleContentRectForPainting().value_or( |
3515 visibleContentRect())); | 3500 visibleContentRect())); |
3516 } | 3501 } |
3517 | 3502 |
3518 IntPoint FrameView::minimumScrollPosition() const { | 3503 IntSize FrameView::minimumScrollOffsetInt() const { |
3519 return IntPoint(-scrollOrigin().x(), -scrollOrigin().y()); | 3504 return IntSize(-scrollOrigin().x(), -scrollOrigin().y()); |
3520 } | 3505 } |
3521 | 3506 |
3522 void FrameView::adjustScrollbarOpacity() { | 3507 void FrameView::adjustScrollbarOpacity() { |
3523 if (m_horizontalScrollbar && layerForHorizontalScrollbar()) { | 3508 if (m_horizontalScrollbar && layerForHorizontalScrollbar()) { |
3524 bool isOpaqueScrollbar = !m_horizontalScrollbar->isOverlayScrollbar(); | 3509 bool isOpaqueScrollbar = !m_horizontalScrollbar->isOverlayScrollbar(); |
3525 layerForHorizontalScrollbar()->setContentsOpaque(isOpaqueScrollbar); | 3510 layerForHorizontalScrollbar()->setContentsOpaque(isOpaqueScrollbar); |
3526 } | 3511 } |
3527 if (m_verticalScrollbar && layerForVerticalScrollbar()) { | 3512 if (m_verticalScrollbar && layerForVerticalScrollbar()) { |
3528 bool isOpaqueScrollbar = !m_verticalScrollbar->isOverlayScrollbar(); | 3513 bool isOpaqueScrollbar = !m_verticalScrollbar->isOverlayScrollbar(); |
3529 layerForVerticalScrollbar()->setContentsOpaque(isOpaqueScrollbar); | 3514 layerForVerticalScrollbar()->setContentsOpaque(isOpaqueScrollbar); |
(...skipping 10 matching lines...) Expand all Loading... | |
3540 if (!scrollbar) { | 3525 if (!scrollbar) { |
3541 IntSize scrollSize = m_contentsSize - visibleContentRect().size(); | 3526 IntSize scrollSize = m_contentsSize - visibleContentRect().size(); |
3542 scrollSize.clampNegativeToZero(); | 3527 scrollSize.clampNegativeToZero(); |
3543 return orientation == HorizontalScrollbar ? scrollSize.width() | 3528 return orientation == HorizontalScrollbar ? scrollSize.width() |
3544 : scrollSize.height(); | 3529 : scrollSize.height(); |
3545 } | 3530 } |
3546 | 3531 |
3547 return scrollbar->totalSize() - scrollbar->visibleSize(); | 3532 return scrollbar->totalSize() - scrollbar->visibleSize(); |
3548 } | 3533 } |
3549 | 3534 |
3550 void FrameView::updateScrollPosition(const DoublePoint& position, | 3535 void FrameView::updateScrollOffset(const ScrollOffset& offset, |
3551 ScrollType scrollType) { | 3536 ScrollType scrollType) { |
3552 DoublePoint newPosition = clampScrollPosition(position); | 3537 ScrollOffset oldOffset = m_scrollOffset; |
bokan
2016/10/02 19:47:50
No need for the oldOffset var here, just use it in
szager1
2016/10/05 07:43:36
Done.
| |
3553 | 3538 ScrollOffset scrollDelta = offset - oldOffset; |
3554 DoublePoint oldPosition = m_scrollPosition; | |
3555 DoubleSize scrollDelta = newPosition - oldPosition; | |
3556 if (scrollDelta.isZero()) | 3539 if (scrollDelta.isZero()) |
3557 return; | 3540 return; |
3558 | 3541 |
3559 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 3542 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
3560 // Don't scroll the FrameView! | 3543 // Don't scroll the FrameView! |
3561 ASSERT_NOT_REACHED(); | 3544 ASSERT_NOT_REACHED(); |
3562 } | 3545 } |
3563 | 3546 |
3564 m_scrollPosition = newPosition; | 3547 m_scrollOffset = offset; |
3565 | 3548 |
3566 if (!scrollbarsSuppressed()) | 3549 if (!scrollbarsSuppressed()) |
3567 m_pendingScrollDelta += scrollDelta; | 3550 m_pendingScrollDelta += scrollDelta; |
3568 | 3551 |
3569 clearFragmentAnchor(); | 3552 clearFragmentAnchor(); |
3570 updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta); | 3553 updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta); |
3571 | 3554 |
3572 Document* document = m_frame->document(); | 3555 Document* document = m_frame->document(); |
3573 document->enqueueScrollEventForNode(document); | 3556 document->enqueueScrollEventForNode(document); |
3574 | 3557 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3810 void FrameView::updateScrollbars() { | 3793 void FrameView::updateScrollbars() { |
3811 m_needsScrollbarsUpdate = false; | 3794 m_needsScrollbarsUpdate = false; |
3812 | 3795 |
3813 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 3796 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
3814 return; | 3797 return; |
3815 | 3798 |
3816 // Avoid drawing two sets of scrollbars when visual viewport is enabled. | 3799 // Avoid drawing two sets of scrollbars when visual viewport is enabled. |
3817 if (visualViewportSuppliesScrollbars()) { | 3800 if (visualViewportSuppliesScrollbars()) { |
3818 setHasHorizontalScrollbar(false); | 3801 setHasHorizontalScrollbar(false); |
3819 setHasVerticalScrollbar(false); | 3802 setHasVerticalScrollbar(false); |
3820 adjustScrollPositionFromUpdateScrollbars(); | 3803 adjustScrollOffsetFromUpdateScrollbars(); |
3821 return; | 3804 return; |
3822 } | 3805 } |
3823 | 3806 |
3824 if (m_inUpdateScrollbars) | 3807 if (m_inUpdateScrollbars) |
3825 return; | 3808 return; |
3826 InUpdateScrollbarsScope inUpdateScrollbarsScope(this); | 3809 InUpdateScrollbarsScope inUpdateScrollbarsScope(this); |
3827 | 3810 |
3828 bool scrollbarExistenceChanged = false; | 3811 bool scrollbarExistenceChanged = false; |
3829 | 3812 |
3830 if (needsScrollbarReconstruction()) { | 3813 if (needsScrollbarReconstruction()) { |
(...skipping 14 matching lines...) Expand all Loading... | |
3845 | 3828 |
3846 updateScrollbarGeometry(); | 3829 updateScrollbarGeometry(); |
3847 | 3830 |
3848 if (scrollbarExistenceChanged) { | 3831 if (scrollbarExistenceChanged) { |
3849 // FIXME: Is frameRectsChanged really necessary here? Have any frame rects c hanged? | 3832 // FIXME: Is frameRectsChanged really necessary here? Have any frame rects c hanged? |
3850 frameRectsChanged(); | 3833 frameRectsChanged(); |
3851 positionScrollbarLayers(); | 3834 positionScrollbarLayers(); |
3852 updateScrollCorner(); | 3835 updateScrollCorner(); |
3853 } | 3836 } |
3854 | 3837 |
3855 adjustScrollPositionFromUpdateScrollbars(); | 3838 adjustScrollOffsetFromUpdateScrollbars(); |
3856 } | 3839 } |
3857 | 3840 |
3858 void FrameView::adjustScrollPositionFromUpdateScrollbars() { | 3841 void FrameView::adjustScrollOffsetFromUpdateScrollbars() { |
3859 DoublePoint clamped = clampScrollPosition(scrollPositionDouble()); | 3842 ScrollOffset clamped = clampScrollOffset(scrollOffset()); |
3860 // Restore before clamping because clamping clears the scroll anchor. | 3843 // Restore before clamping because clamping clears the scroll anchor. |
3861 // TODO(ymalik): This same logic exists in PaintLayerScrollableArea. | 3844 // TODO(ymalik): This same logic exists in PaintLayerScrollableArea. |
3862 // Remove when root-layer-scrolls is enabled. | 3845 // Remove when root-layer-scrolls is enabled. |
3863 if (clamped != scrollPositionDouble() && shouldPerformScrollAnchoring()) { | 3846 if (clamped != scrollOffset() && shouldPerformScrollAnchoring()) { |
3864 m_scrollAnchor.restore(); | 3847 m_scrollAnchor.restore(); |
3865 clamped = clampScrollPosition(scrollPositionDouble()); | 3848 clamped = clampScrollOffset(scrollOffset()); |
3866 } | 3849 } |
3867 if (clamped != scrollPositionDouble() || scrollOriginChanged()) { | 3850 if (clamped != scrollOffset() || scrollOriginChanged()) { |
3868 ScrollableArea::setScrollPosition(clamped, ProgrammaticScroll); | 3851 ScrollableArea::setScrollOffset(clamped, ProgrammaticScroll); |
3869 resetScrollOriginChanged(); | 3852 resetScrollOriginChanged(); |
3870 } | 3853 } |
3871 } | 3854 } |
3872 | 3855 |
3873 void FrameView::scrollContentsIfNeeded() { | 3856 void FrameView::scrollContentsIfNeeded() { |
3874 if (m_pendingScrollDelta.isZero()) | 3857 if (m_pendingScrollDelta.isZero()) |
3875 return; | 3858 return; |
3876 DoubleSize scrollDelta = m_pendingScrollDelta; | 3859 ScrollOffset scrollDelta = m_pendingScrollDelta; |
3877 m_pendingScrollDelta = DoubleSize(); | 3860 m_pendingScrollDelta = ScrollOffset(); |
3878 // FIXME: Change scrollContents() to take DoubleSize. crbug.com/414283. | 3861 // FIXME: Change scrollContents() to take DoubleSize. crbug.com/414283. |
3879 scrollContents(flooredIntSize(scrollDelta)); | 3862 scrollContents(flooredIntSize(scrollDelta)); |
3880 } | 3863 } |
3881 | 3864 |
3882 void FrameView::scrollContents(const IntSize& scrollDelta) { | 3865 void FrameView::scrollContents(const IntSize& scrollDelta) { |
3883 HostWindow* window = getHostWindow(); | 3866 HostWindow* window = getHostWindow(); |
3884 if (!window) | 3867 if (!window) |
3885 return; | 3868 return; |
3886 | 3869 |
3887 TRACE_EVENT0("blink", "FrameView::scrollContents"); | 3870 TRACE_EVENT0("blink", "FrameView::scrollContents"); |
3888 | 3871 |
3889 if (!scrollContentsFastPath(-scrollDelta)) | 3872 if (!scrollContentsFastPath(-scrollDelta)) |
3890 scrollContentsSlowPath(); | 3873 scrollContentsSlowPath(); |
3891 | 3874 |
3892 // This call will move children with native widgets (plugins) and invalidate t hem as well. | 3875 // This call will move children with native widgets (plugins) and invalidate t hem as well. |
3893 frameRectsChanged(); | 3876 frameRectsChanged(); |
3894 } | 3877 } |
3895 | 3878 |
3896 IntPoint FrameView::contentsToFrame(const IntPoint& pointInContentSpace) const { | 3879 IntPoint FrameView::contentsToFrame(const IntPoint& pointInContentSpace) const { |
3897 return pointInContentSpace - scrollOffset(); | 3880 return pointInContentSpace - scrollOffsetInt(); |
3898 } | 3881 } |
3899 | 3882 |
3900 IntRect FrameView::contentsToFrame(const IntRect& rectInContentSpace) const { | 3883 IntRect FrameView::contentsToFrame(const IntRect& rectInContentSpace) const { |
3901 return IntRect(contentsToFrame(rectInContentSpace.location()), | 3884 return IntRect(contentsToFrame(rectInContentSpace.location()), |
3902 rectInContentSpace.size()); | 3885 rectInContentSpace.size()); |
3903 } | 3886 } |
3904 | 3887 |
3905 FloatPoint FrameView::frameToContents(const FloatPoint& pointInFrame) const { | 3888 FloatPoint FrameView::frameToContents(const FloatPoint& pointInFrame) const { |
3906 return pointInFrame + scrollOffset(); | 3889 return pointInFrame + scrollOffset(); |
3907 } | 3890 } |
3908 | 3891 |
3909 IntPoint FrameView::frameToContents(const IntPoint& pointInFrame) const { | 3892 IntPoint FrameView::frameToContents(const IntPoint& pointInFrame) const { |
3910 return pointInFrame + scrollOffset(); | 3893 return pointInFrame + scrollOffsetInt(); |
3911 } | 3894 } |
3912 | 3895 |
3913 IntRect FrameView::frameToContents(const IntRect& rectInFrame) const { | 3896 IntRect FrameView::frameToContents(const IntRect& rectInFrame) const { |
3914 return IntRect(frameToContents(rectInFrame.location()), rectInFrame.size()); | 3897 return IntRect(frameToContents(rectInFrame.location()), rectInFrame.size()); |
3915 } | 3898 } |
3916 | 3899 |
3917 IntPoint FrameView::rootFrameToContents(const IntPoint& rootFramePoint) const { | 3900 IntPoint FrameView::rootFrameToContents(const IntPoint& rootFramePoint) const { |
3918 IntPoint framePoint = convertFromRootFrame(rootFramePoint); | 3901 IntPoint framePoint = convertFromRootFrame(rootFramePoint); |
3919 return frameToContents(framePoint); | 3902 return frameToContents(framePoint); |
3920 } | 3903 } |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4087 return this; | 4070 return this; |
4088 } | 4071 } |
4089 | 4072 |
4090 LayoutRect FrameView::scrollIntoView(const LayoutRect& rectInContent, | 4073 LayoutRect FrameView::scrollIntoView(const LayoutRect& rectInContent, |
4091 const ScrollAlignment& alignX, | 4074 const ScrollAlignment& alignX, |
4092 const ScrollAlignment& alignY, | 4075 const ScrollAlignment& alignY, |
4093 ScrollType scrollType) { | 4076 ScrollType scrollType) { |
4094 LayoutRect viewRect(visibleContentRect()); | 4077 LayoutRect viewRect(visibleContentRect()); |
4095 LayoutRect exposeRect = | 4078 LayoutRect exposeRect = |
4096 ScrollAlignment::getRectToExpose(viewRect, rectInContent, alignX, alignY); | 4079 ScrollAlignment::getRectToExpose(viewRect, rectInContent, alignX, alignY); |
4097 if (exposeRect != viewRect) | 4080 if (exposeRect != viewRect) { |
4098 setScrollPosition(DoublePoint(exposeRect.x(), exposeRect.y()), scrollType); | 4081 setScrollOffset( |
4082 ScrollOffset(exposeRect.x().toFloat(), exposeRect.y().toFloat()), | |
4083 scrollType); | |
4084 } | |
4099 | 4085 |
4100 // Scrolling the FrameView cannot change the input rect's location relative to the document. | 4086 // Scrolling the FrameView cannot change the input rect's location relative to the document. |
4101 return rectInContent; | 4087 return rectInContent; |
4102 } | 4088 } |
4103 | 4089 |
4104 IntRect FrameView::scrollCornerRect() const { | 4090 IntRect FrameView::scrollCornerRect() const { |
4105 IntRect cornerRect; | 4091 IntRect cornerRect; |
4106 | 4092 |
4107 if (hasOverlayScrollbars()) | 4093 if (hasOverlayScrollbars()) |
4108 return cornerRect; | 4094 return cornerRect; |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4503 } | 4489 } |
4504 | 4490 |
4505 bool FrameView::canThrottleRendering() const { | 4491 bool FrameView::canThrottleRendering() const { |
4506 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) | 4492 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) |
4507 return false; | 4493 return false; |
4508 return m_subtreeThrottled || | 4494 return m_subtreeThrottled || |
4509 (m_hiddenForThrottling && m_crossOriginForThrottling); | 4495 (m_hiddenForThrottling && m_crossOriginForThrottling); |
4510 } | 4496 } |
4511 | 4497 |
4512 } // namespace blink | 4498 } // namespace blink |
OLD | NEW |