Commit 62367a9a authored by Micah Tigley's avatar Micah Tigley
Browse files

Bug 1621781 - Add an "IsRDMTouchSimulationActive" field to ScrollMetadata. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D77395
parent 88a10734
......@@ -885,6 +885,7 @@ struct ScrollMetadata {
mIsAutoDirRootContentRTL(false),
mForceDisableApz(false),
mResolutionUpdated(false),
mIsRDMTouchSimulationActive(false),
mOverscrollBehavior() {}
bool operator==(const ScrollMetadata& aOther) const {
......@@ -900,6 +901,7 @@ struct ScrollMetadata {
mIsAutoDirRootContentRTL == aOther.mIsAutoDirRootContentRTL &&
mForceDisableApz == aOther.mForceDisableApz &&
mResolutionUpdated == aOther.mResolutionUpdated &&
mIsRDMTouchSimulationActive == aOther.mIsRDMTouchSimulationActive &&
mDisregardedDirection == aOther.mDisregardedDirection &&
mOverscrollBehavior == aOther.mOverscrollBehavior;
}
......@@ -979,6 +981,13 @@ struct ScrollMetadata {
void SetResolutionUpdated(bool aUpdated) { mResolutionUpdated = aUpdated; }
bool IsResolutionUpdated() const { return mResolutionUpdated; }
void SetIsRDMTouchSimulationActive(bool aValue) {
mIsRDMTouchSimulationActive = aValue;
}
bool GetIsRDMTouchSimulationActive() const {
return mIsRDMTouchSimulationActive;
}
// For more details about the concept of a disregarded direction, refer to the
// code which defines mDisregardedDirection.
Maybe<ScrollDirection> GetDisregardedDirection() const {
......@@ -1055,6 +1064,12 @@ struct ScrollMetadata {
// FrameMetrics::mScrollUpdateType) does for the scroll offset.
bool mResolutionUpdated : 1;
// Whether or not RDM and touch simulation are active for this document.
// It's important to note that if RDM is active then this field will be
// true for the content document but NOT the chrome document containing
// the browser UI and RDM controls.
bool mIsRDMTouchSimulationActive : 1;
// The disregarded direction means the direction which is disregarded anyway,
// even if the scroll frame overflows in that direction and the direction is
// specified as scrollable. This could happen in some scenarios, for instance,
......
......@@ -4650,6 +4650,8 @@ void AsyncPanZoomController::NotifyLayersUpdated(
aScrollMetadata.IsAutoDirRootContentRTL());
Metrics().SetIsScrollInfoLayer(aLayerMetrics.IsScrollInfoLayer());
mScrollMetadata.SetForceDisableApz(aScrollMetadata.IsApzForceDisabled());
mScrollMetadata.SetIsRDMTouchSimulationActive(
aScrollMetadata.GetIsRDMTouchSimulationActive());
mScrollMetadata.SetDisregardedDirection(
aScrollMetadata.GetDisregardedDirection());
mScrollMetadata.SetOverscrollBehavior(
......
......@@ -413,6 +413,7 @@ struct ParamTraits<mozilla::layers::ScrollMetadata>
WriteParam(aMsg, aParam.mIsAutoDirRootContentRTL);
WriteParam(aMsg, aParam.mForceDisableApz);
WriteParam(aMsg, aParam.mResolutionUpdated);
WriteParam(aMsg, aParam.mIsRDMTouchSimulationActive);
WriteParam(aMsg, aParam.mDisregardedDirection);
WriteParam(aMsg, aParam.mOverscrollBehavior);
}
......@@ -447,8 +448,10 @@ struct ParamTraits<mozilla::layers::ScrollMetadata>
&paramType::SetForceDisableApz) &&
ReadBoolForBitfield(aMsg, aIter, aResult,
&paramType::SetResolutionUpdated) &&
ReadParam(aMsg, aIter, &aResult->mDisregardedDirection) &&
ReadParam(aMsg, aIter, &aResult->mOverscrollBehavior));
ReadBoolForBitfield(aMsg, aIter, aResult,
&paramType::SetIsRDMTouchSimulationActive)) &&
ReadParam(aMsg, aIter, &aResult->mDisregardedDirection) &&
ReadParam(aMsg, aIter, &aResult->mOverscrollBehavior);
}
};
......
......@@ -9041,6 +9041,16 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
FrameMetrics& metrics = metadata.GetMetrics();
metrics.SetLayoutViewport(CSSRect::FromAppUnits(aViewport));
nsIDocShell* docShell = presContext->GetDocShell();
BrowsingContext* bc = docShell ? docShell->GetBrowsingContext() : nullptr;
bool isTouchEventsEnabled =
docShell && docShell->GetTouchEventsOverride() ==
nsIDocShell::TOUCHEVENTS_OVERRIDE_ENABLED;
if (bc && bc->InRDMPane() && isTouchEventsEnabled) {
metadata.SetIsRDMTouchSimulationActive(true);
}
ViewID scrollId = ScrollableLayerGuid::NULL_SCROLL_ID;
if (aContent) {
if (void* paintRequestTime =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment