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

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 (removing horizontal-bt test) 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 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 layoutView()->clearHitTestCache(); 1550 layoutView()->clearHitTestCache();
1551 frame().loader().saveScrollState(); 1551 frame().loader().saveScrollState();
1552 } 1552 }
1553 1553
1554 void FrameView::didScrollTimerFired(Timer<FrameView>*) 1554 void FrameView::didScrollTimerFired(Timer<FrameView>*)
1555 { 1555 {
1556 if (m_frame->document() && m_frame->document()->layoutView()) 1556 if (m_frame->document() && m_frame->document()->layoutView())
1557 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); 1557 m_frame->document()->fetcher()->updateAllImageResourcePriorities();
1558 } 1558 }
1559 1559
1560 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() 1560 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded(const DoubleSize& scrollDelta)
1561 { 1561 {
1562 // Nothing to do after scrolling if there are no fixed position elements. 1562 // Nothing to do after scrolling if there are no fixed position elements.
1563 if (!hasViewportConstrainedObjects()) 1563 if (!hasViewportConstrainedObjects())
1564 return; 1564 return;
1565 1565
1566 RefPtrWillBeRawPtr<FrameView> protect(this); 1566 RefPtrWillBeRawPtr<FrameView> protect(this);
1567 1567
1568 // Update sticky position objects which are stuck to the viewport.
1569 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1570 LayoutObject* layoutObject = viewportConstrainedObject;
1571 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1572 if (layoutObject->style()->position() == StickyPosition)
1573 layer->updateLayerPositionAfterFrameScroll(scrollDelta);
chrishtr 2015/12/09 00:37:38 So on a scroll, first the positions of the sticky
chrishtr 2015/12/09 19:12:21 I think PaintLayerScrollableArea, line 384, needs
flackr 2015/12/10 23:43:14 All of these cases do seem to be working, but I ne
flackr 2015/12/10 23:43:15 Actually, sticky elements which have an ancestor s
1574 }
1575
1568 // If there fixed position elements, scrolling may cause compositing layers to change. 1576 // 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 1577 // Update widget and layer positions after scrolling, but only if we're not inside of
1570 // layout. 1578 // layout.
1571 if (!m_nestedLayoutCount) { 1579 if (!m_nestedLayoutCount) {
1572 updateWidgetPositions(); 1580 updateWidgetPositions();
1573 if (LayoutView* layoutView = this->layoutView()) 1581 if (LayoutView* layoutView = this->layoutView())
1574 layoutView->layer()->setNeedsCompositingInputsUpdate(); 1582 layoutView->layer()->setNeedsCompositingInputsUpdate();
1575 } 1583 }
1576 } 1584 }
1577 1585
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 // Don't scroll the FrameView! 2071 // Don't scroll the FrameView!
2064 ASSERT_NOT_REACHED(); 2072 ASSERT_NOT_REACHED();
2065 } 2073 }
2066 2074
2067 m_scrollPosition = newPosition; 2075 m_scrollPosition = newPosition;
2068 2076
2069 if (!scrollbarsSuppressed()) 2077 if (!scrollbarsSuppressed())
2070 m_pendingScrollDelta += scrollDelta; 2078 m_pendingScrollDelta += scrollDelta;
2071 2079
2072 clearScrollAnchor(); 2080 clearScrollAnchor();
2073 updateLayersAndCompositingAfterScrollIfNeeded(); 2081 updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta);
2074 scrollPositionChanged(); 2082 scrollPositionChanged();
2075 frame().loader().client()->didChangeScrollOffset(); 2083 frame().loader().client()->didChangeScrollOffset();
2076 } 2084 }
2077 2085
2078 void FrameView::invalidatePaintForTickmarks() 2086 void FrameView::invalidatePaintForTickmarks()
2079 { 2087 {
2080 if (Scrollbar* scrollbar = verticalScrollbar()) { 2088 if (Scrollbar* scrollbar = verticalScrollbar()) {
2081 scrollbar->setTrackNeedsRepaint(true); 2089 scrollbar->setTrackNeedsRepaint(true);
2082 setScrollbarNeedsPaintInvalidation(scrollbar); 2090 setScrollbarNeedsPaintInvalidation(scrollbar);
2083 } 2091 }
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
3985 return m_hiddenForThrottling && m_crossOriginForThrottling; 3993 return m_hiddenForThrottling && m_crossOriginForThrottling;
3986 } 3994 }
3987 3995
3988 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 3996 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
3989 { 3997 {
3990 ASSERT(layoutView()); 3998 ASSERT(layoutView());
3991 return *layoutView(); 3999 return *layoutView();
3992 } 4000 }
3993 4001
3994 } // namespace blink 4002 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698