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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 m_scrollAnchor.setScroller(scroller); | 839 m_scrollAnchor.setScroller(scroller); |
840 } | 840 } |
841 | 841 |
842 if (shouldPerformScrollAnchoring()) | 842 if (shouldPerformScrollAnchoring()) |
843 m_scrollAnchor.save(); | 843 m_scrollAnchor.save(); |
844 } | 844 } |
845 | 845 |
846 bool FrameView::shouldPerformScrollAnchoring() const | 846 bool FrameView::shouldPerformScrollAnchoring() const |
847 { | 847 { |
848 return RuntimeEnabledFeatures::scrollAnchoringEnabled() | 848 return RuntimeEnabledFeatures::scrollAnchoringEnabled() |
849 && m_frame->settings() && !m_frame->settings()->rootLayerScrolls() | 849 && !RuntimeEnabledFeatures::rootLayerScrollingEnabled() |
850 && m_scrollAnchor.hasScroller() | 850 && m_scrollAnchor.hasScroller() |
851 && layoutBox()->style()->overflowAnchor() != AnchorNone; | 851 && layoutBox()->style()->overflowAnchor() != AnchorNone; |
852 } | 852 } |
853 | 853 |
854 static inline void layoutFromRootObject(LayoutObject& root) | 854 static inline void layoutFromRootObject(LayoutObject& root) |
855 { | 855 { |
856 LayoutState layoutState(root); | 856 LayoutState layoutState(root); |
857 root.layout(); | 857 root.layout(); |
858 } | 858 } |
859 | 859 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 #if ENABLE(ASSERT) | 1143 #if ENABLE(ASSERT) |
1144 layoutView()->assertSubtreeClearedPaintInvalidationFlags(); | 1144 layoutView()->assertSubtreeClearedPaintInvalidationFlags(); |
1145 #endif | 1145 #endif |
1146 | 1146 |
1147 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); | 1147 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); |
1148 } | 1148 } |
1149 | 1149 |
1150 void FrameView::invalidatePaintIfNeeded(const PaintInvalidationState& paintInval
idationState) | 1150 void FrameView::invalidatePaintIfNeeded(const PaintInvalidationState& paintInval
idationState) |
1151 { | 1151 { |
1152 RELEASE_ASSERT(!layoutViewItem().isNull()); | 1152 RELEASE_ASSERT(!layoutViewItem().isNull()); |
1153 if (!m_frame->settings() || !m_frame->settings()->rootLayerScrolls()) | 1153 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
1154 invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState); | 1154 invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState); |
1155 | 1155 |
1156 if (m_frame->selection().isCaretBoundsDirty()) | 1156 if (m_frame->selection().isCaretBoundsDirty()) |
1157 m_frame->selection().invalidateCaretRect(); | 1157 m_frame->selection().invalidateCaretRect(); |
1158 | 1158 |
1159 // Temporary callback for crbug.com/487345,402044 | 1159 // Temporary callback for crbug.com/487345,402044 |
1160 // TODO(ojan): Make this more general to be used by PositionObserver | 1160 // TODO(ojan): Make this more general to be used by PositionObserver |
1161 // and rAF throttling. | 1161 // and rAF throttling. |
1162 IntRect visibleRect = rootFrameToContents(computeVisibleArea()); | 1162 IntRect visibleRect = rootFrameToContents(computeVisibleArea()); |
1163 layoutViewItem().sendMediaPositionChangeNotifications(visibleRect); | 1163 layoutViewItem().sendMediaPositionChangeNotifications(visibleRect); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 | 1367 |
1368 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1368 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
1369 scrollingCoordinator->frameViewFixedObjectsDidChange(this); | 1369 scrollingCoordinator->frameViewFixedObjectsDidChange(this); |
1370 } | 1370 } |
1371 } | 1371 } |
1372 | 1372 |
1373 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) | 1373 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) |
1374 { | 1374 { |
1375 DCHECK(widthChanged || heightChanged); | 1375 DCHECK(widthChanged || heightChanged); |
1376 | 1376 |
1377 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) { | 1377 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
1378 // The background must be repainted when the FrameView is resized, even
if the initial | 1378 // The background must be repainted when the FrameView is resized, even
if the initial |
1379 // containing block does not change (so we can't rely on layout to issue
the invalidation). | 1379 // containing block does not change (so we can't rely on layout to issue
the invalidation). |
1380 // This is because the background fills the main GraphicsLayer, which ta
kes the size of the | 1380 // This is because the background fills the main GraphicsLayer, which ta
kes the size of the |
1381 // layout viewport. | 1381 // layout viewport. |
1382 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents
layer and avoid | 1382 // TODO(skobes): Paint non-fixed backgrounds into the scrolling contents
layer and avoid |
1383 // this invalidation (http://crbug.com/568847). | 1383 // this invalidation (http://crbug.com/568847). |
1384 LayoutViewItem lvi = layoutViewItem(); | 1384 LayoutViewItem lvi = layoutViewItem(); |
1385 if (!lvi.isNull()) | 1385 if (!lvi.isNull()) |
1386 lvi.setShouldDoFullPaintInvalidation(); | 1386 lvi.setShouldDoFullPaintInvalidation(); |
1387 } | 1387 } |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 | 2030 |
2031 // Scrolling is disabled during updateScrollbars (see isProgrammaticallyScro
llable). | 2031 // Scrolling is disabled during updateScrollbars (see isProgrammaticallyScro
llable). |
2032 // Bail now to avoid clearing m_fragmentAnchor before we actually have a cha
nce to scroll. | 2032 // Bail now to avoid clearing m_fragmentAnchor before we actually have a cha
nce to scroll. |
2033 if (m_inUpdateScrollbars) | 2033 if (m_inUpdateScrollbars) |
2034 return; | 2034 return; |
2035 | 2035 |
2036 if (anchorNode->layoutObject()) { | 2036 if (anchorNode->layoutObject()) { |
2037 LayoutRect rect; | 2037 LayoutRect rect; |
2038 if (anchorNode != m_frame->document()) { | 2038 if (anchorNode != m_frame->document()) { |
2039 rect = anchorNode->boundingBox(); | 2039 rect = anchorNode->boundingBox(); |
2040 } else if (m_frame->settings() && m_frame->settings()->rootLayerScrolls(
)) { | 2040 } else if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
2041 if (Element* documentElement = m_frame->document()->documentElement(
)) | 2041 if (Element* documentElement = m_frame->document()->documentElement(
)) |
2042 rect = documentElement->boundingBox(); | 2042 rect = documentElement->boundingBox(); |
2043 } | 2043 } |
2044 | 2044 |
2045 Frame* boundaryFrame = m_frame->findUnsafeParentScrollPropagationBoundar
y(); | 2045 Frame* boundaryFrame = m_frame->findUnsafeParentScrollPropagationBoundar
y(); |
2046 | 2046 |
2047 // FIXME: Handle RemoteFrames | 2047 // FIXME: Handle RemoteFrames |
2048 if (boundaryFrame && boundaryFrame->isLocalFrame()) | 2048 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
2049 toLocalFrame(boundaryFrame)->view()->setSafeToPropagateScrollToParen
t(false); | 2049 toLocalFrame(boundaryFrame)->view()->setSafeToPropagateScrollToParen
t(false); |
2050 | 2050 |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3412 { | 3412 { |
3413 // TODO(skobes): We shouldn't have to clamp here; instead we should update c
allers | 3413 // TODO(skobes): We shouldn't have to clamp here; instead we should update c
allers |
3414 // ScrollableArea::scrollPositionChanged to only pass clamped offsets. | 3414 // ScrollableArea::scrollPositionChanged to only pass clamped offsets. |
3415 DoublePoint newPosition = clampScrollPosition(offset); | 3415 DoublePoint newPosition = clampScrollPosition(offset); |
3416 | 3416 |
3417 DoublePoint oldPosition = m_scrollPosition; | 3417 DoublePoint oldPosition = m_scrollPosition; |
3418 DoubleSize scrollDelta = newPosition - oldPosition; | 3418 DoubleSize scrollDelta = newPosition - oldPosition; |
3419 if (scrollDelta.isZero()) | 3419 if (scrollDelta.isZero()) |
3420 return; | 3420 return; |
3421 | 3421 |
3422 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) { | 3422 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
3423 // Don't scroll the FrameView! | 3423 // Don't scroll the FrameView! |
3424 ASSERT_NOT_REACHED(); | 3424 ASSERT_NOT_REACHED(); |
3425 } | 3425 } |
3426 | 3426 |
3427 m_scrollPosition = newPosition; | 3427 m_scrollPosition = newPosition; |
3428 | 3428 |
3429 if (!scrollbarsSuppressed()) | 3429 if (!scrollbarsSuppressed()) |
3430 m_pendingScrollDelta += scrollDelta; | 3430 m_pendingScrollDelta += scrollDelta; |
3431 | 3431 |
3432 clearFragmentAnchor(); | 3432 clearFragmentAnchor(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3485 } | 3485 } |
3486 | 3486 |
3487 void FrameView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool&
newHasVerticalScrollbar, const IntSize& docSize, ComputeScrollbarExistenceOptio
n option) const | 3487 void FrameView::computeScrollbarExistence(bool& newHasHorizontalScrollbar, bool&
newHasVerticalScrollbar, const IntSize& docSize, ComputeScrollbarExistenceOptio
n option) const |
3488 { | 3488 { |
3489 bool hasHorizontalScrollbar = m_horizontalScrollbar; | 3489 bool hasHorizontalScrollbar = m_horizontalScrollbar; |
3490 bool hasVerticalScrollbar = m_verticalScrollbar; | 3490 bool hasVerticalScrollbar = m_verticalScrollbar; |
3491 | 3491 |
3492 newHasHorizontalScrollbar = hasHorizontalScrollbar; | 3492 newHasHorizontalScrollbar = hasHorizontalScrollbar; |
3493 newHasVerticalScrollbar = hasVerticalScrollbar; | 3493 newHasVerticalScrollbar = hasVerticalScrollbar; |
3494 | 3494 |
3495 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) | 3495 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
3496 return; | 3496 return; |
3497 | 3497 |
3498 ScrollbarMode hScroll = m_horizontalScrollbarMode; | 3498 ScrollbarMode hScroll = m_horizontalScrollbarMode; |
3499 ScrollbarMode vScroll = m_verticalScrollbarMode; | 3499 ScrollbarMode vScroll = m_verticalScrollbarMode; |
3500 | 3500 |
3501 if (hScroll != ScrollbarAuto) | 3501 if (hScroll != ScrollbarAuto) |
3502 newHasHorizontalScrollbar = (hScroll == ScrollbarAlwaysOn); | 3502 newHasHorizontalScrollbar = (hScroll == ScrollbarAlwaysOn); |
3503 if (vScroll != ScrollbarAuto) | 3503 if (vScroll != ScrollbarAuto) |
3504 newHasVerticalScrollbar = (vScroll == ScrollbarAlwaysOn); | 3504 newHasVerticalScrollbar = (vScroll == ScrollbarAlwaysOn); |
3505 | 3505 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3648 void FrameView::updateScrollbarsIfNeeded() | 3648 void FrameView::updateScrollbarsIfNeeded() |
3649 { | 3649 { |
3650 if (m_needsScrollbarsUpdate || needsScrollbarReconstruction() || scrollOrigi
nChanged()) | 3650 if (m_needsScrollbarsUpdate || needsScrollbarReconstruction() || scrollOrigi
nChanged()) |
3651 updateScrollbars(); | 3651 updateScrollbars(); |
3652 } | 3652 } |
3653 | 3653 |
3654 void FrameView::updateScrollbars() | 3654 void FrameView::updateScrollbars() |
3655 { | 3655 { |
3656 m_needsScrollbarsUpdate = false; | 3656 m_needsScrollbarsUpdate = false; |
3657 | 3657 |
3658 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) | 3658 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
3659 return; | 3659 return; |
3660 | 3660 |
3661 // Avoid drawing two sets of scrollbars when visual viewport is enabled. | 3661 // Avoid drawing two sets of scrollbars when visual viewport is enabled. |
3662 if (visualViewportSuppliesScrollbars()) { | 3662 if (visualViewportSuppliesScrollbars()) { |
3663 setHasHorizontalScrollbar(false); | 3663 setHasHorizontalScrollbar(false); |
3664 setHasVerticalScrollbar(false); | 3664 setHasVerticalScrollbar(false); |
3665 adjustScrollPositionFromUpdateScrollbars(); | 3665 adjustScrollPositionFromUpdateScrollbars(); |
3666 return; | 3666 return; |
3667 } | 3667 } |
3668 | 3668 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3912 positionScrollCornerLayer(layerForScrollCorner(), scrollCornerRect()); | 3912 positionScrollCornerLayer(layerForScrollCorner(), scrollCornerRect()); |
3913 } | 3913 } |
3914 | 3914 |
3915 bool FrameView::userInputScrollable(ScrollbarOrientation orientation) const | 3915 bool FrameView::userInputScrollable(ScrollbarOrientation orientation) const |
3916 { | 3916 { |
3917 Document* document = frame().document(); | 3917 Document* document = frame().document(); |
3918 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(*document); | 3918 Element* fullscreenElement = Fullscreen::fullscreenElementFrom(*document); |
3919 if (fullscreenElement && fullscreenElement != document->documentElement()) | 3919 if (fullscreenElement && fullscreenElement != document->documentElement()) |
3920 return false; | 3920 return false; |
3921 | 3921 |
3922 if (frame().settings() && frame().settings()->rootLayerScrolls()) | 3922 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
3923 return false; | 3923 return false; |
3924 | 3924 |
3925 ScrollbarMode mode = (orientation == HorizontalScrollbar) ? | 3925 ScrollbarMode mode = (orientation == HorizontalScrollbar) ? |
3926 m_horizontalScrollbarMode : m_verticalScrollbarMode; | 3926 m_horizontalScrollbarMode : m_verticalScrollbarMode; |
3927 | 3927 |
3928 return mode == ScrollbarAuto || mode == ScrollbarAlwaysOn; | 3928 return mode == ScrollbarAuto || mode == ScrollbarAlwaysOn; |
3929 } | 3929 } |
3930 | 3930 |
3931 bool FrameView::shouldPlaceVerticalScrollbarOnLeft() const | 3931 bool FrameView::shouldPlaceVerticalScrollbarOnLeft() const |
3932 { | 3932 { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4126 ScrollableArea* FrameView::getScrollableArea() | 4126 ScrollableArea* FrameView::getScrollableArea() |
4127 { | 4127 { |
4128 if (m_viewportScrollableArea) | 4128 if (m_viewportScrollableArea) |
4129 return m_viewportScrollableArea.get(); | 4129 return m_viewportScrollableArea.get(); |
4130 | 4130 |
4131 return layoutViewportScrollableArea(); | 4131 return layoutViewportScrollableArea(); |
4132 } | 4132 } |
4133 | 4133 |
4134 ScrollableArea* FrameView::layoutViewportScrollableArea() | 4134 ScrollableArea* FrameView::layoutViewportScrollableArea() |
4135 { | 4135 { |
4136 Settings* settings = frame().settings(); | 4136 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
4137 if (!settings || !settings->rootLayerScrolls()) | |
4138 return this; | 4137 return this; |
4139 | 4138 |
4140 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 4139 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
4141 return layoutViewItem.isNull() ? nullptr : layoutViewItem.getScrollableArea(
); | 4140 return layoutViewItem.isNull() ? nullptr : layoutViewItem.getScrollableArea(
); |
4142 } | 4141 } |
4143 | 4142 |
4144 RootFrameViewport* FrameView::getRootFrameViewport() | 4143 RootFrameViewport* FrameView::getRootFrameViewport() |
4145 { | 4144 { |
4146 return m_viewportScrollableArea.get(); | 4145 return m_viewportScrollableArea.get(); |
4147 } | 4146 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4323 } | 4322 } |
4324 | 4323 |
4325 bool FrameView::canThrottleRendering() const | 4324 bool FrameView::canThrottleRendering() const |
4326 { | 4325 { |
4327 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) | 4326 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) |
4328 return false; | 4327 return false; |
4329 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); | 4328 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); |
4330 } | 4329 } |
4331 | 4330 |
4332 } // namespace blink | 4331 } // namespace blink |
OLD | NEW |