diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /dom/svg/SVGSVGElement.cpp | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/svg/SVGSVGElement.cpp')
-rw-r--r-- | dom/svg/SVGSVGElement.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/dom/svg/SVGSVGElement.cpp b/dom/svg/SVGSVGElement.cpp index f7282569f9..04f5b8662e 100644 --- a/dom/svg/SVGSVGElement.cpp +++ b/dom/svg/SVGSVGElement.cpp @@ -193,23 +193,30 @@ float SVGSVGElement::GetCurrentTimeAsFloat() { } void SVGSVGElement::SetCurrentTime(float seconds) { - if (mTimedDocumentRoot) { - // Make sure the timegraph is up-to-date - FlushAnimations(); - double fMilliseconds = double(seconds) * PR_MSEC_PER_SEC; - // Round to nearest whole number before converting, to avoid precision - // errors - SMILTime lMilliseconds = SVGUtils::ClampToInt64(NS_round(fMilliseconds)); - mTimedDocumentRoot->SetCurrentTime(lMilliseconds); - AnimationNeedsResample(); - // Trigger synchronous sample now, to: - // - Make sure we get an up-to-date paint after this method - // - re-enable event firing (it got disabled during seeking, and it - // doesn't get re-enabled until the first sample after the seek -- so - // let's make that happen now.) - FlushAnimations(); + if (!mTimedDocumentRoot) { + // we're not the outermost <svg> or not bound to a tree, so silently fail + return; } - // else we're not the outermost <svg> or not bound to a tree, so silently fail + // Make sure the timegraph is up-to-date + if (auto* currentDoc = GetComposedDoc()) { + currentDoc->FlushPendingNotifications(FlushType::Style); + } + if (!mTimedDocumentRoot) { + return; + } + FlushAnimations(); + double fMilliseconds = double(seconds) * PR_MSEC_PER_SEC; + // Round to nearest whole number before converting, to avoid precision + // errors + SMILTime lMilliseconds = SVGUtils::ClampToInt64(NS_round(fMilliseconds)); + mTimedDocumentRoot->SetCurrentTime(lMilliseconds); + AnimationNeedsResample(); + // Trigger synchronous sample now, to: + // - Make sure we get an up-to-date paint after this method + // - re-enable event firing (it got disabled during seeking, and it + // doesn't get re-enabled until the first sample after the seek -- so + // let's make that happen now.) + FlushAnimations(); } void SVGSVGElement::DeselectAll() { |