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

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: Simplify sticky box rect calculation. Created 4 years, 5 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 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 1616
1617 setLayoutSizeInternal(size); 1617 setLayoutSizeInternal(size);
1618 } 1618 }
1619 1619
1620 void FrameView::didScrollTimerFired(Timer<FrameView>*) 1620 void FrameView::didScrollTimerFired(Timer<FrameView>*)
1621 { 1621 {
1622 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull()) 1622 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull())
1623 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); 1623 m_frame->document()->fetcher()->updateAllImageResourcePriorities();
1624 } 1624 }
1625 1625
1626 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() 1626 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded(const DoubleSize& scrollDelta)
1627 { 1627 {
1628 // Nothing to do after scrolling if there are no fixed position elements. 1628 // Nothing to do after scrolling if there are no fixed position elements.
1629 if (!hasViewportConstrainedObjects()) 1629 if (!hasViewportConstrainedObjects())
1630 return; 1630 return;
1631 1631
1632 // Update sticky position objects which are stuck to the viewport. 1632 // Update sticky position objects which are stuck to the viewport.
1633 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { 1633 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1634 LayoutObject* layoutObject = viewportConstrainedObject; 1634 LayoutObject* layoutObject = viewportConstrainedObject;
1635 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); 1635 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1636 if (layoutObject->style()->position() == StickyPosition) 1636 if (layoutObject->style()->position() == StickyPosition) {
1637 layer->updateLayerPosition(); 1637 // TODO(skobes): Resolve circular dependency between scroll offset a nd
1638 // compositing state, and remove this disabler. https://crbug.com/42 0741
1639 DisableCompositingQueryAsserts disabler;
1640 layer->updateLayerPositionsAfterOverflowScroll(scrollDelta);
1641 }
1638 } 1642 }
1639 1643
1640 // If there fixed position elements, scrolling may cause compositing layers to change. 1644 // If there fixed position elements, scrolling may cause compositing layers to change.
1641 // Update widget and layer positions after scrolling, but only if we're not inside of 1645 // Update widget and layer positions after scrolling, but only if we're not inside of
1642 // layout. 1646 // layout.
1643 if (!m_nestedLayoutCount) { 1647 if (!m_nestedLayoutCount) {
1644 updateWidgetGeometries(); 1648 updateWidgetGeometries();
1645 LayoutViewItem layoutViewItem = this->layoutViewItem(); 1649 LayoutViewItem layoutViewItem = this->layoutViewItem();
1646 if (!layoutViewItem.isNull()) 1650 if (!layoutViewItem.isNull())
1647 layoutViewItem.layer()->setNeedsCompositingInputsUpdate(); 1651 layoutViewItem.layer()->setNeedsCompositingInputsUpdate();
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after
3319 // Don't scroll the FrameView! 3323 // Don't scroll the FrameView!
3320 ASSERT_NOT_REACHED(); 3324 ASSERT_NOT_REACHED();
3321 } 3325 }
3322 3326
3323 m_scrollPosition = newPosition; 3327 m_scrollPosition = newPosition;
3324 3328
3325 if (!scrollbarsSuppressed()) 3329 if (!scrollbarsSuppressed())
3326 m_pendingScrollDelta += scrollDelta; 3330 m_pendingScrollDelta += scrollDelta;
3327 3331
3328 clearFragmentAnchor(); 3332 clearFragmentAnchor();
3329 updateLayersAndCompositingAfterScrollIfNeeded(); 3333 updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta);
3330 3334
3331 Document* document = m_frame->document(); 3335 Document* document = m_frame->document();
3332 document->enqueueScrollEventForNode(document); 3336 document->enqueueScrollEventForNode(document);
3333 3337
3334 m_frame->eventHandler().dispatchFakeMouseMoveEventSoon(); 3338 m_frame->eventHandler().dispatchFakeMouseMoveEventSoon();
3335 Page* page = frame().page(); 3339 Page* page = frame().page();
3336 if (page) 3340 if (page)
3337 page->chromeClient().clearToolTip(); 3341 page->chromeClient().clearToolTip();
3338 3342
3339 LayoutViewItem layoutViewItem = document->layoutViewItem(); 3343 LayoutViewItem layoutViewItem = document->layoutViewItem();
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
4218 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4222 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4219 } 4223 }
4220 4224
4221 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4225 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4222 { 4226 {
4223 ASSERT(!layoutViewItem().isNull()); 4227 ASSERT(!layoutViewItem().isNull());
4224 return *layoutView(); 4228 return *layoutView();
4225 } 4229 }
4226 4230
4227 } // namespace blink 4231 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698