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

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

Issue 2636253002: Handle nested position:sticky elements (Closed)
Patch Set: Rebase 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 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 void FrameView::didScrollTimerFired(TimerBase*) { 1950 void FrameView::didScrollTimerFired(TimerBase*) {
1951 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull()) 1951 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull())
1952 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); 1952 m_frame->document()->fetcher()->updateAllImageResourcePriorities();
1953 } 1953 }
1954 1954
1955 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() { 1955 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() {
1956 // Nothing to do after scrolling if there are no fixed position elements. 1956 // Nothing to do after scrolling if there are no fixed position elements.
1957 if (!hasViewportConstrainedObjects()) 1957 if (!hasViewportConstrainedObjects())
1958 return; 1958 return;
1959 1959
1960 // Update sticky position objects which are stuck to the viewport. 1960 // Update sticky position objects which are stuck to the viewport. In order to
1961 // correctly compute the sticky position offsets, the layers must be visited
1962 // top-down, so start at the 'root' sticky elements and recurse downwards.
1961 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { 1963 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1962 LayoutObject* layoutObject = viewportConstrainedObject; 1964 LayoutObject* layoutObject = viewportConstrainedObject;
1963 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); 1965 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1964 if (layoutObject->style()->position() == EPosition::kSticky) { 1966 StickyConstraintsMap constraintsMap = layer->ancestorOverflowLayer()
1967 ->getScrollableArea()
1968 ->stickyConstraintsMap();
1969 if (layoutObject->style()->position() == EPosition::kSticky &&
1970 constraintsMap.contains(layer) &&
1971 !constraintsMap.get(layer).hasAncestorStickyElement()) {
1965 // TODO(skobes): Resolve circular dependency between scroll offset and 1972 // TODO(skobes): Resolve circular dependency between scroll offset and
1966 // compositing state, and remove this disabler. https://crbug.com/420741 1973 // compositing state, and remove this disabler. https://crbug.com/420741
1967 DisableCompositingQueryAsserts disabler; 1974 DisableCompositingQueryAsserts disabler;
1968 layer->updateLayerPositionsAfterOverflowScroll(); 1975 layer->updateLayerPositionsAfterOverflowScroll();
1969 layoutObject->setMayNeedPaintInvalidationSubtree(); 1976 layoutObject->setMayNeedPaintInvalidationSubtree();
1970 } 1977 }
1971 } 1978 }
1972 1979
1973 // If there fixed position elements, scrolling may cause compositing layers to 1980 // If there fixed position elements, scrolling may cause compositing layers to
1974 // change. Update widget and layer positions after scrolling, but only if 1981 // change. Update widget and layer positions after scrolling, but only if
(...skipping 3208 matching lines...) Expand 10 before | Expand all | Expand 10 after
5183 void FrameView::setAnimationHost( 5190 void FrameView::setAnimationHost(
5184 std::unique_ptr<CompositorAnimationHost> host) { 5191 std::unique_ptr<CompositorAnimationHost> host) {
5185 m_animationHost = std::move(host); 5192 m_animationHost = std::move(host);
5186 } 5193 }
5187 5194
5188 LayoutUnit FrameView::caretWidth() const { 5195 LayoutUnit FrameView::caretWidth() const {
5189 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); 5196 return LayoutUnit(getHostWindow()->windowToViewportScalar(1));
5190 } 5197 }
5191 5198
5192 } // namespace blink 5199 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698