зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1073336 part 8 - Add protected AnimationPlayer::GetRenderedDocument(); r=dbaron
In order for AnimationPlayer objects to be able to notify their collection/manager, the can either store an extra pointer member, or they can navigate to the collection as follows: player->source(animation)->target(element)->document ->presShell->presContext->manager->collection This patch adds a getter for the first part of this journey up to the document.
This commit is contained in:
Родитель
9efcdfde21
Коммит
dc613405f6
|
@ -6,6 +6,7 @@
|
|||
#include "AnimationPlayer.h"
|
||||
#include "AnimationUtils.h"
|
||||
#include "mozilla/dom/AnimationPlayerBinding.h"
|
||||
#include "nsIDocument.h" // For nsIDocument
|
||||
#include "nsLayoutUtils.h" // For PostRestyleEvent (remove after bug 1073336)
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -205,18 +206,7 @@ AnimationPlayer::ComposeStyle(nsRefPtr<css::AnimValuesStyleRule>& aStyleRule,
|
|||
void
|
||||
AnimationPlayer::FlushStyle() const
|
||||
{
|
||||
if (!mSource) {
|
||||
return;
|
||||
}
|
||||
|
||||
Element* targetElement;
|
||||
nsCSSPseudoElements::Type pseudoType;
|
||||
mSource->GetTarget(targetElement, pseudoType);
|
||||
if (!targetElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsIDocument* doc = targetElement->GetComposedDoc();
|
||||
nsIDocument* doc = GetRenderedDocument();
|
||||
if (doc) {
|
||||
doc->FlushPendingNotifications(Flush_Style);
|
||||
}
|
||||
|
@ -254,5 +244,22 @@ AnimationPlayer::SourceContentEnd() const
|
|||
+ mSource->GetComputedTiming().mActiveDuration;
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
AnimationPlayer::GetRenderedDocument() const
|
||||
{
|
||||
if (!mSource) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Element* targetElement;
|
||||
nsCSSPseudoElements::Type pseudoType;
|
||||
mSource->GetTarget(targetElement, pseudoType);
|
||||
if (!targetElement) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return targetElement->GetComposedDoc();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
struct JSContext;
|
||||
class nsCSSPropertySet;
|
||||
class nsIDocument;
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
|
@ -126,6 +127,8 @@ protected:
|
|||
void MaybePostRestyle() const;
|
||||
StickyTimeDuration SourceContentEnd() const;
|
||||
|
||||
nsIDocument* GetRenderedDocument() const;
|
||||
|
||||
nsRefPtr<AnimationTimeline> mTimeline;
|
||||
nsRefPtr<Animation> mSource;
|
||||
Nullable<TimeDuration> mHoldTime; // Player timescale
|
||||
|
|
Загрузка…
Ссылка в новой задаче