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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 if (!m_scrollAnchor.hasScroller()) | 822 if (!m_scrollAnchor.hasScroller()) |
823 m_scrollAnchor.setScroller(m_viewportScrollableArea ? m_viewportScrollab
leArea : this); | 823 m_scrollAnchor.setScroller(m_viewportScrollableArea ? m_viewportScrollab
leArea : this); |
824 | 824 |
825 if (shouldPerformScrollAnchoring()) | 825 if (shouldPerformScrollAnchoring()) |
826 m_scrollAnchor.save(); | 826 m_scrollAnchor.save(); |
827 } | 827 } |
828 | 828 |
829 bool FrameView::shouldPerformScrollAnchoring() const | 829 bool FrameView::shouldPerformScrollAnchoring() const |
830 { | 830 { |
831 return RuntimeEnabledFeatures::scrollAnchoringEnabled() | 831 return RuntimeEnabledFeatures::scrollAnchoringEnabled() |
832 && m_frame->settings() && !m_frame->settings()->rootLayerScrolls() | 832 && !RuntimeEnabledFeatures::rootLayerScrollingEnabled() |
833 && m_scrollAnchor.hasScroller() | 833 && m_scrollAnchor.hasScroller() |
834 && layoutBox()->style()->overflowAnchor() != AnchorNone; | 834 && layoutBox()->style()->overflowAnchor() != AnchorNone; |
835 } | 835 } |
836 | 836 |
837 static inline void layoutFromRootObject(LayoutObject& root) | 837 static inline void layoutFromRootObject(LayoutObject& root) |
838 { | 838 { |
839 LayoutState layoutState(root); | 839 LayoutState layoutState(root); |
840 root.layout(); | 840 root.layout(); |
841 } | 841 } |
842 | 842 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 #if ENABLE(ASSERT) | 1126 #if ENABLE(ASSERT) |
1127 layoutView()->assertSubtreeClearedPaintInvalidationFlags(); | 1127 layoutView()->assertSubtreeClearedPaintInvalidationFlags(); |
1128 #endif | 1128 #endif |
1129 | 1129 |
1130 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); | 1130 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); |
1131 } | 1131 } |
1132 | 1132 |
1133 void FrameView::invalidatePaintIfNeeded(const PaintInvalidationState& paintInval
idationState) | 1133 void FrameView::invalidatePaintIfNeeded(const PaintInvalidationState& paintInval
idationState) |
1134 { | 1134 { |
1135 RELEASE_ASSERT(!layoutViewItem().isNull()); | 1135 RELEASE_ASSERT(!layoutViewItem().isNull()); |
1136 if (!m_frame->settings() || !m_frame->settings()->rootLayerScrolls()) | 1136 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
1137 invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState); | 1137 invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState); |
1138 | 1138 |
1139 if (m_frame->selection().isCaretBoundsDirty()) | 1139 if (m_frame->selection().isCaretBoundsDirty()) |
1140 m_frame->selection().invalidateCaretRect(); | 1140 m_frame->selection().invalidateCaretRect(); |
1141 | 1141 |
1142 // Temporary callback for crbug.com/487345,402044 | 1142 // Temporary callback for crbug.com/487345,402044 |
1143 // TODO(ojan): Make this more general to be used by PositionObserver | 1143 // TODO(ojan): Make this more general to be used by PositionObserver |
1144 // and rAF throttling. | 1144 // and rAF throttling. |
1145 IntRect visibleRect = rootFrameToContents(computeVisibleArea()); | 1145 IntRect visibleRect = rootFrameToContents(computeVisibleArea()); |
1146 layoutViewItem().sendMediaPositionChangeNotifications(visibleRect); | 1146 layoutViewItem().sendMediaPositionChangeNotifications(visibleRect); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 | 1350 |
1351 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1351 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
1352 scrollingCoordinator->frameViewFixedObjectsDidChange(this); | 1352 scrollingCoordinator->frameViewFixedObjectsDidChange(this); |
1353 } | 1353 } |
1354 } | 1354 } |
1355 | 1355 |
1356 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) | 1356 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) |
1357 { | 1357 { |
1358 DCHECK(widthChanged || heightChanged); | 1358 DCHECK(widthChanged || heightChanged); |
1359 | 1359 |
1360 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) { | 1360 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
1361 // The background must be repainted when the FrameView is resized, even
if the initial | 1361 // The background must be repainted when the FrameView is resized, even
if the initial |
1362 // containing block does not change (so we can't rely on layout to issue
the invalidation). | 1362 // containing block does not change (so we can't rely on layout to issue
the invalidation). |
1363 // This is because the background fills the main GraphicsLayer, which ta
kes the size of the | 1363 // This is because the background fills the main GraphicsLayer, which ta
kes the size of the |
1364 // layout viewport. | 1364 // layout viewport. |
1365 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents
layer and avoid | 1365 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents
layer and avoid |
1366 // this invalidation (http://crbug.com/568847). | 1366 // this invalidation (http://crbug.com/568847). |
1367 LayoutViewItem lvi = layoutViewItem(); | 1367 LayoutViewItem lvi = layoutViewItem(); |
1368 if (!lvi.isNull()) | 1368 if (!lvi.isNull()) |
1369 lvi.setShouldDoFullPaintInvalidation(); | 1369 lvi.setShouldDoFullPaintInvalidation(); |
1370 } | 1370 } |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2009 | 2009 |
2010 // Scrolling is disabled during updateScrollbars (see isProgrammaticallyScro
llable). | 2010 // Scrolling is disabled during updateScrollbars (see isProgrammaticallyScro
llable). |
2011 // Bail now to avoid clearing m_fragmentAnchor before we actually have a cha
nce to scroll. | 2011 // Bail now to avoid clearing m_fragmentAnchor before we actually have a cha
nce to scroll. |
2012 if (m_inUpdateScrollbars) | 2012 if (m_inUpdateScrollbars) |
2013 return; | 2013 return; |
2014 | 2014 |
2015 if (anchorNode->layoutObject()) { | 2015 if (anchorNode->layoutObject()) { |
2016 LayoutRect rect; | 2016 LayoutRect rect; |
2017 if (anchorNode != m_frame->document()) { | 2017 if (anchorNode != m_frame->document()) { |
2018 rect = anchorNode->boundingBox(); | 2018 rect = anchorNode->boundingBox(); |
2019 } else if (m_frame->settings() && m_frame->settings()->rootLayerScrolls(
)) { | 2019 } else if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
2020 if (Element* documentElement = m_frame->document()->documentElement(
)) | 2020 if (Element* documentElement = m_frame->document()->documentElement(
)) |
2021 rect = documentElement->boundingBox(); | 2021 rect = documentElement->boundingBox(); |
2022 } | 2022 } |
2023 | 2023 |
2024 Frame* boundaryFrame = m_frame->findUnsafeParentScrollPropagationBoundar
y(); | 2024 Frame* boundaryFrame = m_frame->findUnsafeParentScrollPropagationBoundar
y(); |
2025 | 2025 |
2026 // FIXME: Handle RemoteFrames | 2026 // FIXME: Handle RemoteFrames |
2027 if (boundaryFrame && boundaryFrame->isLocalFrame()) | 2027 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
2028 toLocalFrame(boundaryFrame)->view()->setSafeToPropagateScrollToParen
t(false); | 2028 toLocalFrame(boundaryFrame)->view()->setSafeToPropagateScrollToParen
t(false); |
2029 | 2029 |
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3402 { | 3402 { |
3403 // TODO(skobes): We shouldn't have to clamp here; instead we should update c
allers | 3403 // TODO(skobes): We shouldn't have to clamp here; instead we should update c
allers |
3404 // ScrollableArea::scrollPositionChanged to only pass clamped offsets. | 3404 // ScrollableArea::scrollPositionChanged to only pass clamped offsets. |
3405 DoublePoint newPosition = clampScrollPosition(offset); | 3405 DoublePoint newPosition = clampScrollPosition(offset); |
3406 | 3406 |
3407 DoublePoint oldPosition = m_scrollPosition; | 3407 DoublePoint oldPosition = m_scrollPosition; |
3408 DoubleSize scrollDelta = newPosition - oldPosition; | 3408 DoubleSize scrollDelta = newPosition - oldPosition; |
3409 if (scrollDelta.isZero()) | 3409 if (scrollDelta.isZero()) |
3410 return; | 3410 return; |
3411 | 3411 |
3412 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) { | 3412 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
3413 // Don't scroll the FrameView! | 3413 // Don't scroll the FrameView! |
3414 ASSERT_NOT_REACHED(); | 3414 ASSERT_NOT_REACHED(); |
3415 } | 3415 } |
3416 | 3416 |
3417 m_scrollPosition = newPosition; | 3417 m_scrollPosition = newPosition; |
3418 | 3418 |
3419 if (!scrollbarsSuppressed()) | 3419 if (!scrollbarsSuppressed()) |
3420 m_pendingScrollDelta += scrollDelta; | 3420 m_pendingScrollDelta += scrollDelta; |
3421 | 3421 |
3422 clearFragmentAnchor(); | 3422 clearFragmentAnchor(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3475 } | 3475 } |
3476 | 3476 |
3477 void FrameView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool&
newHasVerticalScrollbar, const IntSize& docSize, ComputeScrollbarExistenceOptio
n option) const | 3477 void FrameView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool&
newHasVerticalScrollbar, const IntSize& docSize, ComputeScrollbarExistenceOptio
n option) const |
3478 { | 3478 { |
3479 bool hasHorizontalScrollbar = m_horizontalScrollbar; | 3479 bool hasHorizontalScrollbar = m_horizontalScrollbar; |
3480 bool hasVerticalScrollbar = m_verticalScrollbar; | 3480 bool hasVerticalScrollbar = m_verticalScrollbar; |
3481 | 3481 |
3482 newHasHorizontalScrollbar = hasHorizontalScrollbar; | 3482 newHasHorizontalScrollbar = hasHorizontalScrollbar; |
3483 newHasVerticalScrollbar = hasVerticalScrollbar; | 3483 newHasVerticalScrollbar = hasVerticalScrollbar; |
3484 | 3484 |
3485 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) | 3485 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
3486 return; | 3486 return; |
3487 | 3487 |
3488 ScrollbarMode hScroll = m_horizontalScrollbarMode; | 3488 ScrollbarMode hScroll = m_horizontalScrollbarMode; |
3489 ScrollbarMode vScroll = m_verticalScrollbarMode; | 3489 ScrollbarMode vScroll = m_verticalScrollbarMode; |
3490 | 3490 |
3491 if (hScroll != ScrollbarAuto) | 3491 if (hScroll != ScrollbarAuto) |
3492 newHasHorizontalScrollbar = (hScroll == ScrollbarAlwaysOn); | 3492 newHasHorizontalScrollbar = (hScroll == ScrollbarAlwaysOn); |
3493 if (vScroll != ScrollbarAuto) | 3493 if (vScroll != ScrollbarAuto) |
3494 newHasVerticalScrollbar = (vScroll == ScrollbarAlwaysOn); | 3494 newHasVerticalScrollbar = (vScroll == ScrollbarAlwaysOn); |
3495 | 3495 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3638 void FrameView::updateScrollbarsIfNeeded() | 3638 void FrameView::updateScrollbarsIfNeeded() |
3639 { | 3639 { |
3640 if (m_needsScrollbarsUpdate || needsScrollbarReconstruction() || scrollOrigi
nChanged()) | 3640 if (m_needsScrollbarsUpdate || needsScrollbarReconstruction() || scrollOrigi
nChanged()) |
3641 updateScrollbars(); | 3641 updateScrollbars(); |
3642 } | 3642 } |
3643 | 3643 |
3644 void FrameView::updateScrollbars() | 3644 void FrameView::updateScrollbars() |
3645 { | 3645 { |
3646 m_needsScrollbarsUpdate = false; | 3646 m_needsScrollbarsUpdate = false; |
3647 | 3647 |
3648 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) | 3648 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
3649 return; | 3649 return; |
3650 | 3650 |
3651 // Avoid drawing two sets of scrollbars when visual viewport is enabled. | 3651 // Avoid drawing two sets of scrollbars when visual viewport is enabled. |
3652 if (visualViewportSuppliesScrollbars()) { | 3652 if (visualViewportSuppliesScrollbars()) { |
3653 setHasHorizontalScrollbar(false); | 3653 setHasHorizontalScrollbar(false); |
3654 setHasVerticalScrollbar(false); | 3654 setHasVerticalScrollbar(false); |
3655 adjustScrollPositionFromUpdateScrollbars(); | 3655 adjustScrollPositionFromUpdateScrollbars(); |
3656 return; | 3656 return; |
3657 } | 3657 } |
3658 | 3658 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3902 positionScrollCornerLayer(layerForScrollCorner(), scrollCornerRect()); | 3902 positionScrollCornerLayer(layerForScrollCorner(), scrollCornerRect()); |
3903 } | 3903 } |
3904 | 3904 |
3905 bool FrameView::userInputScrollable(ScrollbarOrientation orientation) const | 3905 bool FrameView::userInputScrollable(ScrollbarOrientation orientation) const |
3906 { | 3906 { |
3907 Document* document = frame().document(); | 3907 Document* document = frame().document(); |
3908 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(*document); | 3908 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(*document); |
3909 if (fullscreenElement && fullscreenElement != document->documentElement()) | 3909 if (fullscreenElement && fullscreenElement != document->documentElement()) |
3910 return false; | 3910 return false; |
3911 | 3911 |
3912 if (frame().settings() && frame().settings()->rootLayerScrolls()) | 3912 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
3913 return false; | 3913 return false; |
3914 | 3914 |
3915 ScrollbarMode mode = (orientation == HorizontalScrollbar) ? | 3915 ScrollbarMode mode = (orientation == HorizontalScrollbar) ? |
3916 m_horizontalScrollbarMode : m_verticalScrollbarMode; | 3916 m_horizontalScrollbarMode : m_verticalScrollbarMode; |
3917 | 3917 |
3918 return mode == ScrollbarAuto || mode == ScrollbarAlwaysOn; | 3918 return mode == ScrollbarAuto || mode == ScrollbarAlwaysOn; |
3919 } | 3919 } |
3920 | 3920 |
3921 bool FrameView::shouldPlaceVerticalScrollbarOnLeft() const | 3921 bool FrameView::shouldPlaceVerticalScrollbarOnLeft() const |
3922 { | 3922 { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4116 ScrollableArea* FrameView::getScrollableArea() | 4116 ScrollableArea* FrameView::getScrollableArea() |
4117 { | 4117 { |
4118 if (m_viewportScrollableArea) | 4118 if (m_viewportScrollableArea) |
4119 return m_viewportScrollableArea.get(); | 4119 return m_viewportScrollableArea.get(); |
4120 | 4120 |
4121 return layoutViewportScrollableArea(); | 4121 return layoutViewportScrollableArea(); |
4122 } | 4122 } |
4123 | 4123 |
4124 ScrollableArea* FrameView::layoutViewportScrollableArea() | 4124 ScrollableArea* FrameView::layoutViewportScrollableArea() |
4125 { | 4125 { |
4126 Settings* settings = frame().settings(); | 4126 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
4127 if (!settings || !settings->rootLayerScrolls()) | |
4128 return this; | 4127 return this; |
4129 | 4128 |
4130 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 4129 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
4131 return layoutViewItem.isNull() ? nullptr : layoutViewItem.getScrollableArea(
); | 4130 return layoutViewItem.isNull() ? nullptr : layoutViewItem.getScrollableArea(
); |
4132 } | 4131 } |
4133 | 4132 |
4134 LayoutObject* FrameView::viewportLayoutObject() const | 4133 LayoutObject* FrameView::viewportLayoutObject() const |
4135 { | 4134 { |
4136 if (Document* document = frame().document()) { | 4135 if (Document* document = frame().document()) { |
4137 if (Element* element = document->viewportDefiningElement()) | 4136 if (Element* element = document->viewportDefiningElement()) |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4308 } | 4307 } |
4309 | 4308 |
4310 bool FrameView::canThrottleRendering() const | 4309 bool FrameView::canThrottleRendering() const |
4311 { | 4310 { |
4312 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) | 4311 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) |
4313 return false; | 4312 return false; |
4314 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); | 4313 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); |
4315 } | 4314 } |
4316 | 4315 |
4317 } // namespace blink | 4316 } // namespace blink |
OLD | NEW |