gfx/layers/apz/util/ActiveElementManager.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef mozilla_layers_ActiveElementManager_h
michael@0 7 #define mozilla_layers_ActiveElementManager_h
michael@0 8
michael@0 9 #include "nsCOMPtr.h"
michael@0 10 #include "nsISupportsImpl.h"
michael@0 11
michael@0 12 class inIDOMUtils;
michael@0 13 class nsIDOMEventTarget;
michael@0 14 class nsIDOMElement;
michael@0 15 class CancelableTask;
michael@0 16
michael@0 17 namespace mozilla {
michael@0 18 namespace layers {
michael@0 19
michael@0 20 /**
michael@0 21 * Manages setting and clearing the ':active' CSS pseudostate in the presence
michael@0 22 * of touch input.
michael@0 23 */
michael@0 24 class ActiveElementManager {
michael@0 25 public:
michael@0 26 NS_INLINE_DECL_REFCOUNTING(ActiveElementManager)
michael@0 27
michael@0 28 ActiveElementManager();
michael@0 29 ~ActiveElementManager();
michael@0 30
michael@0 31 /**
michael@0 32 * Specify the target of a touch. Typically this should be called right
michael@0 33 * before HandleTouchStart(), but we give callers the flexibility to specify
michael@0 34 * the target later if they don't know it at the time they call
michael@0 35 * HandleTouchStart().
michael@0 36 * |aTarget| may be nullptr.
michael@0 37 */
michael@0 38 void SetTargetElement(nsIDOMEventTarget* aTarget);
michael@0 39 /**
michael@0 40 * Handle a touch-start event.
michael@0 41 * @param aCanBePan whether the touch can be a pan
michael@0 42 */
michael@0 43 void HandleTouchStart(bool aCanBePan);
michael@0 44 /**
michael@0 45 * Handle the start of panning.
michael@0 46 */
michael@0 47 void HandlePanStart();
michael@0 48 /**
michael@0 49 * Handle a touch-end or touch-cancel event.
michael@0 50 * @param aWasClick whether the touch was a click
michael@0 51 */
michael@0 52 void HandleTouchEnd(bool aWasClick);
michael@0 53 private:
michael@0 54 nsCOMPtr<inIDOMUtils> mDomUtils;
michael@0 55 /**
michael@0 56 * The target of the first touch point in the current touch block.
michael@0 57 */
michael@0 58 nsCOMPtr<nsIDOMElement> mTarget;
michael@0 59 /**
michael@0 60 * Whether the current touch block can be a pan. Set in HandleTouchStart().
michael@0 61 */
michael@0 62 bool mCanBePan;
michael@0 63 /**
michael@0 64 * Whether mCanBePan has been set for the current touch block.
michael@0 65 * We need to keep track of this to allow HandleTouchStart() and
michael@0 66 * SetTargetElement() to be called in either order.
michael@0 67 */
michael@0 68 bool mCanBePanSet;
michael@0 69 /**
michael@0 70 * A task for calling SetActive() after a timeout.
michael@0 71 */
michael@0 72 CancelableTask* mSetActiveTask;
michael@0 73
michael@0 74 // Helpers
michael@0 75 void TriggerElementActivation();
michael@0 76 void SetActive(nsIDOMElement* aTarget);
michael@0 77 void ResetActive();
michael@0 78 void SetActiveTask(nsIDOMElement* aTarget);
michael@0 79 void CancelTask();
michael@0 80 };
michael@0 81
michael@0 82 }
michael@0 83 }
michael@0 84
michael@0 85 #endif /* mozilla_layers_ActiveElementManager_h */

mercurial