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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2636253002: Handle nested position:sticky elements (Closed)
Patch Set: Offset rects correctly and accumulate correctly Created 3 years, 11 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 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 void FrameView::didScrollTimerFired(TimerBase*) { 1921 void FrameView::didScrollTimerFired(TimerBase*) {
1922 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull()) 1922 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull())
1923 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); 1923 m_frame->document()->fetcher()->updateAllImageResourcePriorities();
1924 } 1924 }
1925 1925
1926 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() { 1926 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() {
1927 // Nothing to do after scrolling if there are no fixed position elements. 1927 // Nothing to do after scrolling if there are no fixed position elements.
1928 if (!hasViewportConstrainedObjects()) 1928 if (!hasViewportConstrainedObjects())
1929 return; 1929 return;
1930 1930
1931 // Update sticky position objects which are stuck to the viewport. 1931 // Update sticky position objects which are stuck to the viewport. In order to
1932 // correctly compute the sticky position offsets, the layers must be visited
1933 // top-down, so start at the 'root' sticky elements and recurse downwards.
1932 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { 1934 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1933 LayoutObject* layoutObject = viewportConstrainedObject; 1935 LayoutObject* layoutObject = viewportConstrainedObject;
1934 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); 1936 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1935 if (layoutObject->style()->position() == StickyPosition) { 1937 StickyConstraintsMap constraintsMap =
1938 layer->getScrollableArea()->stickyConstraintsMap();
1939 if (layoutObject->style()->position() == StickyPosition &&
1940 constraintsMap.contains(layer) &&
flackr 2017/01/20 02:42:44 Do you know if we do actualy sometimes end up with
smcgruer 2017/01/20 17:18:14 It appears so. I don't know the exact reason, but
1941 !constraintsMap.get(layer).hasAncestorStickyElement()) {
1936 // TODO(skobes): Resolve circular dependency between scroll offset and 1942 // TODO(skobes): Resolve circular dependency between scroll offset and
1937 // compositing state, and remove this disabler. https://crbug.com/420741 1943 // compositing state, and remove this disabler. https://crbug.com/420741
1938 DisableCompositingQueryAsserts disabler; 1944 DisableCompositingQueryAsserts disabler;
1939 layer->updateLayerPositionsAfterOverflowScroll(); 1945 layer->updateLayerPositionsAfterOverflowScroll();
1940 layoutObject->setMayNeedPaintInvalidationSubtree(); 1946 layoutObject->setMayNeedPaintInvalidationSubtree();
1941 } 1947 }
1942 } 1948 }
1943 1949
1944 // If there fixed position elements, scrolling may cause compositing layers to 1950 // If there fixed position elements, scrolling may cause compositing layers to
1945 // change. Update widget and layer positions after scrolling, but only if 1951 // change. Update widget and layer positions after scrolling, but only if
(...skipping 3052 matching lines...) Expand 10 before | Expand all | Expand 10 after
4998 // This is the top-level frame, so no mapping necessary. 5004 // This is the top-level frame, so no mapping necessary.
4999 if (m_frame->isMainFrame()) 5005 if (m_frame->isMainFrame())
5000 return; 5006 return;
5001 5007
5002 LayoutRect viewportIntersectionRect(remoteViewportIntersection()); 5008 LayoutRect viewportIntersectionRect(remoteViewportIntersection());
5003 transformState.move( 5009 transformState.move(
5004 LayoutSize(-viewportIntersectionRect.x(), -viewportIntersectionRect.y())); 5010 LayoutSize(-viewportIntersectionRect.x(), -viewportIntersectionRect.y()));
5005 } 5011 }
5006 5012
5007 } // namespace blink 5013 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698