mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1004516 - Add some default-disabled file logging to ActiveElementManager. r=botond
This commit is contained in:
parent
19bb9f870e
commit
3ac891d9ab
@ -14,6 +14,9 @@
|
||||
#include "base/message_loop.h"
|
||||
#include "base/task.h"
|
||||
|
||||
#define AEM_LOG(...)
|
||||
// #define AEM_LOG(...) printf_stderr("AEM: " __VA_ARGS__)
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
@ -41,6 +44,7 @@ ActiveElementManager::SetTargetElement(nsIDOMEventTarget* aTarget)
|
||||
{
|
||||
if (mTarget) {
|
||||
// Multiple fingers on screen (since HandleTouchEnd clears mTarget).
|
||||
AEM_LOG("Multiple fingers on-screen, clearing target element\n");
|
||||
CancelTask();
|
||||
ResetActive();
|
||||
ResetTouchBlockState();
|
||||
@ -48,14 +52,17 @@ ActiveElementManager::SetTargetElement(nsIDOMEventTarget* aTarget)
|
||||
}
|
||||
|
||||
mTarget = do_QueryInterface(aTarget);
|
||||
AEM_LOG("Setting target element to %p\n", mTarget.get());
|
||||
TriggerElementActivation();
|
||||
}
|
||||
|
||||
void
|
||||
ActiveElementManager::HandleTouchStart(bool aCanBePan)
|
||||
{
|
||||
AEM_LOG("Touch start, aCanBePan: %d\n", aCanBePan);
|
||||
if (mCanBePanSet) {
|
||||
// Multiple fingers on screen (since HandleTouchEnd clears mCanBePanSet).
|
||||
AEM_LOG("Multiple fingers on-screen, clearing touch block state\n");
|
||||
CancelTask();
|
||||
ResetActive();
|
||||
ResetTouchBlockState();
|
||||
@ -87,12 +94,15 @@ ActiveElementManager::TriggerElementActivation()
|
||||
this, &ActiveElementManager::SetActiveTask, mTarget);
|
||||
MessageLoop::current()->PostDelayedTask(
|
||||
FROM_HERE, mSetActiveTask, sActivationDelayMs);
|
||||
AEM_LOG("Scheduling mSetActiveTask %p\n", mSetActiveTask);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ActiveElementManager::HandlePanStart()
|
||||
{
|
||||
AEM_LOG("Handle pan start\n");
|
||||
|
||||
// The user started to pan, so we don't want mTarget to be :active.
|
||||
// Make it not :active, and clear any pending task to make it :active.
|
||||
CancelTask();
|
||||
@ -102,6 +112,8 @@ ActiveElementManager::HandlePanStart()
|
||||
void
|
||||
ActiveElementManager::HandleTouchEnd(bool aWasClick)
|
||||
{
|
||||
AEM_LOG("Touch end, aWasClick: %d\n", aWasClick);
|
||||
|
||||
// If the touch was a click, make mTarget :active right away.
|
||||
// nsEventStateManager will reset the active element when processing
|
||||
// the mouse-down event generated by the click.
|
||||
@ -116,14 +128,17 @@ ActiveElementManager::HandleTouchEnd(bool aWasClick)
|
||||
void
|
||||
ActiveElementManager::SetActive(nsIDOMElement* aTarget)
|
||||
{
|
||||
AEM_LOG("Setting active %p\n", aTarget);
|
||||
if (mDomUtils) {
|
||||
mDomUtils->SetContentState(aTarget, NS_EVENT_STATE_ACTIVE.GetInternalValue());;
|
||||
mDomUtils->SetContentState(aTarget, NS_EVENT_STATE_ACTIVE.GetInternalValue());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ActiveElementManager::ResetActive()
|
||||
{
|
||||
AEM_LOG("Resetting active from %p\n", mTarget.get());
|
||||
|
||||
// Clear the :active flag from mTarget by setting it on the document root.
|
||||
if (mTarget) {
|
||||
nsCOMPtr<nsIDOMDocument> doc;
|
||||
@ -132,6 +147,7 @@ ActiveElementManager::ResetActive()
|
||||
nsCOMPtr<nsIDOMElement> root;
|
||||
doc->GetDocumentElement(getter_AddRefs(root));
|
||||
if (root) {
|
||||
AEM_LOG("Found root %p, making active\n", root.get());
|
||||
SetActive(root);
|
||||
}
|
||||
}
|
||||
@ -148,6 +164,8 @@ ActiveElementManager::ResetTouchBlockState()
|
||||
void
|
||||
ActiveElementManager::SetActiveTask(nsIDOMElement* aTarget)
|
||||
{
|
||||
AEM_LOG("mSetActiveTask %p running\n", mSetActiveTask);
|
||||
|
||||
// This gets called from mSetActiveTask's Run() method. The message loop
|
||||
// deletes the task right after running it, so we need to null out
|
||||
// mSetActiveTask to make sure we're not left with a dangling pointer.
|
||||
@ -158,6 +176,8 @@ ActiveElementManager::SetActiveTask(nsIDOMElement* aTarget)
|
||||
void
|
||||
ActiveElementManager::CancelTask()
|
||||
{
|
||||
AEM_LOG("Cancelling task %p\n", mSetActiveTask);
|
||||
|
||||
if (mSetActiveTask) {
|
||||
mSetActiveTask->Cancel();
|
||||
mSetActiveTask = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user