2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-12-16 10:28:19 +03:00
|
|
|
/* 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_InputAPZContext_h
|
|
|
|
#define mozilla_layers_InputAPZContext_h
|
|
|
|
|
2015-05-14 15:16:00 +03:00
|
|
|
#include "mozilla/EventForwards.h"
|
2018-11-01 23:15:46 +03:00
|
|
|
#include "mozilla/layers/ScrollableLayerGuid.h"
|
2014-12-16 10:28:19 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2018-06-16 01:13:46 +03:00
|
|
|
// InputAPZContext is used to communicate various pieces of information
|
|
|
|
// around the codebase without having to plumb it through lots of functions
|
|
|
|
// and codepaths. Conceptually it is attached to a WidgetInputEvent that is
|
|
|
|
// relevant to APZ.
|
|
|
|
//
|
|
|
|
// There are two types of information bits propagated using this class. One
|
|
|
|
// type is propagated "downwards" (from a process entry point like nsBaseWidget
|
2019-04-10 01:39:01 +03:00
|
|
|
// or BrowserChild) into deeper code that is run during complicated operations
|
2018-06-16 01:13:46 +03:00
|
|
|
// like event dispatch. The other type is information that is propagated
|
|
|
|
// "upwards", from the deeper code back to the entry point.
|
2014-12-16 10:28:19 +03:00
|
|
|
class MOZ_STACK_CLASS InputAPZContext {
|
|
|
|
private:
|
2018-06-16 01:13:46 +03:00
|
|
|
// State that is propagated downwards from InputAPZContext creation into
|
|
|
|
// "deeper" code.
|
2014-12-16 10:28:19 +03:00
|
|
|
static ScrollableLayerGuid sGuid;
|
|
|
|
static uint64_t sBlockId;
|
2015-05-14 15:16:00 +03:00
|
|
|
static nsEventStatus sApzResponse;
|
2017-01-04 21:42:36 +03:00
|
|
|
static bool sPendingLayerization;
|
2014-12-16 10:28:19 +03:00
|
|
|
|
2018-06-16 01:13:46 +03:00
|
|
|
// State that is set in deeper code and propagated upwards.
|
|
|
|
static bool sRoutedToChildProcess;
|
|
|
|
|
2014-12-16 10:28:19 +03:00
|
|
|
public:
|
2018-06-16 01:13:46 +03:00
|
|
|
// Functions to access downwards-propagated data
|
2014-12-16 10:28:19 +03:00
|
|
|
static ScrollableLayerGuid GetTargetLayerGuid();
|
|
|
|
static uint64_t GetInputBlockId();
|
2015-05-14 15:16:00 +03:00
|
|
|
static nsEventStatus GetApzResponse();
|
2018-06-16 01:13:46 +03:00
|
|
|
static bool HavePendingLayerization();
|
|
|
|
|
|
|
|
// Functions to access upwards-propagated data
|
|
|
|
static bool WasRoutedToChildProcess();
|
2014-12-16 10:28:19 +03:00
|
|
|
|
2018-06-16 01:13:46 +03:00
|
|
|
// Constructor sets the data to be propagated downwards
|
2014-12-16 10:28:19 +03:00
|
|
|
InputAPZContext(const ScrollableLayerGuid& aGuid, const uint64_t& aBlockId,
|
2018-06-16 01:13:46 +03:00
|
|
|
const nsEventStatus& aApzResponse,
|
|
|
|
bool aPendingLayerization = false);
|
2014-12-16 10:28:19 +03:00
|
|
|
~InputAPZContext();
|
|
|
|
|
2018-06-16 01:13:46 +03:00
|
|
|
// Functions to set data to be propagated upwards
|
|
|
|
static void SetRoutedToChildProcess();
|
2014-12-19 02:25:03 +03:00
|
|
|
|
2014-12-16 10:28:19 +03:00
|
|
|
private:
|
|
|
|
ScrollableLayerGuid mOldGuid;
|
|
|
|
uint64_t mOldBlockId;
|
2015-05-14 15:16:00 +03:00
|
|
|
nsEventStatus mOldApzResponse;
|
2017-01-04 21:42:36 +03:00
|
|
|
bool mOldPendingLayerization;
|
2018-06-16 01:13:46 +03:00
|
|
|
|
|
|
|
bool mOldRoutedToChildProcess;
|
2014-12-16 10:28:19 +03:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2014-12-16 10:28:19 +03:00
|
|
|
|
|
|
|
#endif /* mozilla_layers_InputAPZContext_h */
|