зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1421170 - Move the declarations of CustomElementUpgradeReaction and CustomElementCallbackReaction to CustomElementRegistry.cpp; r=smaug
The CustomElementUpgradeReaction and CustomElementCallbackReaction are only used inside CustomElementRegistry.cpp, so we don't need to expose them in header file. MozReview-Commit-ID: 9lYwHeFIODi --HG-- extra : rebase_source : 099821b680b171b0c354c34ebd91ba5963536dc1
This commit is contained in:
Родитель
2157e91c44
Коммит
0c779a0480
|
@ -18,6 +18,57 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
//-----------------------------------------------------
|
||||
// CustomElementUpgradeReaction
|
||||
|
||||
class CustomElementUpgradeReaction final : public CustomElementReaction
|
||||
{
|
||||
public:
|
||||
explicit CustomElementUpgradeReaction(CustomElementDefinition* aDefinition)
|
||||
: mDefinition(aDefinition)
|
||||
{
|
||||
#if DEBUG
|
||||
mIsUpgradeReaction = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void Invoke(Element* aElement, ErrorResult& aRv) override
|
||||
{
|
||||
CustomElementRegistry::Upgrade(aElement, mDefinition, aRv);
|
||||
}
|
||||
|
||||
CustomElementDefinition* mDefinition;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------
|
||||
// CustomElementCallbackReaction
|
||||
|
||||
class CustomElementCallbackReaction final : public CustomElementReaction
|
||||
{
|
||||
public:
|
||||
explicit CustomElementCallbackReaction(UniquePtr<CustomElementCallback> aCustomElementCallback)
|
||||
: mCustomElementCallback(Move(aCustomElementCallback))
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Traverse(nsCycleCollectionTraversalCallback& aCb) const override
|
||||
{
|
||||
mCustomElementCallback->Traverse(aCb);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void Invoke(Element* aElement, ErrorResult& aRv) override
|
||||
{
|
||||
mCustomElementCallback->Call();
|
||||
}
|
||||
|
||||
UniquePtr<CustomElementCallback> mCustomElementCallback;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------
|
||||
// CustomElementCallback
|
||||
|
||||
void
|
||||
CustomElementCallback::Call()
|
||||
{
|
||||
|
@ -88,6 +139,7 @@ CustomElementConstructor::Construct(const char* aExecutionReason,
|
|||
|
||||
return element.forget();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// CustomElementData
|
||||
|
||||
|
@ -1120,24 +1172,5 @@ CustomElementDefinition::CustomElementDefinition(nsAtom* aType,
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// CustomElementUpgradeReaction
|
||||
|
||||
/* virtual */ void
|
||||
CustomElementUpgradeReaction::Invoke(Element* aElement, ErrorResult& aRv)
|
||||
{
|
||||
CustomElementRegistry::Upgrade(aElement, mDefinition, aRv);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
// CustomElementCallbackReaction
|
||||
|
||||
/* virtual */ void
|
||||
CustomElementCallbackReaction::Invoke(Element* aElement, ErrorResult& aRv)
|
||||
{
|
||||
mCustomElementCallback->Call();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -209,41 +209,6 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
class CustomElementUpgradeReaction final : public CustomElementReaction
|
||||
{
|
||||
public:
|
||||
explicit CustomElementUpgradeReaction(CustomElementDefinition* aDefinition)
|
||||
: mDefinition(aDefinition)
|
||||
{
|
||||
#if DEBUG
|
||||
mIsUpgradeReaction = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void Invoke(Element* aElement, ErrorResult& aRv) override;
|
||||
|
||||
CustomElementDefinition* mDefinition;
|
||||
};
|
||||
|
||||
class CustomElementCallbackReaction final : public CustomElementReaction
|
||||
{
|
||||
public:
|
||||
explicit CustomElementCallbackReaction(UniquePtr<CustomElementCallback> aCustomElementCallback)
|
||||
: mCustomElementCallback(Move(aCustomElementCallback))
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Traverse(nsCycleCollectionTraversalCallback& aCb) const override
|
||||
{
|
||||
mCustomElementCallback->Traverse(aCb);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void Invoke(Element* aElement, ErrorResult& aRv) override;
|
||||
UniquePtr<CustomElementCallback> mCustomElementCallback;
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reactions-stack
|
||||
class CustomElementReactionsStack
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче