[webkit-changes] [WebKit/WebKit] 9ed7eb: [scroll-animations] Fix computeViewTimelineData ca...

Nikos Mouchtaris noreply at github.com
Fri Sep 27 16:41:59 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9ed7eb275fc90b1b3ff4a2878aa6d77eb475ced7
      https://github.com/WebKit/WebKit/commit/9ed7eb275fc90b1b3ff4a2878aa6d77eb475ced7
  Author: Nikolaos Mouchtaris <nmouchtaris at apple.com>
  Date:   2024-09-27 (Fri, 27 Sep 2024)

  Changed paths:
    M Source/WebCore/animation/ViewTimeline.cpp
    M Source/WebCore/animation/ViewTimeline.h
    M Source/WebCore/page/scrolling/ScrollAnchoringController.cpp
    M Source/WebCore/page/scrolling/ScrollAnchoringController.h

  Log Message:
  -----------
  [scroll-animations] Fix computeViewTimelineData calculation
https://bugs.webkit.org/show_bug.cgi?id=280444
rdar://136789447

Reviewed by Antoine Quint.

Previously this calculation had coverRangeEnd take into account the current scroll offset
which was incorrect. Update the progress calculation to be more in line with the spec. Also
update subjectOffset to use offsetTop/Left since we need an offset that is not affected by
scroll position. This is not correct for situations where offsetParent is different than the
source scroller, so we may need a solution that walks up the tree and adds scrollTop/Left. Also
update the comment and filed an issue (https://github.com/w3c/csswg-drafts/issues/10960) due
to a small issue in the spec.

To help visualize this calculation, there is a tool: https://scroll-driven-animations.style/tools/view-timeline/ranges/.
coverRangeStart is equivalent to the scroll offset necessary to have the top edge of the subject touch
the bottom edge of the scroller. Conversly, coverRangeEnd is equivalent to the scroll offset necessary
to have the bottom edge of the subject touch the top edge of the scroller. Note that this calculation is
only correct for the cover named timeline range. This will be further complicated when we start
doing calculations for other timeline ranges, which correspond to different start and end positions for
the subject.

* Source/WebCore/animation/ViewTimeline.cpp:
(WebCore::ViewTimeline::computeViewTimelineData const):
(WebCore::ViewTimeline::startOffset const):
(WebCore::ViewTimeline::endOffset const):
* Source/WebCore/animation/ViewTimeline.h:

Canonical link: https://commits.webkit.org/284398@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list