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

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

Issue 2020103002: Fix sticky constraints and update sticky layer positions recursively after scroll. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bugs with overflow scrollers in sticky position constraints, add unit tests, and test clipped b… Created 4 years, 6 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 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 1609
1610 setLayoutSizeInternal(size); 1610 setLayoutSizeInternal(size);
1611 } 1611 }
1612 1612
1613 void FrameView::didScrollTimerFired(Timer<FrameView>*) 1613 void FrameView::didScrollTimerFired(Timer<FrameView>*)
1614 { 1614 {
1615 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull()) 1615 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull())
1616 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); 1616 m_frame->document()->fetcher()->updateAllImageResourcePriorities();
1617 } 1617 }
1618 1618
1619 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() 1619 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded(const DoubleSize& scrollDelta)
1620 { 1620 {
1621 // Nothing to do after scrolling if there are no fixed position elements. 1621 // Nothing to do after scrolling if there are no fixed position elements.
1622 if (!hasViewportConstrainedObjects()) 1622 if (!hasViewportConstrainedObjects())
1623 return; 1623 return;
1624 1624
1625 // Update sticky position objects which are stuck to the viewport. 1625 // Update sticky position objects which are stuck to the viewport.
1626 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { 1626 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1627 LayoutObject* layoutObject = viewportConstrainedObject; 1627 LayoutObject* layoutObject = viewportConstrainedObject;
1628 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); 1628 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1629 if (layoutObject->style()->position() == StickyPosition) 1629 if (layoutObject->style()->position() == StickyPosition) {
1630 layer->updateLayerPosition(); 1630 // TODO(skobes): Resolve circular dependency between scroll offset a nd
1631 // compositing state, and remove this disabler. https://crbug.com/42 0741
1632 DisableCompositingQueryAsserts disabler;
1633 layer->updateLayerPositionsAfterOverflowScroll(scrollDelta);
1634 }
1631 } 1635 }
1632 1636
1633 // If there fixed position elements, scrolling may cause compositing layers to change. 1637 // If there fixed position elements, scrolling may cause compositing layers to change.
1634 // Update widget and layer positions after scrolling, but only if we're not inside of 1638 // Update widget and layer positions after scrolling, but only if we're not inside of
1635 // layout. 1639 // layout.
1636 if (!m_nestedLayoutCount) { 1640 if (!m_nestedLayoutCount) {
1637 updateWidgetGeometries(); 1641 updateWidgetGeometries();
1638 LayoutViewItem layoutViewItem = this->layoutViewItem(); 1642 LayoutViewItem layoutViewItem = this->layoutViewItem();
1639 if (!layoutViewItem.isNull()) 1643 if (!layoutViewItem.isNull())
1640 layoutViewItem.layer()->setNeedsCompositingInputsUpdate(); 1644 layoutViewItem.layer()->setNeedsCompositingInputsUpdate();
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after
3237 // Don't scroll the FrameView! 3241 // Don't scroll the FrameView!
3238 ASSERT_NOT_REACHED(); 3242 ASSERT_NOT_REACHED();
3239 } 3243 }
3240 3244
3241 m_scrollPosition = newPosition; 3245 m_scrollPosition = newPosition;
3242 3246
3243 if (!scrollbarsSuppressed()) 3247 if (!scrollbarsSuppressed())
3244 m_pendingScrollDelta += scrollDelta; 3248 m_pendingScrollDelta += scrollDelta;
3245 3249
3246 clearFragmentAnchor(); 3250 clearFragmentAnchor();
3247 updateLayersAndCompositingAfterScrollIfNeeded(); 3251 updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta);
3248 3252
3249 Document* document = m_frame->document(); 3253 Document* document = m_frame->document();
3250 document->enqueueScrollEventForNode(document); 3254 document->enqueueScrollEventForNode(document);
3251 3255
3252 m_frame->eventHandler().dispatchFakeMouseMoveEventSoon(); 3256 m_frame->eventHandler().dispatchFakeMouseMoveEventSoon();
3253 Page* page = frame().page(); 3257 Page* page = frame().page();
3254 if (page) 3258 if (page)
3255 page->chromeClient().clearToolTip(); 3259 page->chromeClient().clearToolTip();
3256 3260
3257 LayoutViewItem layoutViewItem = document->layoutViewItem(); 3261 LayoutViewItem layoutViewItem = document->layoutViewItem();
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
4135 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4139 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4136 } 4140 }
4137 4141
4138 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4142 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4139 { 4143 {
4140 ASSERT(!layoutViewItem().isNull()); 4144 ASSERT(!layoutViewItem().isNull());
4141 return *layoutView(); 4145 return *layoutView();
4142 } 4146 }
4143 4147
4144 } // namespace blink 4148 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698