Bug 142870

Summary: CSS Animations with triggers should map scroll position to duration
Product: WebKit Reporter: Dean Jackson <dino>
Component: AnimationsAssignee: Dean Jackson <dino>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, commit-queue, dino, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
simon.fraser: review+
Patch none

Dean Jackson
Reported 2015-03-19 11:26:37 PDT
Expose a prototype implementation of what will eventually be called animation-timebase, mapping the scroll location to the duration of an animation. This only applies if the animation has a start and end trigger.
Attachments
Patch (17.74 KB, patch)
2015-03-19 15:42 PDT, Dean Jackson
simon.fraser: review+
Patch (25.52 KB, patch)
2015-03-19 18:52 PDT, Dean Jackson
no flags
Radar WebKit Bug Importer
Comment 1 2015-03-19 11:48:52 PDT
Dean Jackson
Comment 2 2015-03-19 15:42:22 PDT
Simon Fraser (smfr)
Comment 3 2015-03-19 15:53:32 PDT
Comment on attachment 249067 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=249067&action=review > Source/WebCore/css/CSSToStyleMap.cpp:539 > + bool hasEnd = false; I don't think you need the hasEnd variable. > Source/WebCore/page/animation/AnimationBase.cpp:482 > + // time is determined by the scroll position. We should stop calling this elapsedTime > Source/WebCore/page/animation/AnimationBase.cpp:710 > + if (scrollTrigger.hasEndValue() && m_object) { Can we make m_object a reference (later)? > Source/WebCore/page/animation/AnimationBase.cpp:711 > + float offset = m_object->view().frameView().scrollOffsetForFixedPosition().height().toFloat(); I think we should snapshot the scroll position when we snapshot the animation time. Fetching it all over the place feels error-prone. > Source/WebCore/page/animation/AnimationBase.cpp:718 > + return m_animation->duration() * (offset - startValue) / (endValue - startValue); What if endValue == startValue? Please add a test for this case. > Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:871 > + ScrollAnimationTrigger& scrollTrigger = downcast<ScrollAnimationTrigger>(*anim->trigger().get()); > + if (scrollTrigger.hasEndValue()) What about startValue?
Dean Jackson
Comment 4 2015-03-19 18:52:07 PDT
Dean Jackson
Comment 5 2015-03-19 18:52:20 PDT
Comment on attachment 249067 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=249067&action=review >> Source/WebCore/css/CSSToStyleMap.cpp:539 >> + bool hasEnd = false; > > I don't think you need the hasEnd variable. I removed it but it means I have two calls to setTrigger, each side of the conditional. >> Source/WebCore/page/animation/AnimationBase.cpp:482 >> + // time is determined by the scroll position. > > We should stop calling this elapsedTime Agreed. I'll do that in a followup patch. >> Source/WebCore/page/animation/AnimationBase.cpp:710 >> + if (scrollTrigger.hasEndValue() && m_object) { > > Can we make m_object a reference (later)? Yes. >> Source/WebCore/page/animation/AnimationBase.cpp:711 >> + float offset = m_object->view().frameView().scrollOffsetForFixedPosition().height().toFloat(); > > I think we should snapshot the scroll position when we snapshot the animation time. Fetching it all over the place feels error-prone. Done >> Source/WebCore/page/animation/AnimationBase.cpp:718 >> + return m_animation->duration() * (offset - startValue) / (endValue - startValue); > > What if endValue == startValue? > > Please add a test for this case. OK!
Dean Jackson
Comment 6 2015-03-19 18:52:42 PDT
Checking the patch on EWS before landing.
WebKit Commit Bot
Comment 7 2015-03-19 18:54:40 PDT
Attachment 249076 [details] did not pass style-queue: ERROR: Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1241: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Total errors found: 1 in 15 files If any of these errors are false positives, please file a bug against check-webkit-style.
Dean Jackson
Comment 8 2015-03-19 21:48:38 PDT
Alexey Proskuryakov
Comment 9 2015-03-20 10:28:22 PDT
Note You need to log in before you can comment on or make changes to this bug.