mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 04:27:41 +00:00
Bug 1211365 - Remove NS_IMPL_STATE_UTILITIES. r=mtseng
This macro was used to implement Name() and Singleton() for state classes. Instead of enforcing the state class to be a singleton, we can implement singleton pattern in MOZ_IMPL_STATE_CLASS_GETTER directly. --HG-- extra : commitid : 7jsXCgpWZ7U extra : rebase_source : f03530931e3d27e7532022c9c11b834ccea9fc0e
This commit is contained in:
parent
a276bc4cae
commit
2c11c71f3b
@ -40,7 +40,7 @@ class AccessibleCaretEventHub::NoActionState
|
||||
: public AccessibleCaretEventHub::State
|
||||
{
|
||||
public:
|
||||
NS_IMPL_STATE_UTILITIES(NoActionState)
|
||||
virtual const char* Name() const override { return "NoActionState"; }
|
||||
|
||||
virtual nsEventStatus OnPress(AccessibleCaretEventHub* aContext,
|
||||
const nsPoint& aPoint,
|
||||
@ -104,7 +104,7 @@ class AccessibleCaretEventHub::PressCaretState
|
||||
: public AccessibleCaretEventHub::State
|
||||
{
|
||||
public:
|
||||
NS_IMPL_STATE_UTILITIES(PressCaretState)
|
||||
virtual const char* Name() const override { return "PressCaretState"; }
|
||||
|
||||
virtual nsEventStatus OnMove(AccessibleCaretEventHub* aContext,
|
||||
const nsPoint& aPoint) override
|
||||
@ -141,7 +141,7 @@ class AccessibleCaretEventHub::DragCaretState
|
||||
: public AccessibleCaretEventHub::State
|
||||
{
|
||||
public:
|
||||
NS_IMPL_STATE_UTILITIES(DragCaretState)
|
||||
virtual const char* Name() const override { return "DragCaretState"; }
|
||||
|
||||
virtual nsEventStatus OnMove(AccessibleCaretEventHub* aContext,
|
||||
const nsPoint& aPoint) override
|
||||
@ -167,7 +167,7 @@ class AccessibleCaretEventHub::PressNoCaretState
|
||||
: public AccessibleCaretEventHub::State
|
||||
{
|
||||
public:
|
||||
NS_IMPL_STATE_UTILITIES(PressNoCaretState)
|
||||
virtual const char* Name() const override { return "PressNoCaretState"; }
|
||||
|
||||
virtual nsEventStatus OnMove(AccessibleCaretEventHub* aContext,
|
||||
const nsPoint& aPoint) override
|
||||
@ -239,7 +239,7 @@ class AccessibleCaretEventHub::ScrollState
|
||||
: public AccessibleCaretEventHub::State
|
||||
{
|
||||
public:
|
||||
NS_IMPL_STATE_UTILITIES(ScrollState)
|
||||
virtual const char* Name() const override { return "ScrollState"; }
|
||||
|
||||
virtual void OnScrollEnd(AccessibleCaretEventHub* aContext) override
|
||||
{
|
||||
@ -264,7 +264,7 @@ class AccessibleCaretEventHub::PostScrollState
|
||||
: public AccessibleCaretEventHub::State
|
||||
{
|
||||
public:
|
||||
NS_IMPL_STATE_UTILITIES(PostScrollState)
|
||||
virtual const char* Name() const override { return "PostScrollState"; }
|
||||
|
||||
virtual nsEventStatus OnPress(AccessibleCaretEventHub* aContext,
|
||||
const nsPoint& aPoint,
|
||||
@ -321,7 +321,7 @@ class AccessibleCaretEventHub::LongTapState
|
||||
: public AccessibleCaretEventHub::State
|
||||
{
|
||||
public:
|
||||
NS_IMPL_STATE_UTILITIES(LongTapState)
|
||||
virtual const char* Name() const override { return "LongTapState"; }
|
||||
|
||||
virtual nsEventStatus OnLongTap(AccessibleCaretEventHub* aContext,
|
||||
const nsPoint& aPoint) override
|
||||
|
@ -94,7 +94,8 @@ protected:
|
||||
#define MOZ_IMPL_STATE_CLASS_GETTER(aClassName) \
|
||||
AccessibleCaretEventHub::State* AccessibleCaretEventHub::aClassName() \
|
||||
{ \
|
||||
return AccessibleCaretEventHub::aClassName::Singleton(); \
|
||||
static class aClassName singleton; \
|
||||
return &singleton; \
|
||||
}
|
||||
|
||||
// Concrete state getters
|
||||
@ -169,14 +170,6 @@ protected:
|
||||
class AccessibleCaretEventHub::State
|
||||
{
|
||||
public:
|
||||
#define NS_IMPL_STATE_UTILITIES(aClassName) \
|
||||
virtual const char* Name() const override { return #aClassName; } \
|
||||
static aClassName* Singleton() \
|
||||
{ \
|
||||
static aClassName singleton; \
|
||||
return &singleton; \
|
||||
}
|
||||
|
||||
virtual const char* Name() const { return ""; }
|
||||
|
||||
virtual nsEventStatus OnPress(AccessibleCaretEventHub* aContext,
|
||||
|
Loading…
x
Reference in New Issue
Block a user