[webkit-reviews] review granted: [Bug 227949] [css-scroll-snap] Don't snap to offscreen snap areas in unidirectional scrolls : [Attachment 435192] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Aug 17 23:01:21 PDT 2021
Frédéric Wang (:fredw) <fred.wang at free.fr> has granted Martin Robinson
<mrobinson at webkit.org>'s request for review:
Bug 227949: [css-scroll-snap] Don't snap to offscreen snap areas in
unidirectional scrolls
https://bugs.webkit.org/show_bug.cgi?id=227949
Attachment 435192: Patch
https://bugs.webkit.org/attachment.cgi?id=435192&action=review
--- Comment #3 from Frédéric Wang (:fredw) <fred.wang at free.fr> ---
Comment on attachment 435192
--> https://bugs.webkit.org/attachment.cgi?id=435192
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=435192&action=review
> Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp:124
> +static void adjustPreviousAndNextForOnscreenSnapAreas(const InfoType& info,
ScrollEventAxis axis, const SizeType& viewportSize, PointType
destinationOffsetPoint, PotentialSnapPointSearchResult<UnitType>& searchResult)
nit: OnScreen?
> Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp:135
> + }
To avoid the type mismatch, I would rewrite this:
unsigned oldIndex = (*searchResult.previous).second;
searchResult.previous.reset();
for (unsigned i = 0; i <= oldIndex; i++) {
const auto& snapOffset = snapOffsets[oldIndex - i];
if (hasCompatibleSnapArea(info, snapOffset, axis, viewportSize,
destinationOffsetPoint)) {
searchResult.previous = std::make_pair(snapOffset.offset, oldIndex -
i);
break;
}
}
> Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp:144
> + }
and this
unsigned oldIndex = (*searchResult.next).second;
searchResult.next.reset();
for (unsigned i = oldIndex, i < snapOffsets.size(); i++) {
const auto& snapOffset = snapOffsets[i];
if (hasCompatibleSnapArea(info, snapOffset, axis, viewportSize,
destinationOffsetPoint)) {
searchResult.next = std::make_pair(snapOffset.offset, i);
break;
}
}
> Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp:162
> + adjustPreviousAndNextForOnscreenSnapAreas<InfoType, LayoutType,
PointType, SizeType>(info, axis, viewportSize, scrollDestinationOffsetPoint,
searchResult);
OnScreen
> LayoutTests/imported/w3c/ChangeLog:10
> + scrolling test no longer snaps because we don't have support for
choosing between two candidates
"no longer": it was already not passing before this change right?
More information about the webkit-reviews
mailing list