WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 248020
Add private WKWebView APIs to globally control animation play-state
https://bugs.webkit.org/show_bug.cgi?id=248020
Summary
Add private WKWebView APIs to globally control animation play-state
Tyler Wilcock
Reported
2022-11-16 21:21:00 PST
Add private iOS WKWebView API to pause all and play all animations on the page
Attachments
Patch
(16.84 KB, patch)
2022-11-16 23:41 PST
,
Tyler Wilcock
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(16.80 KB, patch)
2022-11-16 23:58 PST
,
Tyler Wilcock
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(16.87 KB, patch)
2022-11-17 00:33 PST
,
Tyler Wilcock
no flags
Details
Formatted Diff
Diff
Patch
(24.29 KB, patch)
2022-11-28 11:29 PST
,
Tyler Wilcock
no flags
Details
Formatted Diff
Diff
Patch
(30.00 KB, patch)
2022-12-12 20:10 PST
,
Tyler Wilcock
no flags
Details
Formatted Diff
Diff
Patch
(29.81 KB, patch)
2022-12-12 23:56 PST
,
Tyler Wilcock
no flags
Details
Formatted Diff
Diff
Patch
(29.51 KB, patch)
2023-01-06 22:53 PST
,
Tyler Wilcock
no flags
Details
Formatted Diff
Diff
Patch
(29.51 KB, patch)
2023-01-07 20:08 PST
,
Tyler Wilcock
no flags
Details
Formatted Diff
Diff
Show Obsolete
(7)
View All
Add attachment
proposed patch, testcase, etc.
Tyler Wilcock
Comment 1
2022-11-16 23:41:35 PST
Created
attachment 463574
[details]
Patch
Tyler Wilcock
Comment 2
2022-11-16 23:58:02 PST
Created
attachment 463576
[details]
Patch
Tyler Wilcock
Comment 3
2022-11-17 00:33:21 PST
Created
attachment 463577
[details]
Patch
Antoine Quint
Comment 4
2022-11-18 01:11:38 PST
The title of this bug is not specific to animated images, but the patch is.
Radar WebKit Bug Importer
Comment 5
2022-11-23 21:21:17 PST
<
rdar://problem/102638732
>
Tyler Wilcock
Comment 6
2022-11-28 11:29:07 PST
Created
attachment 463766
[details]
Patch
Tyler Wilcock
Comment 7
2022-11-28 11:30:50 PST
(In reply to Antoine Quint from
comment #4
)
> The title of this bug is not specific to animated images, but the patch is.
We talked about this in Slack, but posting here too for posterity. The intention of these APIs is to pause and play all types of animations, not just animated images. So it will include SVG animations, Web Animations, model element animations, etc (the latter two are yet to be implemented). Here's a test exercising the core functionality for SVG and image animations:
https://github.com/WebKit/WebKit/blob/main/LayoutTests/fast/images/pagewide-play-pause-offscreen-animations.html
Darin Adler
Comment 8
2022-11-29 09:28:26 PST
Comment on
attachment 463766
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=463766&action=review
> COMMIT_MESSAGE:1 > +Add private iOS WKWebView APIs: _pauseAllAnimations, _playAllAnimations, _isAnyAnimationAllowedToPlay
Why private?
Tyler Wilcock
Comment 9
2022-11-29 10:00:49 PST
(In reply to Darin Adler from
comment #8
)
> Comment on
attachment 463766
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=463766&action=review
> > > COMMIT_MESSAGE:1 > > +Add private iOS WKWebView APIs: _pauseAllAnimations, _playAllAnimations, _isAnyAnimationAllowedToPlay > > > Why private?
As of now, there will only be one internal consumer. I think we could consider promoting it to a public API later on, but I figured making it private to start is a good first step.
Darin Adler
Comment 10
2022-11-29 10:03:54 PST
(In reply to Tyler Wilcock from
comment #9
)
> As of now, there will only be one internal consumer. I think we could > consider promoting it to a public API later on, but I figured making it > private to start is a good first step.
I don’t agree with this general principle. We should discuss our approach so we don’t build up an even longer list of private API.
Said Abou-Hallawa
Comment 11
2022-11-29 10:41:28 PST
Comment on
attachment 463766
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=463766&action=review
> COMMIT_MESSAGE:28 > +tests in AnimationControl.mm to pass consistently.
Can you explain why this change is needed to make the tests pass consistently?
> Source/WebCore/platform/graphics/BitmapImage.cpp:446 > + m_animationIsRunning = !!m_frameTimer;
This is a weird place to set this flag.
> Source/WebCore/platform/graphics/BitmapImage.h:241 > + bool m_animationIsRunning { false };
What is the meaning of this flag? And what is the difference between its value and the value of canAnimate()? I think you are changing its meaning. It is currently true when we are displaying a frame, waiting for its interval to elapse to draw the next frame. With your change it I think it will mean whether the image is animating or still since it is not cleared in BitmapImage::clearTimer(). Also it is weird to have two flags m_animationIsRunning and m_animationFinished although each of them means the opposite to the other. How can we guarantee they are not both set to true? Actually having both of them initialized with false is confusing. If m_animationIsRunning is false then m_animationFinished should be true.
Said Abou-Hallawa
Comment 12
2022-11-29 15:50:03 PST
Comment on
attachment 463766
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=463766&action=review
>> Source/WebCore/platform/graphics/BitmapImage.h:241 >> + bool m_animationIsRunning { false }; > > What is the meaning of this flag? And what is the difference between its value and the value of canAnimate()? > > I think you are changing its meaning. It is currently true when we are displaying a frame, waiting for its interval to elapse to draw the next frame. With your change it I think it will mean whether the image is animating or still since it is not cleared in BitmapImage::clearTimer(). > > Also it is weird to have two flags m_animationIsRunning and m_animationFinished although each of them means the opposite to the other. How can we guarantee they are not both set to true? Actually having both of them initialized with false is confusing. If m_animationIsRunning is false then m_animationFinished should be true.
I meant to say you are changing the meaning of BitmapImage::isAnimating() since it is now returning m_animationIsRunning.
James Craig
Comment 13
2022-12-12 11:01:39 PST
It may be wise to keep the new API private until CSS has a resolution on Issue #7440?
https://github.com/w3c/csswg-drafts/issues/7440
Tyler Wilcock
Comment 14
2022-12-12 20:10:37 PST
Created
attachment 464018
[details]
Patch
Tyler Wilcock
Comment 15
2022-12-12 20:15:19 PST
(In reply to Said Abou-Hallawa from
comment #11
)
> Comment on
attachment 463766
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=463766&action=review
> > > COMMIT_MESSAGE:28 > > +tests in AnimationControl.mm to pass consistently. > > Can you explain why this change is needed to make the tests pass > consistently? > > > Source/WebCore/platform/graphics/BitmapImage.cpp:446 > > + m_animationIsRunning = !!m_frameTimer; > > This is a weird place to set this flag. > > > Source/WebCore/platform/graphics/BitmapImage.h:241 > > + bool m_animationIsRunning { false }; > > What is the meaning of this flag? And what is the difference between its > value and the value of canAnimate()? > > I think you are changing its meaning. It is currently true when we are > displaying a frame, waiting for its interval to elapse to draw the next > frame. With your change it I think it will mean whether the image is > animating or still since it is not cleared in BitmapImage::clearTimer(). > > Also it is weird to have two flags m_animationIsRunning and > m_animationFinished although each of them means the opposite to the other. > How can we guarantee they are not both set to true? Actually having both of > them initialized with false is confusing. If m_animationIsRunning is false > then m_animationFinished should be true.
Thanks for the insight! I was able to write the test such that the changes to BitmapImage::isAnimating are unnecessary.
Tyler Wilcock
Comment 16
2022-12-12 23:56:20 PST
Created
attachment 464021
[details]
Patch
chris fleizach
Comment 17
2022-12-27 23:48:14 PST
(In reply to Tyler Wilcock from
comment #16
)
> Created
attachment 464021
[details]
> Patch
Looks like feedback has been addressed and public API has been pended for good reasons. I'm inclined to approve this.
Tyler Wilcock
Comment 18
2023-01-06 22:53:43 PST
Created
attachment 464393
[details]
Patch
Tyler Wilcock
Comment 19
2023-01-07 20:08:11 PST
Created
attachment 464409
[details]
Patch
EWS
Comment 20
2023-01-09 10:13:52 PST
Committed
258671@main
(c6458455e6da): <
https://commits.webkit.org/258671@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 464409
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug