gecko/gfx/layers/apz/util/ActiveElementManager.h
Kartikaya Gupta e7e7d59c58 Bug 995411 - Move various pieces of APZ code into gfx/layers/apz. r=jrmuizel,botond
--HG--
rename : gfx/layers/ipc/GeckoContentController.h => gfx/layers/apz/public/GeckoContentController.h
rename : gfx/layers/composite/APZCTreeManager.cpp => gfx/layers/apz/src/APZCTreeManager.cpp
rename : gfx/layers/composite/APZCTreeManager.h => gfx/layers/apz/src/APZCTreeManager.h
rename : gfx/layers/ipc/AsyncPanZoomController.cpp => gfx/layers/apz/src/AsyncPanZoomController.cpp
rename : gfx/layers/ipc/AsyncPanZoomController.h => gfx/layers/apz/src/AsyncPanZoomController.h
rename : gfx/layers/ipc/Axis.cpp => gfx/layers/apz/src/Axis.cpp
rename : gfx/layers/ipc/Axis.h => gfx/layers/apz/src/Axis.h
rename : gfx/layers/ipc/GestureEventListener.cpp => gfx/layers/apz/src/GestureEventListener.cpp
rename : gfx/layers/ipc/GestureEventListener.h => gfx/layers/apz/src/GestureEventListener.h
rename : gfx/layers/ipc/TaskThrottler.cpp => gfx/layers/apz/src/TaskThrottler.cpp
rename : gfx/layers/ipc/TaskThrottler.h => gfx/layers/apz/src/TaskThrottler.h
rename : widget/xpwidgets/APZCCallbackHelper.cpp => gfx/layers/apz/util/APZCCallbackHelper.cpp
rename : widget/xpwidgets/APZCCallbackHelper.h => gfx/layers/apz/util/APZCCallbackHelper.h
rename : widget/xpwidgets/ActiveElementManager.cpp => gfx/layers/apz/util/ActiveElementManager.cpp
rename : widget/xpwidgets/ActiveElementManager.h => gfx/layers/apz/util/ActiveElementManager.h
2014-04-17 07:54:25 -04:00

86 lines
2.3 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_layers_ActiveElementManager_h
#define mozilla_layers_ActiveElementManager_h
#include "nsCOMPtr.h"
#include "nsISupportsImpl.h"
class inIDOMUtils;
class nsIDOMEventTarget;
class nsIDOMElement;
class CancelableTask;
namespace mozilla {
namespace layers {
/**
* Manages setting and clearing the ':active' CSS pseudostate in the presence
* of touch input.
*/
class ActiveElementManager {
public:
NS_INLINE_DECL_REFCOUNTING(ActiveElementManager)
ActiveElementManager();
~ActiveElementManager();
/**
* Specify the target of a touch. Typically this should be called right
* before HandleTouchStart(), but we give callers the flexibility to specify
* the target later if they don't know it at the time they call
* HandleTouchStart().
* |aTarget| may be nullptr.
*/
void SetTargetElement(nsIDOMEventTarget* aTarget);
/**
* Handle a touch-start event.
* @param aCanBePan whether the touch can be a pan
*/
void HandleTouchStart(bool aCanBePan);
/**
* Handle the start of panning.
*/
void HandlePanStart();
/**
* Handle a touch-end or touch-cancel event.
* @param aWasClick whether the touch was a click
*/
void HandleTouchEnd(bool aWasClick);
private:
nsCOMPtr<inIDOMUtils> mDomUtils;
/**
* The target of the first touch point in the current touch block.
*/
nsCOMPtr<nsIDOMElement> mTarget;
/**
* Whether the current touch block can be a pan. Set in HandleTouchStart().
*/
bool mCanBePan;
/**
* Whether mCanBePan has been set for the current touch block.
* We need to keep track of this to allow HandleTouchStart() and
* SetTargetElement() to be called in either order.
*/
bool mCanBePanSet;
/**
* A task for calling SetActive() after a timeout.
*/
CancelableTask* mSetActiveTask;
// Helpers
void TriggerElementActivation();
void SetActive(nsIDOMElement* aTarget);
void ResetActive();
void SetActiveTask(nsIDOMElement* aTarget);
void CancelTask();
};
}
}
#endif /* mozilla_layers_ActiveElementManager_h */