зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1468545 - Distinguish between upwards- and downwards-propagating information in InputAPZContext. r=botond
No functional changes here, but this updates the documentation in InputAPZContext and separates the fields into two categories for easier understanding. This is what I had in mind when I introduced this class but never documented it anywhere, and so the "pending layerization" flag didn't follow the convention that I had in mind. This cleans that up. MozReview-Commit-ID: I26Ocu5Uco2 --HG-- extra : rebase_source : 8e0e096f6a98626624e3d62f89d0ffea2049cd8c
This commit is contained in:
Родитель
7bbfb86be8
Коммит
f74e6a30e2
|
@ -1727,10 +1727,7 @@ TabChild::HandleRealMouseButtonEvent(const WidgetMouseEvent& aEvent,
|
|||
aInputBlockId);
|
||||
}
|
||||
|
||||
InputAPZContext context(aGuid, aInputBlockId, nsEventStatus_eIgnore);
|
||||
if (pendingLayerization) {
|
||||
InputAPZContext::SetPendingLayerization();
|
||||
}
|
||||
InputAPZContext context(aGuid, aInputBlockId, nsEventStatus_eIgnore, pendingLayerization);
|
||||
|
||||
WidgetMouseEvent localEvent(aEvent);
|
||||
localEvent.mWidget = mPuppetWidget;
|
||||
|
|
|
@ -12,8 +12,8 @@ namespace layers {
|
|||
ScrollableLayerGuid InputAPZContext::sGuid;
|
||||
uint64_t InputAPZContext::sBlockId = 0;
|
||||
nsEventStatus InputAPZContext::sApzResponse = nsEventStatus_eIgnore;
|
||||
bool InputAPZContext::sRoutedToChildProcess = false;
|
||||
bool InputAPZContext::sPendingLayerization = false;
|
||||
bool InputAPZContext::sRoutedToChildProcess = false;
|
||||
|
||||
/*static*/ ScrollableLayerGuid
|
||||
InputAPZContext::GetTargetLayerGuid()
|
||||
|
@ -33,41 +33,10 @@ InputAPZContext::GetApzResponse()
|
|||
return sApzResponse;
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
InputAPZContext::SetRoutedToChildProcess()
|
||||
/*static*/ bool
|
||||
InputAPZContext::HavePendingLayerization()
|
||||
{
|
||||
sRoutedToChildProcess = true;
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
InputAPZContext::SetPendingLayerization()
|
||||
{
|
||||
sPendingLayerization = true;
|
||||
}
|
||||
|
||||
InputAPZContext::InputAPZContext(const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aBlockId,
|
||||
const nsEventStatus& aApzResponse)
|
||||
: mOldGuid(sGuid)
|
||||
, mOldBlockId(sBlockId)
|
||||
, mOldApzResponse(sApzResponse)
|
||||
, mOldRoutedToChildProcess(sRoutedToChildProcess)
|
||||
, mOldPendingLayerization(sPendingLayerization)
|
||||
{
|
||||
sGuid = aGuid;
|
||||
sBlockId = aBlockId;
|
||||
sApzResponse = aApzResponse;
|
||||
sRoutedToChildProcess = false;
|
||||
sPendingLayerization = false;
|
||||
}
|
||||
|
||||
InputAPZContext::~InputAPZContext()
|
||||
{
|
||||
sGuid = mOldGuid;
|
||||
sBlockId = mOldBlockId;
|
||||
sApzResponse = mOldApzResponse;
|
||||
sRoutedToChildProcess = mOldRoutedToChildProcess;
|
||||
sPendingLayerization = mOldPendingLayerization;
|
||||
return sPendingLayerization;
|
||||
}
|
||||
|
||||
/*static*/ bool
|
||||
|
@ -76,10 +45,36 @@ InputAPZContext::WasRoutedToChildProcess()
|
|||
return sRoutedToChildProcess;
|
||||
}
|
||||
|
||||
/*static*/ bool
|
||||
InputAPZContext::HavePendingLayerization()
|
||||
InputAPZContext::InputAPZContext(const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aBlockId,
|
||||
const nsEventStatus& aApzResponse,
|
||||
bool aPendingLayerization)
|
||||
: mOldGuid(sGuid)
|
||||
, mOldBlockId(sBlockId)
|
||||
, mOldApzResponse(sApzResponse)
|
||||
, mOldPendingLayerization(sPendingLayerization)
|
||||
, mOldRoutedToChildProcess(sRoutedToChildProcess)
|
||||
{
|
||||
return sPendingLayerization;
|
||||
sGuid = aGuid;
|
||||
sBlockId = aBlockId;
|
||||
sApzResponse = aApzResponse;
|
||||
sPendingLayerization = aPendingLayerization;
|
||||
sRoutedToChildProcess = false;
|
||||
}
|
||||
|
||||
InputAPZContext::~InputAPZContext()
|
||||
{
|
||||
sGuid = mOldGuid;
|
||||
sBlockId = mOldBlockId;
|
||||
sApzResponse = mOldApzResponse;
|
||||
sPendingLayerization = mOldPendingLayerization;
|
||||
sRoutedToChildProcess = mOldRoutedToChildProcess;
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
InputAPZContext::SetRoutedToChildProcess()
|
||||
{
|
||||
sRoutedToChildProcess = true;
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -13,40 +13,56 @@
|
|||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
// InputAPZContext is used to communicate the ScrollableLayerGuid,
|
||||
// input block ID, APZ response from nsIWidget to RenderFrameParent.
|
||||
// It is conceptually attached to any WidgetInputEvent
|
||||
// that has been processed by APZ directly from a widget.
|
||||
// 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
|
||||
// or TabChild) into deeper code that is run during complicated operations
|
||||
// like event dispatch. The other type is information that is propagated
|
||||
// "upwards", from the deeper code back to the entry point.
|
||||
class MOZ_STACK_CLASS InputAPZContext
|
||||
{
|
||||
private:
|
||||
// State that is propagated downwards from InputAPZContext creation into
|
||||
// "deeper" code.
|
||||
static ScrollableLayerGuid sGuid;
|
||||
static uint64_t sBlockId;
|
||||
static nsEventStatus sApzResponse;
|
||||
static bool sRoutedToChildProcess;
|
||||
static bool sPendingLayerization;
|
||||
|
||||
// State that is set in deeper code and propagated upwards.
|
||||
static bool sRoutedToChildProcess;
|
||||
|
||||
public:
|
||||
// Functions to access downwards-propagated data
|
||||
static ScrollableLayerGuid GetTargetLayerGuid();
|
||||
static uint64_t GetInputBlockId();
|
||||
static nsEventStatus GetApzResponse();
|
||||
static void SetRoutedToChildProcess();
|
||||
static void SetPendingLayerization();
|
||||
static bool HavePendingLayerization();
|
||||
|
||||
// Functions to access upwards-propagated data
|
||||
static bool WasRoutedToChildProcess();
|
||||
|
||||
// Constructor sets the data to be propagated downwards
|
||||
InputAPZContext(const ScrollableLayerGuid& aGuid,
|
||||
const uint64_t& aBlockId,
|
||||
const nsEventStatus& aApzResponse);
|
||||
const nsEventStatus& aApzResponse,
|
||||
bool aPendingLayerization = false);
|
||||
~InputAPZContext();
|
||||
|
||||
static bool WasRoutedToChildProcess();
|
||||
static bool HavePendingLayerization();
|
||||
// Functions to set data to be propagated upwards
|
||||
static void SetRoutedToChildProcess();
|
||||
|
||||
private:
|
||||
ScrollableLayerGuid mOldGuid;
|
||||
uint64_t mOldBlockId;
|
||||
nsEventStatus mOldApzResponse;
|
||||
bool mOldRoutedToChildProcess;
|
||||
bool mOldPendingLayerization;
|
||||
|
||||
bool mOldRoutedToChildProcess;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
Загрузка…
Ссылка в новой задаче