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

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

Issue 2708883005: Handle nested position:sticky elements correctly (main thread) (Closed)
Patch Set: Rebase Created 3 years, 9 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 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 void FrameView::didScrollTimerFired(TimerBase*) { 1958 void FrameView::didScrollTimerFired(TimerBase*) {
1959 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull()) 1959 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull())
1960 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); 1960 m_frame->document()->fetcher()->updateAllImageResourcePriorities();
1961 } 1961 }
1962 1962
1963 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() { 1963 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() {
1964 // Nothing to do after scrolling if there are no fixed position elements. 1964 // Nothing to do after scrolling if there are no fixed position elements.
1965 if (!hasViewportConstrainedObjects()) 1965 if (!hasViewportConstrainedObjects())
1966 return; 1966 return;
1967 1967
1968 // Update sticky position objects which are stuck to the viewport. 1968 // Update sticky position objects which are stuck to the viewport. In order to
1969 // correctly compute the sticky position offsets the layers must be visited
1970 // top-down, so start at the 'root' sticky elements and recurse downwards.
1969 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { 1971 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1970 LayoutObject* layoutObject = viewportConstrainedObject; 1972 LayoutObject* layoutObject = viewportConstrainedObject;
1973 if (layoutObject->style()->position() != EPosition::kSticky)
1974 continue;
1975
1971 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); 1976 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
1972 if (layoutObject->style()->position() == EPosition::kSticky) { 1977 StickyConstraintsMap constraintsMap = layer->ancestorOverflowLayer()
1978 ->getScrollableArea()
1979 ->stickyConstraintsMap();
1980 if (constraintsMap.contains(layer) &&
1981 !constraintsMap.at(layer).hasAncestorStickyElement()) {
1973 // TODO(skobes): Resolve circular dependency between scroll offset and 1982 // TODO(skobes): Resolve circular dependency between scroll offset and
1974 // compositing state, and remove this disabler. https://crbug.com/420741 1983 // compositing state, and remove this disabler. https://crbug.com/420741
1975 DisableCompositingQueryAsserts disabler; 1984 DisableCompositingQueryAsserts disabler;
1976 layer->updateLayerPositionsAfterOverflowScroll(); 1985 layer->updateLayerPositionsAfterOverflowScroll();
1977 layoutObject->setMayNeedPaintInvalidationSubtree(); 1986 layoutObject->setMayNeedPaintInvalidationSubtree();
1978 } 1987 }
1979 } 1988 }
1980 1989
1981 // If there fixed position elements, scrolling may cause compositing layers to 1990 // If there fixed position elements, scrolling may cause compositing layers to
1982 // change. Update widget and layer positions after scrolling, but only if 1991 // change. Update widget and layer positions after scrolling, but only if
(...skipping 3220 matching lines...) Expand 10 before | Expand all | Expand 10 after
5203 void FrameView::setAnimationHost( 5212 void FrameView::setAnimationHost(
5204 std::unique_ptr<CompositorAnimationHost> host) { 5213 std::unique_ptr<CompositorAnimationHost> host) {
5205 m_animationHost = std::move(host); 5214 m_animationHost = std::move(host);
5206 } 5215 }
5207 5216
5208 LayoutUnit FrameView::caretWidth() const { 5217 LayoutUnit FrameView::caretWidth() const {
5209 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); 5218 return LayoutUnit(getHostWindow()->windowToViewportScalar(1));
5210 } 5219 }
5211 5220
5212 } // namespace blink 5221 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698