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

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

Issue 2716583005: Do not promote position sticky or fixed elements unless they move with scroll. (Closed)
Patch Set: 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 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 return true; 1721 return true;
1722 } 1722 }
1723 return false; 1723 return false;
1724 } 1724 }
1725 1725
1726 bool FrameView::invalidateViewportConstrainedObjects() { 1726 bool FrameView::invalidateViewportConstrainedObjects() {
1727 bool fastPathAllowed = true; 1727 bool fastPathAllowed = true;
1728 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { 1728 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) {
1729 LayoutObject* layoutObject = viewportConstrainedObject; 1729 LayoutObject* layoutObject = viewportConstrainedObject;
1730 LayoutItem layoutItem = LayoutItem(layoutObject); 1730 LayoutItem layoutItem = LayoutItem(layoutObject);
1731 ASSERT(layoutItem.style()->hasViewportConstrainedPosition()); 1731 DCHECK(layoutItem.style()->hasViewportConstrainedPosition() ||
1732 layoutItem.style()->hasStickyConstrainedPosition());
1732 ASSERT(layoutItem.hasLayer()); 1733 ASSERT(layoutItem.hasLayer());
1733 PaintLayer* layer = LayoutBoxModel(layoutItem).layer(); 1734 PaintLayer* layer = LayoutBoxModel(layoutItem).layer();
1734 1735
1735 if (layer->isPaintInvalidationContainer()) 1736 if (layer->isPaintInvalidationContainer())
1736 continue; 1737 continue;
1737 1738
1738 if (layer->subtreeIsInvisible()) 1739 if (layer->subtreeIsInvisible())
1739 continue; 1740 continue;
1740 1741
1741 // invalidate even if there is an ancestor with a filter that moves pixels. 1742 // invalidate even if there is an ancestor with a filter that moves pixels.
(...skipping 3209 matching lines...) Expand 10 before | Expand all | Expand 10 after
4951 4952
4952 for (const LayoutObject* layoutObject : *viewportConstrainedObjects()) { 4953 for (const LayoutObject* layoutObject : *viewportConstrainedObjects()) {
4953 DCHECK(layoutObject->isBoxModelObject() && layoutObject->hasLayer()); 4954 DCHECK(layoutObject->isBoxModelObject() && layoutObject->hasLayer());
4954 DCHECK(layoutObject->style()->position() == EPosition::kFixed || 4955 DCHECK(layoutObject->style()->position() == EPosition::kFixed ||
4955 layoutObject->style()->position() == EPosition::kSticky); 4956 layoutObject->style()->position() == EPosition::kSticky);
4956 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); 4957 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
4957 4958
4958 // Whether the Layer sticks to the viewport is a tree-depenent 4959 // Whether the Layer sticks to the viewport is a tree-depenent
4959 // property and our viewportConstrainedObjects collection is maintained 4960 // property and our viewportConstrainedObjects collection is maintained
4960 // with only LayoutObject-level information. 4961 // with only LayoutObject-level information.
4961 if (!layer->sticksToViewport()) 4962 if (!layer->fixedToViewport() && !layer->sticksToScroller())
4962 continue; 4963 continue;
4963 4964
4964 // If the whole subtree is invisible, there's no reason to scroll on 4965 // If the whole subtree is invisible, there's no reason to scroll on
4965 // the main thread because we don't need to generate invalidations 4966 // the main thread because we don't need to generate invalidations
4966 // for invisible content. 4967 // for invisible content.
4967 if (layer->subtreeIsInvisible()) 4968 if (layer->subtreeIsInvisible())
4968 continue; 4969 continue;
4969 4970
4970 // We're only smart enough to scroll viewport-constrainted objects 4971 // We're only smart enough to scroll viewport-constrainted objects
4971 // in the compositor if they have their own backing or they paint 4972 // in the compositor if they have their own backing or they paint
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
5203 void FrameView::setAnimationHost( 5204 void FrameView::setAnimationHost(
5204 std::unique_ptr<CompositorAnimationHost> host) { 5205 std::unique_ptr<CompositorAnimationHost> host) {
5205 m_animationHost = std::move(host); 5206 m_animationHost = std::move(host);
5206 } 5207 }
5207 5208
5208 LayoutUnit FrameView::caretWidth() const { 5209 LayoutUnit FrameView::caretWidth() const {
5209 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); 5210 return LayoutUnit(getHostWindow()->windowToViewportScalar(1));
5210 } 5211 }
5211 5212
5212 } // namespace blink 5213 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698