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

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

Issue 2636253002: Handle nested position:sticky elements (Closed)
Patch Set: Trying to add cc unittest, fails for unknown reason 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 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1937 void FrameView::didScrollTimerFired(TimerBase*) { 1937 void FrameView::didScrollTimerFired(TimerBase*) {
1938 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull()) 1938 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull())
1939 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); 1939 m_frame->document()->fetcher()->updateAllImageResourcePriorities();
1940 } 1940 }
1941 1941
1942 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() { 1942 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() {
1943 // Nothing to do after scrolling if there are no fixed position elements. 1943 // Nothing to do after scrolling if there are no fixed position elements.
1944 if (!hasViewportConstrainedObjects()) 1944 if (!hasViewportConstrainedObjects())
1945 return; 1945 return;
1946 1946
1947 // Update sticky position objects which are stuck to the viewport. 1947 // Update sticky position objects which are stuck to the viewport. In order to
1948 // correctly compute the sticky position offsets, the layers must be visited
1949 // top-down, so start at the 'root' sticky elements and recurse downwards.
1948 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { 1950 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1949 LayoutObject* layoutObject = viewportConstrainedObject; 1951 LayoutObject* layoutObject = viewportConstrainedObject;
1950 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); 1952 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1951 if (layoutObject->style()->position() == StickyPosition) { 1953 StickyConstraintsMap constraintsMap = layer->ancestorOverflowLayer()
1954 ->getScrollableArea()
1955 ->stickyConstraintsMap();
1956 if (layoutObject->style()->position() == StickyPosition &&
1957 constraintsMap.contains(layer) &&
1958 !constraintsMap.get(layer).hasAncestorStickyElement()) {
1952 // TODO(skobes): Resolve circular dependency between scroll offset and 1959 // TODO(skobes): Resolve circular dependency between scroll offset and
1953 // compositing state, and remove this disabler. https://crbug.com/420741 1960 // compositing state, and remove this disabler. https://crbug.com/420741
1954 DisableCompositingQueryAsserts disabler; 1961 DisableCompositingQueryAsserts disabler;
1955 layer->updateLayerPositionsAfterOverflowScroll(); 1962 layer->updateLayerPositionsAfterOverflowScroll();
1956 layoutObject->setMayNeedPaintInvalidationSubtree(); 1963 layoutObject->setMayNeedPaintInvalidationSubtree();
1957 } 1964 }
1958 } 1965 }
1959 1966
1960 // If there fixed position elements, scrolling may cause compositing layers to 1967 // If there fixed position elements, scrolling may cause compositing layers to
1961 // change. Update widget and layer positions after scrolling, but only if 1968 // change. Update widget and layer positions after scrolling, but only if
(...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after
5095 std::unique_ptr<CompositorAnimationTimeline> timeline) { 5102 std::unique_ptr<CompositorAnimationTimeline> timeline) {
5096 m_animationTimeline = std::move(timeline); 5103 m_animationTimeline = std::move(timeline);
5097 } 5104 }
5098 5105
5099 void FrameView::setAnimationHost( 5106 void FrameView::setAnimationHost(
5100 std::unique_ptr<CompositorAnimationHost> host) { 5107 std::unique_ptr<CompositorAnimationHost> host) {
5101 m_animationHost = std::move(host); 5108 m_animationHost = std::move(host);
5102 } 5109 }
5103 5110
5104 } // namespace blink 5111 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698