Bug 1275604 - Make the touch-action pref live. r=botond

As part of making the pref live, we need to ensure that if the pref is flipped
while an input block is in the input queue, the behaviour that results is
reasonable. In particular, if a touch block is created while touch-action is
disabled, but the pref is enabled while that block is in the queue, it may
suddenly go from IsReadyForHandling() returning true to IsReadyForHandling()
returning false. This can result in the block getting stuck in the queue and
preventing future touch blocks from being processed at all. To handle this
case, we explicitly set the mAllowedTouchBehaviorSet flag to true if the block
is created with touch-action disabled. This prevents IsReadyForHandling() from
flipping to false in these cases.

MozReview-Commit-ID: CJq9NtMF1Bq
This commit is contained in:
Kartikaya Gupta 2016-06-01 13:13:14 -04:00
parent a1cd4e106d
commit 9ece31839d
2 changed files with 11 additions and 1 deletions

View File

@ -739,6 +739,9 @@ TouchBlockState::TouchBlockState(const RefPtr<AsyncPanZoomController>& aTargetAp
, mTouchCounter(aCounter)
{
TBS_LOG("Creating %p\n", this);
if (!gfxPrefs::TouchActionEnabled()) {
mAllowedTouchBehaviorSet = true;
}
}
bool
@ -778,6 +781,7 @@ bool
TouchBlockState::HasReceivedAllContentNotifications() const
{
return CancelableBlockState::HasReceivedAllContentNotifications()
// See comment in TouchBlockState::IsReadyforHandling()
&& (!gfxPrefs::TouchActionEnabled() || mAllowedTouchBehaviorSet);
}
@ -789,6 +793,12 @@ TouchBlockState::IsReadyForHandling() const
}
if (!gfxPrefs::TouchActionEnabled()) {
// If TouchActionEnabled() was false when this block was created, then
// mAllowedTouchBehaviorSet is guaranteed to the true. However, the pref
// may have been flipped to false after the block was created. In that case,
// we should eventually get the touch-behaviour notification, or expire the
// content response timeout, but we don't really need to wait for those,
// since we don't care about the touch-behaviour values any more.
return true;
}

View File

@ -401,7 +401,7 @@ private:
DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-max-velocity", ScrollSnapPredictionMaxVelocity, int32_t, 2000);
DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-sensitivity", ScrollSnapPredictionSensitivity, float, 0.750f);
DECL_GFX_PREF(Live, "layout.css.scroll-snap.proximity-threshold", ScrollSnapProximityThreshold, int32_t, 200);
DECL_GFX_PREF(Once, "layout.css.touch_action.enabled", TouchActionEnabled, bool, false);
DECL_GFX_PREF(Live, "layout.css.touch_action.enabled", TouchActionEnabled, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.dump", LayoutDumpDisplayList, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.dump-content", LayoutDumpDisplayListContent, bool, false);
DECL_GFX_PREF(Live, "layout.event-regions.enabled", LayoutEventRegionsEnabledDoNotUseDirectly, bool, false);