diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp index c0427bd2f458..cd34d8765400 100644 --- a/dom/animation/Animation.cpp +++ b/dom/animation/Animation.cpp @@ -1953,22 +1953,6 @@ void Animation::SetHiddenByContentVisibility(bool hidden) { GetTimeline()->NotifyAnimationContentVisibilityChanged(this, !hidden); } -void Animation::UpdateHiddenByContentVisibility() { - // To be consistent with nsIFrame::UpdateAnimationVisibility, here we only - // deal with CSSAnimation and CSSTransition. - if (!AsCSSAnimation() && !AsCSSTransition()) { - return; - } - NonOwningAnimationTarget target = GetTargetForAnimation(); - if (!target) { - return; - } - if (auto* frame = target.mElement->GetPrimaryFrame()) { - SetHiddenByContentVisibility( - frame->IsHiddenByContentVisibilityOnAnyAncestor()); - } -} - StickyTimeDuration Animation::IntervalStartTime( const StickyTimeDuration& aActiveDuration) const { MOZ_ASSERT(AsCSSTransition() || AsCSSAnimation(), diff --git a/dom/animation/Animation.h b/dom/animation/Animation.h index 56c0f86d5087..a9e082e80ae0 100644 --- a/dom/animation/Animation.h +++ b/dom/animation/Animation.h @@ -399,7 +399,6 @@ class Animation : public DOMEventTargetHelper, bool IsHiddenByContentVisibility() const { return mHiddenByContentVisibility; } - void UpdateHiddenByContentVisibility(); DocGroup* GetDocGroup(); void SetSyncWithGeometricAnimations() { mSyncWithGeometricAnimations = true; } diff --git a/dom/animation/AnimationTimeline.cpp b/dom/animation/AnimationTimeline.cpp index a684cd60cfee..e8ff3025a454 100644 --- a/dom/animation/AnimationTimeline.cpp +++ b/dom/animation/AnimationTimeline.cpp @@ -112,10 +112,4 @@ void AnimationTimeline::NotifyAnimationContentVisibilityChanged( } } -void AnimationTimeline::UpdateHiddenByContentVisibility() { - for (Animation* animation : mAnimations) { - animation->UpdateHiddenByContentVisibility(); - } -} - } // namespace mozilla::dom diff --git a/dom/animation/AnimationTimeline.h b/dom/animation/AnimationTimeline.h index 6226bbb17908..5b33481ac7ff 100644 --- a/dom/animation/AnimationTimeline.h +++ b/dom/animation/AnimationTimeline.h @@ -113,7 +113,6 @@ class AnimationTimeline : public nsISupports, public nsWrapperCache { virtual void RemoveAnimation(Animation* aAnimation); virtual void NotifyAnimationContentVisibilityChanged(Animation* aAnimation, bool aIsVisible); - void UpdateHiddenByContentVisibility(); virtual Document* GetDocument() const = 0; diff --git a/dom/animation/ScrollTimeline.cpp b/dom/animation/ScrollTimeline.cpp index 27ea7de09abc..eeb9571494a7 100644 --- a/dom/animation/ScrollTimeline.cpp +++ b/dom/animation/ScrollTimeline.cpp @@ -263,17 +263,6 @@ const nsIScrollableFrame* ScrollTimeline::GetScrollFrame() const { return nullptr; } -void ScrollTimeline::NotifyAnimationContentVisibilityChanged( - Animation* aAnimation, bool aIsVisible) { - AnimationTimeline::NotifyAnimationContentVisibilityChanged(aAnimation, - aIsVisible); - if (mAnimationOrder.isEmpty()) { - UnregisterFromScrollSource(); - } else { - RegisterWithScrollSource(); - } -} - // ------------------------------------ // Methods of ProgressTimelineScheduler // ------------------------------------ diff --git a/dom/animation/ScrollTimeline.h b/dom/animation/ScrollTimeline.h index 58ab9586d946..0984845dc8f2 100644 --- a/dom/animation/ScrollTimeline.h +++ b/dom/animation/ScrollTimeline.h @@ -197,9 +197,6 @@ class ScrollTimeline : public AnimationTimeline { PseudoStyleType aPseudoType, const StyleScrollTimeline& aNew); - void NotifyAnimationContentVisibilityChanged(Animation* aAnimation, - bool aIsVisible) override; - protected: virtual ~ScrollTimeline() { Teardown(); } ScrollTimeline() = delete; diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index c43f308dc918..84b0ad864da3 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -18983,9 +18983,4 @@ RadioGroupContainer& Document::OwnedRadioGroupContainer() { return *mRadioGroupContainer; } -void Document::UpdateHiddenByContentVisibilityForAnimations() { - for (AnimationTimeline* timeline : Timelines()) { - timeline->UpdateHiddenByContentVisibility(); - } -} } // namespace mozilla::dom diff --git a/dom/base/Document.h b/dom/base/Document.h index 7e8fdfa23352..7d9e65cf1e79 100644 --- a/dom/base/Document.h +++ b/dom/base/Document.h @@ -3034,7 +3034,6 @@ class Document : public nsINode, DocumentTimeline* Timeline(); LinkedList& Timelines() { return mTimelines; } - void UpdateHiddenByContentVisibilityForAnimations(); SVGSVGElement* GetSVGRootElement() const; diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 0b23fd5e3d61..0fc7c310b3c7 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -11950,15 +11950,8 @@ void PresShell::UpdateRelevancyOfContentVisibilityAutoFrames() { return; } - bool isRelevantContentChanged = false; for (nsIFrame* frame : mContentVisibilityAutoFrames) { - isRelevantContentChanged |= - frame->UpdateIsRelevantContent(mContentVisibilityRelevancyToUpdate); - } - if (isRelevantContentChanged) { - if (nsPresContext* presContext = GetPresContext()) { - presContext->UpdateHiddenByContentVisibilityForAnimations(); - } + frame->UpdateIsRelevantContent(mContentVisibilityRelevancyToUpdate); } mContentVisibilityRelevancyToUpdate.clear(); @@ -11992,7 +11985,6 @@ PresShell::ProximityToViewportResult PresShell::DetermineProximityToViewport() { auto input = DOMIntersectionObserver::ComputeInput( *mDocument, /* aRoot = */ nullptr, &rootMargin); - bool isRelevantContentChanged = false; for (nsIFrame* frame : mContentVisibilityAutoFrames) { auto* element = frame->GetContent()->AsElement(); result.mAnyScrollIntoViewFlag |= @@ -12013,8 +12005,7 @@ PresShell::ProximityToViewportResult PresShell::DetermineProximityToViewport() { .Intersects(); element->SetVisibleForContentVisibility(intersects); if (oldVisibility.isNothing() || *oldVisibility != intersects) { - isRelevantContentChanged |= - frame->UpdateIsRelevantContent(ContentRelevancyReason::Visible); + frame->UpdateIsRelevantContent(ContentRelevancyReason::Visible); } // 14.2.3.3 @@ -12022,11 +12013,6 @@ PresShell::ProximityToViewportResult PresShell::DetermineProximityToViewport() { result.mHadInitialDetermination = true; } } - if (isRelevantContentChanged) { - if (nsPresContext* presContext = GetPresContext()) { - presContext->UpdateHiddenByContentVisibilityForAnimations(); - } - } return result; } diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 0ed162c3a34d..99c435e281e1 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -3077,11 +3077,6 @@ PerformanceMainThread* nsPresContext::GetPerformanceMainThread() const { return nullptr; } -void nsPresContext::UpdateHiddenByContentVisibilityForAnimations() { - mDocument->UpdateHiddenByContentVisibilityForAnimations(); - TimelineManager()->UpdateHiddenByContentVisibilityForAnimations(); -} - #ifdef DEBUG void nsPresContext::ValidatePresShellAndDocumentReleation() const { diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 550ef009a72d..ed99f9a72026 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -1079,8 +1079,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr { return mFontPaletteValueSet; } - void UpdateHiddenByContentVisibilityForAnimations(); - protected: friend class nsRunnableMethod; void ThemeChangedInternal(); diff --git a/layout/generic/nsIFrame.cpp b/layout/generic/nsIFrame.cpp index 593536c85e1e..2181365f9dbc 100644 --- a/layout/generic/nsIFrame.cpp +++ b/layout/generic/nsIFrame.cpp @@ -7003,7 +7003,7 @@ bool nsIFrame::IsDescendantOfTopLayerElement() const { return false; } -bool nsIFrame::UpdateIsRelevantContent( +void nsIFrame::UpdateIsRelevantContent( const ContentRelevancy& aRelevancyToUpdate) { MOZ_ASSERT(StyleDisplay()->ContentVisibility(*this) == StyleContentVisibility::Auto); @@ -7053,7 +7053,7 @@ bool nsIFrame::UpdateIsRelevantContent( } if (!overallRelevancyChanged) { - return false; + return; } HandleLastRememberedSize(); @@ -7075,7 +7075,6 @@ bool nsIFrame::UpdateIsRelevantContent( new AsyncEventDispatcher(element, event.forget()); DebugOnly rv = asyncDispatcher->PostDOMEvent(); NS_ASSERTION(NS_SUCCEEDED(rv), "AsyncEventDispatcher failed to dispatch"); - return true; } nsresult nsIFrame::CharacterDataChanged(const CharacterDataChangeInfo&) { diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 97d00fd8d661..791d1ee905a1 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -3303,10 +3303,8 @@ class nsIFrame : public nsQueryFrame { * Update the whether or not this frame is considered relevant content for the * purposes of `content-visibility: auto` according to the rules specified in * https://drafts.csswg.org/css-contain-2/#relevant-to-the-user. - * Returns true if the over-all relevancy changed. */ - [[nodiscard]] bool UpdateIsRelevantContent( - const ContentRelevancy& aRelevancyToUpdate); + void UpdateIsRelevantContent(const ContentRelevancy& aRelevancyToUpdate); /** * Get the "type" of the frame. diff --git a/layout/style/TimelineCollection.h b/layout/style/TimelineCollection.h index 21e0b2b6bc39..1f61845e2e26 100644 --- a/layout/style/TimelineCollection.h +++ b/layout/style/TimelineCollection.h @@ -55,7 +55,6 @@ class TimelineCollection final // if it does not already exist. static TimelineCollection* Get(const dom::Element* aElement, PseudoStyleType aPseudoType); - const TimelineMap& Timelines() const { return mTimelines; } private: // The element. Weak reference is fine since it owns us. diff --git a/layout/style/TimelineManager.cpp b/layout/style/TimelineManager.cpp index 4adc03df173f..78db0765e6fd 100644 --- a/layout/style/TimelineManager.cpp +++ b/layout/style/TimelineManager.cpp @@ -168,20 +168,4 @@ void TimelineManager::DoUpdateTimelines( // siblings when mutating {scroll|view}-timeline-name. } -void TimelineManager::UpdateHiddenByContentVisibilityForAnimations() { - for (auto* scrollTimelineCollection : mScrollTimelineCollections) { - for (ScrollTimeline* timeline : - scrollTimelineCollection->Timelines().Values()) { - timeline->UpdateHiddenByContentVisibility(); - } - } - - for (auto* viewTimelineCollection : mViewTimelineCollections) { - for (ViewTimeline* timeline : - viewTimelineCollection->Timelines().Values()) { - timeline->UpdateHiddenByContentVisibility(); - } - } -} - } // namespace mozilla diff --git a/layout/style/TimelineManager.h b/layout/style/TimelineManager.h index 3fc31a719c23..f52302a66162 100644 --- a/layout/style/TimelineManager.h +++ b/layout/style/TimelineManager.h @@ -51,8 +51,6 @@ class TimelineManager { const ComputedStyle* aComputedStyle, ProgressTimelineType aType); - void UpdateHiddenByContentVisibilityForAnimations(); - private: template void DoUpdateTimelines(nsPresContext* aPresContext, dom::Element* aElement, diff --git a/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-and-scroll.html.ini b/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-and-scroll.html.ini new file mode 100644 index 000000000000..fa738b11fa8d --- /dev/null +++ b/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-and-scroll.html.ini @@ -0,0 +1,2 @@ +[content-visibility-animation-and-scroll.html] + expected: TIMEOUT diff --git a/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-in-auto-subtree.html.ini b/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-in-auto-subtree.html.ini index a4168d942a96..d960484b9205 100644 --- a/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-in-auto-subtree.html.ini +++ b/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-in-auto-subtree.html.ini @@ -1,4 +1,13 @@ [content-visibility-animation-in-auto-subtree.html] expected: TIMEOUT - [Events and promises are handled normally for animations without an owning element] + [Animation events do not fire for a CSS animation running in a content visibility subtree] expected: TIMEOUT + + [The finished promise does not resolve due to the normal passage of time for a CSS animation in a content visibility subtree] + expected: NOTRUN + + [The finished promise does not resolve due to the normal passage of time for a CSS transition in a content visibility subtree] + expected: NOTRUN + + [Events and promises are handled normally for animations without an owning element] + expected: NOTRUN diff --git a/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-auto-subtree.html.ini b/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-auto-subtree.html.ini deleted file mode 100644 index 44714a2940a4..000000000000 --- a/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-auto-subtree.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[content-visibility-animation-with-scroll-timeline-in-auto-subtree.html] - prefs: [layout.css.scroll-driven-animations.enabled:true] diff --git a/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-hidden-subtree.html.ini b/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-hidden-subtree.html.ini deleted file mode 100644 index 82d675a7bbcf..000000000000 --- a/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-hidden-subtree.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[content-visibility-animation-with-scroll-timeline-in-hidden-subtree.html] - prefs: [layout.css.scroll-driven-animations.enabled:true] diff --git a/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-animation-in-auto-subtree.html b/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-animation-in-auto-subtree.html index 493d591b4b3c..50f04f94f3f7 100644 --- a/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-animation-in-auto-subtree.html +++ b/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-animation-in-auto-subtree.html @@ -14,7 +14,7 @@ to { opacity: 0; } } #target { - background: green; + background: 'green'; height: 100px; width: 100px; } diff --git a/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-auto-subtree.html b/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-auto-subtree.html deleted file mode 100644 index beb57594c4c1..000000000000 --- a/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-auto-subtree.html +++ /dev/null @@ -1,82 +0,0 @@ - - -Test getComputedStyle on a CSS animation with scroll timeline in a content visibility subtree using content-visibility: auto - - - - - - -
-
-
-
-
-
- - - diff --git a/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-hidden-subtree.html b/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-hidden-subtree.html deleted file mode 100644 index c9f35cffe866..000000000000 --- a/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-animation-with-scroll-timeline-in-hidden-subtree.html +++ /dev/null @@ -1,81 +0,0 @@ - - -Test getComputedStyle on a CSS animation with scroll-timeline in a content-visibility subtree - - - - - - -
-
-
-
-
- - - diff --git a/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-web-animation-in-auto-subtree.html b/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-web-animation-in-auto-subtree.html deleted file mode 100644 index a663e58fe03e..000000000000 --- a/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-web-animation-in-auto-subtree.html +++ /dev/null @@ -1,74 +0,0 @@ - - -Web Animation does not stop even if target is hidden by c-v - - - - - - -
-
- -