Bug 1407937 - Move mDefinition from CustomElementReacion to CustomElementUpgradeReaction; f=jdai; r=smaug

MozReview-Commit-ID: 3JweEOgKAeo

--HG--
extra : rebase_source : 9ec3a879358b1600197c87931a79ff91205beb46
This commit is contained in:
Edgar Chen 2017-10-12 17:01:41 +08:00
parent 10692220c0
commit 8dfff5dcef
2 changed files with 8 additions and 21 deletions

View File

@ -408,8 +408,7 @@ CustomElementRegistry::SyncInvokeReactions(nsIDocument::ElementCallbackType aTyp
}
UniquePtr<CustomElementReaction> reaction(Move(
MakeUnique<CustomElementCallbackReaction>(aDefinition,
Move(callback))));
MakeUnique<CustomElementCallbackReaction>(Move(callback))));
RefPtr<SyncInvokeReactionRunnable> runnable =
new SyncInvokeReactionRunnable(Move(reaction), aCustomElement);
@ -455,8 +454,7 @@ CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType
CustomElementReactionsStack* reactionsStack =
docGroup->CustomElementReactionsStack();
reactionsStack->EnqueueCallbackReaction(aCustomElement, definition,
Move(callback));
reactionsStack->EnqueueCallbackReaction(aCustomElement, Move(callback));
}
void
@ -1033,11 +1031,9 @@ CustomElementReactionsStack::EnqueueUpgradeReaction(Element* aElement,
void
CustomElementReactionsStack::EnqueueCallbackReaction(Element* aElement,
CustomElementDefinition* aDefinition,
UniquePtr<CustomElementCallback> aCustomElementCallback)
{
Enqueue(aElement, new CustomElementCallbackReaction(aDefinition,
Move(aCustomElementCallback)));
Enqueue(aElement, new CustomElementCallbackReaction(Move(aCustomElementCallback)));
}
void

View File

@ -214,40 +214,32 @@ private:
class CustomElementReaction
{
public:
explicit CustomElementReaction(CustomElementDefinition* aDefinition)
: mDefinition(aDefinition)
{
}
virtual ~CustomElementReaction() = default;
virtual void Invoke(Element* aElement, ErrorResult& aRv) = 0;
virtual void Traverse(nsCycleCollectionTraversalCallback& aCb) const
{
}
protected:
CustomElementDefinition* mDefinition;
};
class CustomElementUpgradeReaction final : public CustomElementReaction
{
public:
explicit CustomElementUpgradeReaction(CustomElementDefinition* aDefinition)
: CustomElementReaction(aDefinition)
: mDefinition(aDefinition)
{
}
private:
virtual void Invoke(Element* aElement, ErrorResult& aRv) override;
CustomElementDefinition* mDefinition;
};
class CustomElementCallbackReaction final : public CustomElementReaction
{
public:
CustomElementCallbackReaction(CustomElementDefinition* aDefinition,
UniquePtr<CustomElementCallback> aCustomElementCallback)
: CustomElementReaction(aDefinition)
, mCustomElementCallback(Move(aCustomElementCallback))
explicit CustomElementCallbackReaction(UniquePtr<CustomElementCallback> aCustomElementCallback)
: mCustomElementCallback(Move(aCustomElementCallback))
{
}
@ -291,7 +283,6 @@ public:
* https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-callback-reaction
*/
void EnqueueCallbackReaction(Element* aElement,
CustomElementDefinition* aDefinition,
UniquePtr<CustomElementCallback> aCustomElementCallback);
// [CEReactions] Before executing the algorithm's steps