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

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: Merge with master and skip anonymous containing blocks for sticky container. Created 4 years, 10 months 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 , m_inSynchronousPostLayout(false) 124 , m_inSynchronousPostLayout(false)
125 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) 125 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
126 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) 126 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired)
127 , m_renderThrottlingObserverNotificationFactory(CancellableTaskFactory::crea te(this, &FrameView::notifyRenderThrottlingObservers)) 127 , m_renderThrottlingObserverNotificationFactory(CancellableTaskFactory::crea te(this, &FrameView::notifyRenderThrottlingObservers))
128 , m_isTransparent(false) 128 , m_isTransparent(false)
129 , m_baseBackgroundColor(Color::white) 129 , m_baseBackgroundColor(Color::white)
130 , m_mediaType(MediaTypeNames::screen) 130 , m_mediaType(MediaTypeNames::screen)
131 , m_safeToPropagateScrollToParent(true) 131 , m_safeToPropagateScrollToParent(true)
132 , m_isTrackingPaintInvalidations(false) 132 , m_isTrackingPaintInvalidations(false)
133 , m_scrollCorner(nullptr) 133 , m_scrollCorner(nullptr)
134 , m_stickyPositionObjectCount(0)
134 , m_inputEventsScaleFactorForEmulation(1) 135 , m_inputEventsScaleFactorForEmulation(1)
135 , m_layoutSizeFixedToFrameSize(true) 136 , m_layoutSizeFixedToFrameSize(true)
136 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) 137 , m_didScrollTimer(this, &FrameView::didScrollTimerFired)
137 , m_topControlsViewportAdjustment(0) 138 , m_topControlsViewportAdjustment(0)
138 , m_needsUpdateWidgetGeometries(false) 139 , m_needsUpdateWidgetGeometries(false)
139 , m_needsUpdateViewportIntersection(true) 140 , m_needsUpdateViewportIntersection(true)
140 , m_needsUpdateViewportIntersectionInSubtree(true) 141 , m_needsUpdateViewportIntersectionInSubtree(true)
141 #if ENABLE(ASSERT) 142 #if ENABLE(ASSERT)
142 , m_hasBeenDisposed(false) 143 , m_hasBeenDisposed(false)
143 #endif 144 #endif
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 } 1599 }
1599 1600
1600 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() 1601 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded()
1601 { 1602 {
1602 // Nothing to do after scrolling if there are no fixed position elements. 1603 // Nothing to do after scrolling if there are no fixed position elements.
1603 if (!hasViewportConstrainedObjects()) 1604 if (!hasViewportConstrainedObjects())
1604 return; 1605 return;
1605 1606
1606 RefPtrWillBeRawPtr<FrameView> protect(this); 1607 RefPtrWillBeRawPtr<FrameView> protect(this);
1607 1608
1609 // Update sticky position objects which are stuck to the viewport.
1610 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1611 LayoutObject* layoutObject = viewportConstrainedObject;
1612 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1613 if (layoutObject->style()->position() == StickyPosition)
1614 layer->updateLayerPosition();
1615 }
1616
1608 // If there fixed position elements, scrolling may cause compositing layers to change. 1617 // If there fixed position elements, scrolling may cause compositing layers to change.
1609 // Update widget and layer positions after scrolling, but only if we're not inside of 1618 // Update widget and layer positions after scrolling, but only if we're not inside of
1610 // layout. 1619 // layout.
1611 if (!m_nestedLayoutCount) { 1620 if (!m_nestedLayoutCount) {
1612 updateWidgetGeometries(); 1621 updateWidgetGeometries();
1613 if (LayoutView* layoutView = this->layoutView()) 1622 if (LayoutView* layoutView = this->layoutView())
1614 layoutView->layer()->setNeedsCompositingInputsUpdate(); 1623 layoutView->layer()->setNeedsCompositingInputsUpdate();
1615 } 1624 }
1616 } 1625 }
1617 1626
(...skipping 2432 matching lines...) Expand 10 before | Expand all | Expand 10 after
4050 return m_hiddenForThrottling && m_crossOriginForThrottling; 4059 return m_hiddenForThrottling && m_crossOriginForThrottling;
4051 } 4060 }
4052 4061
4053 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4062 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4054 { 4063 {
4055 ASSERT(layoutView()); 4064 ASSERT(layoutView());
4056 return *layoutView(); 4065 return *layoutView();
4057 } 4066 }
4058 4067
4059 } // namespace blink 4068 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698