Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 1308273010: Adapt and reland old position sticky implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Force main thread scrolling, set experimental status, and address review comments. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 , m_inSynchronousPostLayout(false) 121 , m_inSynchronousPostLayout(false)
122 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) 122 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
123 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) 123 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired)
124 , m_intersectionObserverNotificationFactory(CancellableTaskFactory::create(t his, &FrameView::notifyIntersectionObservers)) 124 , m_intersectionObserverNotificationFactory(CancellableTaskFactory::create(t his, &FrameView::notifyIntersectionObservers))
125 , m_isTransparent(false) 125 , m_isTransparent(false)
126 , m_baseBackgroundColor(Color::white) 126 , m_baseBackgroundColor(Color::white)
127 , m_mediaType(MediaTypeNames::screen) 127 , m_mediaType(MediaTypeNames::screen)
128 , m_safeToPropagateScrollToParent(true) 128 , m_safeToPropagateScrollToParent(true)
129 , m_isTrackingPaintInvalidations(false) 129 , m_isTrackingPaintInvalidations(false)
130 , m_scrollCorner(nullptr) 130 , m_scrollCorner(nullptr)
131 , m_stickyPositionObjectCount(0)
131 , m_inputEventsScaleFactorForEmulation(1) 132 , m_inputEventsScaleFactorForEmulation(1)
132 , m_layoutSizeFixedToFrameSize(true) 133 , m_layoutSizeFixedToFrameSize(true)
133 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) 134 , m_didScrollTimer(this, &FrameView::didScrollTimerFired)
134 , m_topControlsViewportAdjustment(0) 135 , m_topControlsViewportAdjustment(0)
135 , m_needsUpdateWidgetPositions(false) 136 , m_needsUpdateWidgetPositions(false)
136 , m_needsUpdateViewportIntersection(true) 137 , m_needsUpdateViewportIntersection(true)
137 , m_needsUpdateViewportIntersectionInSubtree(true) 138 , m_needsUpdateViewportIntersectionInSubtree(true)
138 #if ENABLE(ASSERT) 139 #if ENABLE(ASSERT)
139 , m_hasBeenDisposed(false) 140 , m_hasBeenDisposed(false)
140 #endif 141 #endif
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 } 1559 }
1559 1560
1560 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() 1561 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded()
1561 { 1562 {
1562 // Nothing to do after scrolling if there are no fixed position elements. 1563 // Nothing to do after scrolling if there are no fixed position elements.
1563 if (!hasViewportConstrainedObjects()) 1564 if (!hasViewportConstrainedObjects())
1564 return; 1565 return;
1565 1566
1566 RefPtrWillBeRawPtr<FrameView> protect(this); 1567 RefPtrWillBeRawPtr<FrameView> protect(this);
1567 1568
1569 // Update sticky position objects which are stuck to the viewport.
1570 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1571 LayoutObject* layoutObject = viewportConstrainedObject;
1572 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1573 if (layoutObject->style()->position() == StickyPosition)
1574 layer->updateLayerPosition();
1575 }
1576
1568 // If there fixed position elements, scrolling may cause compositing layers to change. 1577 // If there fixed position elements, scrolling may cause compositing layers to change.
1569 // Update widget and layer positions after scrolling, but only if we're not inside of 1578 // Update widget and layer positions after scrolling, but only if we're not inside of
1570 // layout. 1579 // layout.
1571 if (!m_nestedLayoutCount) { 1580 if (!m_nestedLayoutCount) {
1572 updateWidgetPositions(); 1581 updateWidgetPositions();
1573 if (LayoutView* layoutView = this->layoutView()) 1582 if (LayoutView* layoutView = this->layoutView())
1574 layoutView->layer()->setNeedsCompositingInputsUpdate(); 1583 layoutView->layer()->setNeedsCompositingInputsUpdate();
1575 } 1584 }
1576 } 1585 }
1577 1586
(...skipping 2407 matching lines...) Expand 10 before | Expand all | Expand 10 after
3985 return m_hiddenForThrottling && m_crossOriginForThrottling; 3994 return m_hiddenForThrottling && m_crossOriginForThrottling;
3986 } 3995 }
3987 3996
3988 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 3997 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
3989 { 3998 {
3990 ASSERT(layoutView()); 3999 ASSERT(layoutView());
3991 return *layoutView(); 4000 return *layoutView();
3992 } 4001 }
3993 4002
3994 } // namespace blink 4003 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698