Chromium Code Reviews| Index: Source/core/frame/FrameView.cpp |
| diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
| index efcdd6c3a22a18d209f366da8f030030480bf837..3582b3597ada38dd3ec884e9bbe7681b868e4123 100644 |
| --- a/Source/core/frame/FrameView.cpp |
| +++ b/Source/core/frame/FrameView.cpp |
| @@ -1563,7 +1563,7 @@ void FrameView::didScrollTimerFired(Timer<FrameView>*) |
| } |
| } |
| -void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() |
| +void FrameView::updateLayersAndCompositingAfterScrollIfNeeded(const DoubleSize& scrollDelta) |
| { |
| // Nothing to do after scrolling if there are no fixed position elements. |
| if (!hasViewportConstrainedObjects()) |
| @@ -1571,6 +1571,14 @@ void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() |
| RefPtrWillBeRawPtr<FrameView> protect(this); |
| + // Update sticky positioned elements which scroll with the viewport. |
| + for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { |
| + LayoutObject* layoutObject = viewportConstrainedObject; |
| + DeprecatedPaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); |
| + if (layoutObject->style()->position() == StickyPosition && layer->scrollsWithViewport()) |
| + layer->updateLayerPositionsAfterOverflowScroll(scrollDelta); |
|
flackr
2015/09/15 21:13:11
+skobes, does this seem like the right way / place
skobes
2015/09/16 00:07:57
Possibly, but keep in mind that FrameView scrolls
chrishtr
2015/09/17 01:18:56
This method of implementation is not performant en
flackr
2015/09/22 22:25:32
Agreed, my intention is to only add those sticky o
|
| + } |
| + |
| // If there fixed position elements, scrolling may cause compositing layers to change. |
| // Update widget and layer positions after scrolling, but only if we're not inside of |
| // layout. |
| @@ -2129,7 +2137,7 @@ void FrameView::scrollTo(const DoublePoint& newPosition) |
| m_pendingScrollDelta += scrollDelta; |
| clearScrollAnchor(); |
| - updateLayersAndCompositingAfterScrollIfNeeded(); |
| + updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta); |
| scrollPositionChanged(); |
| frame().loader().client()->didChangeScrollOffset(); |
| } |
| @@ -3157,14 +3165,28 @@ int FrameView::scrollSize(ScrollbarOrientation orientation) const |
| return scrollbar->totalSize() - scrollbar->visibleSize(); |
| } |
| -void FrameView::setScrollOffset(const IntPoint& offset, ScrollType) |
| +void FrameView::setScrollOffset(const IntPoint& offset, ScrollType type) |
| { |
| - scrollTo(clampScrollPosition(offset)); |
| + if (type != CompositorScroll) { |
| + // Scrolling is triggered directly in response to scrollbar thumb movement, |
| + // but should be processed after compositing update. http://crbug.com/420741 |
| + DisableCompositingQueryAsserts disabler; |
| + scrollTo(clampScrollPosition(offset)); |
| + } else { |
| + scrollTo(clampScrollPosition(offset)); |
| + } |
| } |
| -void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType) |
| +void FrameView::setScrollOffset(const DoublePoint& offset, ScrollType type) |
| { |
| - scrollTo(clampScrollPosition(offset)); |
| + if (type != CompositorScroll) { |
| + // Scrolling is triggered directly in response to scrollbar thumb movement, |
| + // but should be processed after compositing update. http://crbug.com/420741 |
| + DisableCompositingQueryAsserts disabler; |
| + scrollTo(clampScrollPosition(offset)); |
| + } else { |
| + scrollTo(clampScrollPosition(offset)); |
| + } |
| } |
| void FrameView::windowResizerRectChanged() |