Bug 1626794 - Add strong ref to document and MOZ_CAN_RUN_SCRIPT annotation to Animation::CommitStyles r=hiro

Differential Revision: https://phabricator.services.mozilla.com/D75418
This commit is contained in:
Emily McDonough 2020-05-17 20:47:37 +00:00
Родитель baa852c82b
Коммит 0ee5c5dc91
2 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -707,10 +707,13 @@ void Animation::CommitStyles(ErrorResult& aRv) {
"Target is not capable of having a style attribute");
}
// Hold onto a strong reference to the doc in case the flush destroys it.
RefPtr<Document> doc = target.mElement->GetComposedDoc();
// Flush frames before checking if the target element is rendered since the
// result could depend on pending style changes, and IsRendered() looks at the
// primary frame.
if (Document* doc = target.mElement->GetComposedDoc()) {
if (doc) {
doc->FlushPendingNotifications(FlushType::Frames);
}
if (!target.mElement->IsRendered()) {

Просмотреть файл

@ -150,7 +150,7 @@ class Animation : public DOMEventTargetHelper,
virtual void Reverse(ErrorResult& aRv);
void Persist();
void CommitStyles(ErrorResult& aRv);
MOZ_CAN_RUN_SCRIPT void CommitStyles(ErrorResult& aRv);
bool IsRunningOnCompositor() const;