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

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 and attempt to fix base URL Created 5 years, 1 month 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 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 layoutView()->clearHitTestCache(); 1549 layoutView()->clearHitTestCache();
1550 frame().loader().saveScrollState(); 1550 frame().loader().saveScrollState();
1551 } 1551 }
1552 1552
1553 void FrameView::didScrollTimerFired(Timer<FrameView>*) 1553 void FrameView::didScrollTimerFired(Timer<FrameView>*)
1554 { 1554 {
1555 if (m_frame->document() && m_frame->document()->layoutView()) 1555 if (m_frame->document() && m_frame->document()->layoutView())
1556 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); 1556 m_frame->document()->fetcher()->updateAllImageResourcePriorities();
1557 } 1557 }
1558 1558
1559 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() 1559 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded(const DoubleSize& scrollDelta)
1560 { 1560 {
1561 // Nothing to do after scrolling if there are no fixed position elements. 1561 // Nothing to do after scrolling if there are no fixed position elements.
1562 if (!hasViewportConstrainedObjects()) 1562 if (!hasViewportConstrainedObjects())
1563 return; 1563 return;
1564 1564
1565 RefPtrWillBeRawPtr<FrameView> protect(this); 1565 RefPtrWillBeRawPtr<FrameView> protect(this);
1566 1566
1567 // Update sticky position objects which are stuck to the viewport.
1568 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
chrishtr 2015/11/04 01:55:18 Shouldn't this go in PaintLayerScrollableArea? Thi
flackr 2015/11/25 20:47:52 The root frame doesn't use PaintLayerScrollableAre
chrishtr 2015/12/09 00:37:38 What about iframes?
1569 LayoutObject* layoutObject = viewportConstrainedObject;
1570 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1571 if (layoutObject->style()->position() == StickyPosition)
1572 layer->updateLayerPositionAfterFrameScroll(scrollDelta);
1573 }
1574
1567 // If there fixed position elements, scrolling may cause compositing layers to change. 1575 // If there fixed position elements, scrolling may cause compositing layers to change.
1568 // Update widget and layer positions after scrolling, but only if we're not inside of 1576 // Update widget and layer positions after scrolling, but only if we're not inside of
1569 // layout. 1577 // layout.
1570 if (!m_nestedLayoutCount) { 1578 if (!m_nestedLayoutCount) {
1571 updateWidgetPositions(); 1579 updateWidgetPositions();
1572 if (LayoutView* layoutView = this->layoutView()) 1580 if (LayoutView* layoutView = this->layoutView())
1573 layoutView->layer()->setNeedsCompositingInputsUpdate(); 1581 layoutView->layer()->setNeedsCompositingInputsUpdate();
1574 } 1582 }
1575 } 1583 }
1576 1584
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 // Don't scroll the FrameView! 2115 // Don't scroll the FrameView!
2108 ASSERT_NOT_REACHED(); 2116 ASSERT_NOT_REACHED();
2109 } 2117 }
2110 2118
2111 m_scrollPosition = newPosition; 2119 m_scrollPosition = newPosition;
2112 2120
2113 if (!scrollbarsSuppressed()) 2121 if (!scrollbarsSuppressed())
2114 m_pendingScrollDelta += scrollDelta; 2122 m_pendingScrollDelta += scrollDelta;
2115 2123
2116 clearScrollAnchor(); 2124 clearScrollAnchor();
2117 updateLayersAndCompositingAfterScrollIfNeeded(); 2125 updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta);
2118 scrollPositionChanged(); 2126 scrollPositionChanged();
2119 frame().loader().client()->didChangeScrollOffset(); 2127 frame().loader().client()->didChangeScrollOffset();
2120 } 2128 }
2121 2129
2122 void FrameView::invalidatePaintForTickmarks() const 2130 void FrameView::invalidatePaintForTickmarks() const
2123 { 2131 {
2124 if (Scrollbar* scrollbar = verticalScrollbar()) 2132 if (Scrollbar* scrollbar = verticalScrollbar())
2125 scrollbar->invalidate(); 2133 scrollbar->invalidate();
2126 } 2134 }
2127 2135
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after
4078 } 4086 }
4079 4087
4080 bool FrameView::canThrottleRendering() const 4088 bool FrameView::canThrottleRendering() const
4081 { 4089 {
4082 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4090 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4083 return false; 4091 return false;
4084 return m_hiddenForThrottling && m_crossOriginForThrottling; 4092 return m_hiddenForThrottling && m_crossOriginForThrottling;
4085 } 4093 }
4086 4094
4087 } // namespace blink 4095 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698