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

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: Move compositor plumbing into a separate review. Created 5 years, 2 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 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 frame().loader().saveScrollState(); 1546 frame().loader().saveScrollState();
1547 } 1547 }
1548 1548
1549 void FrameView::didScrollTimerFired(Timer<FrameView>*) 1549 void FrameView::didScrollTimerFired(Timer<FrameView>*)
1550 { 1550 {
1551 if (m_frame->document() && m_frame->document()->layoutView()) { 1551 if (m_frame->document() && m_frame->document()->layoutView()) {
1552 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl lImageResourcePriorities(); 1552 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl lImageResourcePriorities();
1553 } 1553 }
1554 } 1554 }
1555 1555
1556 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() 1556 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded(const DoubleSize& scrollDelta)
1557 { 1557 {
1558 // Nothing to do after scrolling if there are no fixed position elements. 1558 // Nothing to do after scrolling if there are no fixed position elements.
1559 if (!hasViewportConstrainedObjects()) 1559 if (!hasViewportConstrainedObjects())
1560 return; 1560 return;
1561 1561
1562 RefPtrWillBeRawPtr<FrameView> protect(this); 1562 RefPtrWillBeRawPtr<FrameView> protect(this);
1563 1563
1564 // Update sticky positioned elements which scroll with the viewport.
chrishtr 2015/10/06 17:08:33 Are position: sticky elements spec'ed to stick to
flackr 2015/10/07 20:38:12 They're spec'ed to stick to the viewport if no anc
1565 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1566 LayoutObject* layoutObject = viewportConstrainedObject;
1567 DeprecatedPaintLayer* layer = toLayoutBoxModelObject(layoutObject)->laye r();
1568 if (layoutObject->style()->position() == StickyPosition && layer->scroll sWithViewport())
1569 layer->updateLayerPositionsAfterOverflowScroll(scrollDelta);
1570 }
1571
1564 // If there fixed position elements, scrolling may cause compositing layers to change. 1572 // If there fixed position elements, scrolling may cause compositing layers to change.
1565 // Update widget and layer positions after scrolling, but only if we're not inside of 1573 // Update widget and layer positions after scrolling, but only if we're not inside of
1566 // layout. 1574 // layout.
1567 if (!m_nestedLayoutCount) { 1575 if (!m_nestedLayoutCount) {
1568 updateWidgetPositions(); 1576 updateWidgetPositions();
1569 if (LayoutView* layoutView = this->layoutView()) 1577 if (LayoutView* layoutView = this->layoutView())
1570 layoutView->layer()->setNeedsCompositingInputsUpdate(); 1578 layoutView->layer()->setNeedsCompositingInputsUpdate();
1571 } 1579 }
1572 } 1580 }
1573 1581
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 // Don't scroll the FrameView! 2130 // Don't scroll the FrameView!
2123 ASSERT_NOT_REACHED(); 2131 ASSERT_NOT_REACHED();
2124 } 2132 }
2125 2133
2126 m_scrollPosition = newPosition; 2134 m_scrollPosition = newPosition;
2127 2135
2128 if (!scrollbarsSuppressed()) 2136 if (!scrollbarsSuppressed())
2129 m_pendingScrollDelta += scrollDelta; 2137 m_pendingScrollDelta += scrollDelta;
2130 2138
2131 clearScrollAnchor(); 2139 clearScrollAnchor();
2132 updateLayersAndCompositingAfterScrollIfNeeded(); 2140 updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta);
2133 scrollPositionChanged(); 2141 scrollPositionChanged();
2134 frame().loader().client()->didChangeScrollOffset(); 2142 frame().loader().client()->didChangeScrollOffset();
2135 } 2143 }
2136 2144
2137 void FrameView::invalidatePaintForTickmarks() const 2145 void FrameView::invalidatePaintForTickmarks() const
2138 { 2146 {
2139 if (Scrollbar* scrollbar = verticalScrollbar()) 2147 if (Scrollbar* scrollbar = verticalScrollbar())
2140 scrollbar->invalidate(); 2148 scrollbar->invalidate();
2141 } 2149 }
2142 2150
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
3151 // If no scrollbars are present, the content may still be scrollable. 3159 // If no scrollbars are present, the content may still be scrollable.
3152 if (!scrollbar) { 3160 if (!scrollbar) {
3153 IntSize scrollSize = m_contentsSize - visibleContentRect().size(); 3161 IntSize scrollSize = m_contentsSize - visibleContentRect().size();
3154 scrollSize.clampNegativeToZero(); 3162 scrollSize.clampNegativeToZero();
3155 return orientation == HorizontalScrollbar ? scrollSize.width() : scrollS ize.height(); 3163 return orientation == HorizontalScrollbar ? scrollSize.width() : scrollS ize.height();
3156 } 3164 }
3157 3165
3158 return scrollbar->totalSize() - scrollbar->visibleSize(); 3166 return scrollbar->totalSize() - scrollbar->visibleSize();
3159 } 3167 }
3160 3168
3161 void FrameView::setScrollOffset(const IntPoint& offset, ScrollType) 3169 void FrameView::setScrollOffset(const IntPoint& offset, ScrollType type)
3162 { 3170 {
3171 // Scrolling is triggered directly in response to events but should be
3172 // processed after compositing update. http://crbug.com/420741
3173 DisableCompositingQueryAsserts disabler;
chrishtr 2015/10/06 17:08:33 What is the code path that is now active which lea
flackr 2015/10/07 20:38:12 The stack trace is here: #0 0x00007fdaea9281b1 in
chrishtr 2015/11/04 01:40:44 Why is the compositing data stale when setScrollOf
flackr 2015/11/25 21:03:01 We have the same disabler in PaintLayerScrollableA
3163 scrollTo(clampScrollPosition(offset)); 3174 scrollTo(clampScrollPosition(offset));
3164 } 3175 }
3165 3176
3166 void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType) 3177 void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType type)
3167 { 3178 {
3179 // Scrolling is triggered directly in response to events but should be
3180 // processed after compositing update. http://crbug.com/420741
3181 DisableCompositingQueryAsserts disabler;
chrishtr 2015/10/06 17:08:33 Same question here.
flackr 2015/10/07 20:38:12 Same as above.
3168 scrollTo(clampScrollPosition(offset)); 3182 scrollTo(clampScrollPosition(offset));
3169 } 3183 }
3170 3184
3171 void FrameView::windowResizerRectChanged() 3185 void FrameView::windowResizerRectChanged()
3172 { 3186 {
3173 updateScrollbars(scrollOffsetDouble()); 3187 updateScrollbars(scrollOffsetDouble());
3174 } 3188 }
3175 3189
3176 bool FrameView::hasOverlayScrollbars() const 3190 bool FrameView::hasOverlayScrollbars() const
3177 { 3191 {
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
3935 3949
3936 if (!graphicsLayer) 3950 if (!graphicsLayer)
3937 return; 3951 return;
3938 3952
3939 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect); 3953 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect);
3940 3954
3941 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect))); 3955 graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, Web Rect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosing IntRect(viewRect)));
3942 } 3956 }
3943 3957
3944 } // namespace blink 3958 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698