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

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

Issue 2636253002: Handle nested position:sticky elements (Closed)
Patch Set: 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 =
1936 // TODO(skobes): Resolve circular dependency between scroll offset and 1938 layer->getScrollableArea()->stickyConstraintsMap();
1937 // compositing state, and remove this disabler. https://crbug.com/420741 1939 if (layoutObject->style()->position() == StickyPosition &&
1938 DisableCompositingQueryAsserts disabler; 1940 constraintsMap.contains(layer)) {
1939 layer->updateLayerPositionsAfterOverflowScroll(); 1941 if (!constraintsMap.get(layer).hasAncestorStickyElement()) {
flackr 2017/01/18 14:42:56 nit: Add condition to outer if rather than nesting
smcgruer 2017/01/18 19:10:50 Done.
1940 layoutObject->setMayNeedPaintInvalidationSubtree(); 1942 // TODO(skobes): Resolve circular dependency between scroll offset and
1943 // compositing state, and remove this disabler. https://crbug.com/420741
1944 DisableCompositingQueryAsserts disabler;
1945 layer->updateLayerPositionsAfterOverflowScroll();
1946 layoutObject->setMayNeedPaintInvalidationSubtree();
1947 }
1941 } 1948 }
1942 } 1949 }
1943 1950
1944 // If there fixed position elements, scrolling may cause compositing layers to 1951 // If there fixed position elements, scrolling may cause compositing layers to
1945 // change. Update widget and layer positions after scrolling, but only if 1952 // change. Update widget and layer positions after scrolling, but only if
1946 // we're not inside of layout. 1953 // we're not inside of layout.
1947 if (!m_nestedLayoutCount) { 1954 if (!m_nestedLayoutCount) {
1948 updateWidgetGeometries(); 1955 updateWidgetGeometries();
1949 LayoutViewItem layoutViewItem = this->layoutViewItem(); 1956 LayoutViewItem layoutViewItem = this->layoutViewItem();
1950 if (!layoutViewItem.isNull()) 1957 if (!layoutViewItem.isNull())
(...skipping 3047 matching lines...) Expand 10 before | Expand all | Expand 10 after
4998 // This is the top-level frame, so no mapping necessary. 5005 // This is the top-level frame, so no mapping necessary.
4999 if (m_frame->isMainFrame()) 5006 if (m_frame->isMainFrame())
5000 return; 5007 return;
5001 5008
5002 LayoutRect viewportIntersectionRect(remoteViewportIntersection()); 5009 LayoutRect viewportIntersectionRect(remoteViewportIntersection());
5003 transformState.move( 5010 transformState.move(
5004 LayoutSize(-viewportIntersectionRect.x(), -viewportIntersectionRect.y())); 5011 LayoutSize(-viewportIntersectionRect.x(), -viewportIntersectionRect.y()));
5005 } 5012 }
5006 5013
5007 } // namespace blink 5014 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698