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

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

Issue 2636253002: Handle nested position:sticky elements (Closed)
Patch Set: Remove accidental leftover whitespace Created 3 years, 10 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 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 void FrameView::didScrollTimerFired(TimerBase*) { 1939 void FrameView::didScrollTimerFired(TimerBase*) {
1940 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull()) 1940 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull())
1941 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); 1941 m_frame->document()->fetcher()->updateAllImageResourcePriorities();
1942 } 1942 }
1943 1943
1944 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() { 1944 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() {
1945 // Nothing to do after scrolling if there are no fixed position elements. 1945 // Nothing to do after scrolling if there are no fixed position elements.
1946 if (!hasViewportConstrainedObjects()) 1946 if (!hasViewportConstrainedObjects())
1947 return; 1947 return;
1948 1948
1949 // Update sticky position objects which are stuck to the viewport. 1949 // Update sticky position objects which are stuck to the viewport. In order to
1950 // correctly compute the sticky position offsets, the layers must be visited
1951 // top-down, so start at the 'root' sticky elements and recurse downwards.
1950 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { 1952 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1951 LayoutObject* layoutObject = viewportConstrainedObject; 1953 LayoutObject* layoutObject = viewportConstrainedObject;
1952 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); 1954 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1953 if (layoutObject->style()->position() == StickyPosition) { 1955 StickyConstraintsMap constraintsMap =
1956 layer->getScrollableArea()->stickyConstraintsMap();
1957 if (layoutObject->style()->position() == StickyPosition &&
1958 constraintsMap.contains(layer) &&
1959 !constraintsMap.get(layer).hasAncestorStickyElement()) {
1954 // TODO(skobes): Resolve circular dependency between scroll offset and 1960 // TODO(skobes): Resolve circular dependency between scroll offset and
1955 // compositing state, and remove this disabler. https://crbug.com/420741 1961 // compositing state, and remove this disabler. https://crbug.com/420741
1956 DisableCompositingQueryAsserts disabler; 1962 DisableCompositingQueryAsserts disabler;
1957 layer->updateLayerPositionsAfterOverflowScroll(); 1963 layer->updateLayerPositionsAfterOverflowScroll();
1958 layoutObject->setMayNeedPaintInvalidationSubtree(); 1964 layoutObject->setMayNeedPaintInvalidationSubtree();
1959 } 1965 }
1960 } 1966 }
1961 1967
1962 // If there fixed position elements, scrolling may cause compositing layers to 1968 // If there fixed position elements, scrolling may cause compositing layers to
1963 // change. Update widget and layer positions after scrolling, but only if 1969 // change. Update widget and layer positions after scrolling, but only if
(...skipping 3097 matching lines...) Expand 10 before | Expand all | Expand 10 after
5061 std::unique_ptr<CompositorAnimationTimeline> timeline) { 5067 std::unique_ptr<CompositorAnimationTimeline> timeline) {
5062 m_animationTimeline = std::move(timeline); 5068 m_animationTimeline = std::move(timeline);
5063 } 5069 }
5064 5070
5065 void FrameView::setAnimationHost( 5071 void FrameView::setAnimationHost(
5066 std::unique_ptr<CompositorAnimationHost> host) { 5072 std::unique_ptr<CompositorAnimationHost> host) {
5067 m_animationHost = std::move(host); 5073 m_animationHost = std::move(host);
5068 } 5074 }
5069 5075
5070 } // namespace blink 5076 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698