-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[css-anchor-position-1] Scroll adjustment not applied for position:fixed anchored boxes #47291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
EWS run on previous version of this PR (hash b7c6dc0) |
b7c6dc0
to
87b333b
Compare
EWS run on previous version of this PR (hash 87b333b) |
@@ -1006,6 +1006,9 @@ void RenderElement::styleWillChange(StyleDifference diff, const RenderStyle& new | |||
if (drawsRootBackground && newStyle.hasEntirelyFixedBackground() && view().compositor().supportsFixedRootBackgroundCompositing()) | |||
newStyleSlowScroll = false; | |||
} | |||
// FIXME: Scrolling tree support for anchor positioning. | |||
if (newStyle.position() == PositionType::Fixed && Style::AnchorPositionEvaluator::isAnchorPositioned(newStyle)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about sticky positioning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sticky can't be anchor positioned, only fixed and absolute.
@@ -1176,7 +1179,7 @@ void RenderElement::willBeDestroyed() | |||
if (!renderTreeBeingDestroyed() && element()) | |||
document().contentChangeObserver().rendererWillBeDestroyed(*element()); | |||
#endif | |||
if (m_style.hasAnyFixedBackground() && !settings().fixedBackgroundsPaintRelativeToDocument()) | |||
if ((m_style.hasAnyFixedBackground() && !settings().fixedBackgroundsPaintRelativeToDocument()) || (m_style.position() == PositionType::Fixed && Style::AnchorPositionEvaluator::isAnchorPositioned(m_style))) | |||
view().protectedFrameView()->removeSlowRepaintObject(*this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not ideal to use the "slow repaint" logic for this; this is about needing to layout after scroll, not about painting. This is more like the setViewportConstrainedObjectsNeedLayout
code path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is about needing compositing update for every frame.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically LocalFrameView::shouldUpdateCompositingLayersAfterScrolling() needs to return true in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a version using viewport constrained objects.
@@ -6012,6 +6013,9 @@ void RenderLayerCompositor::updateSynchronousScrollingNodes() | |||
} else if (!layer->behavesAsFixed()) { | |||
LOG_WITH_STREAM(Scrolling, stream << "RenderLayerCompositor::updateSynchronousScrollingNodes - root node slow-scrolling because of fixed backgrounds"); | |||
rootHasSlowRepaintObjects = true; | |||
} else if (Style::AnchorPositionEvaluator::isAnchorPositioned(renderer.style())) { | |||
LOG_WITH_STREAM(Scrolling, stream << "RenderLayerCompositor::updateSynchronousScrollingNodes - root node slow-scrolling because of a fixed anchored element"); | |||
rootHasSlowRepaintObjects = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, mixing layout with repainting.
|
||
auto offset = LayoutSize { }; | ||
for (auto* ancestor = descendant.container(); ancestor && ancestor != &ancestorContainer; ancestor = ancestor->container()) { | ||
bool isFixedAnchor = anchor.isFixedPositioned(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to consider sticky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
for (auto* ancestor = descendant.container(); ancestor && ancestor != &ancestorContainer; ancestor = ancestor->container()) { | ||
bool isFixedAnchor = anchor.isFixedPositioned(); | ||
|
||
for (auto* ancestor = anchor.container(); ancestor && ancestor != containingBlock; ancestor = ancestor->container()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CheckedPtr?
87b333b
to
6e95cfc
Compare
EWS run on previous version of this PR (hash 6e95cfc) |
6e95cfc
to
e52b786
Compare
EWS run on current version of this PR (hash e52b786) |
…xed anchored boxes https://bugs.webkit.org/show_bug.cgi?id=295002 rdar://154348421 Reviewed by Simon Fraser. Compute scroll adjustment correctly for fixed positioned anchored boxes. * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-006-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-002-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-004-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-005-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-006-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-007-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-008-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-009-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-anchor-position/anchor-scroll-position-try-010-expected.txt: * Source/WebCore/page/LocalFrameView.cpp: (WebCore::LocalFrameView::addViewportConstrainedObject): (WebCore::LocalFrameView::removeViewportConstrainedObject): (WebCore::LocalFrameView::hasAnchorPositionedViewportConstrainedObjects const): See if any of the viewport constrained objects are anchor positioned. (WebCore::LocalFrameView::clearCachedHasAnchorPositionedViewportConstrainedObjects): (WebCore::LocalFrameView::shouldUpdateCompositingLayersAfterScrolling const): We need to update compositing layers on every frame if there are fixed anchor positioned boxes. (WebCore::LocalFrameView::updateAnchorPositionedAfterScroll): We need to update anchor positions after document scroll too. * Source/WebCore/page/LocalFrameView.h: * Source/WebCore/platform/ScrollableArea.cpp: (WebCore::ScrollableArea::scrollPositionChanged): * Source/WebCore/platform/ScrollableArea.h: (WebCore::ScrollableArea::updateAnchorPositionedAfterScroll): Factor into a separate virtual function, invoked from ScrollableArea::scrollPositionChanged. * Source/WebCore/rendering/RenderBox.cpp: (WebCore::RenderBox::styleWillChange): Clear the cached fixed-with-anchor bit if anchor positioned style changes. * Source/WebCore/rendering/RenderLayer.cpp: (WebCore::RenderLayer::updateLayerPositionsAfterOverflowScroll): (WebCore::RenderLayer::updateLayerPositionsAfterDocumentScroll): * Source/WebCore/rendering/RenderLayerScrollableArea.cpp: (WebCore::RenderLayerScrollableArea::scrollTo): Move to RenderLayer::updateLayerPositionsAfterOverflowScroll. * Source/WebCore/style/AnchorPositionEvaluator.cpp: (WebCore::Style::scrollOffsetFromAnchor): Take fixed position into account when computing scroll offset. (WebCore::Style::AnchorPositionEvaluator::updateSnapshottedScrollOffsets): Use defaultAnchorForBox() to figure out if we need scroll compensation. (WebCore::Style::AnchorPositionEvaluator::updatePositionsAfterScroll): (WebCore::Style::AnchorPositionEvaluator::isAnchorPositioned): (WebCore::Style::scrollOffsetFromAncestorContainer): Deleted. (WebCore::Style::AnchorPositionEvaluator::updateAfterOverflowScroll): Deleted. * Source/WebCore/style/AnchorPositionEvaluator.h: Canonical link: https://commits.webkit.org/296811@main
e52b786
to
de4580f
Compare
Committed 296811@main (de4580f): https://commits.webkit.org/296811@main Reviewed commits have been landed. Closing PR #47291 and removing active labels. |
de4580f
e52b786