0

[DragDrop] Update the default param value for movement threshold Dip

Update the default movement threshold to 60dp to match launched finch setup cl/476139880

Bug: 1339117
Change-Id: Ieb2f53630713bee1f9ec812ea2d22e7f2578ac3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3914074
Commit-Queue: Wenyu Fu <wenyufu@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1050692}
This commit is contained in:
Wenyu Fu
2022-09-23 16:52:56 +00:00
committed by Chromium LUCI CQ
parent c18bd39016
commit bbbe3a36d2
3 changed files with 18 additions and 16 deletions

@ -29,6 +29,7 @@
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "content/public/common/drop_data.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/android/overscroll_refresh_handler.h"
@ -55,11 +56,8 @@ namespace {
// Returns the minimum distance in DIPs, for drag event being considered as an
// intentional drag.
float DragMovementThresholdDip() {
static float radius = base::GetFieldTrialParamByFeatureAsDouble(
features::kTouchDragAndContextMenu,
features::kDragAndDropMovementThresholdDipParam,
/*default_value=*/gfx::ViewConfiguration::GetTouchSlopInDips());
int DragMovementThresholdDip() {
static int radius = features::kTouchDragMovementThresholdDip.Get();
return radius;
}
@ -469,7 +467,7 @@ void WebContentsViewAndroid::OnDragUpdated(const gfx::PointF& location,
is_active_drag_ = true;
drag_entered_location_ = location;
} else if (!drag_exceeded_movement_threshold_) {
float radius = DragMovementThresholdDip();
int radius = DragMovementThresholdDip();
if (!drag_location_.IsWithinDistance(drag_entered_location_, radius)) {
drag_exceeded_movement_threshold_ = true;
if (delegate_)

@ -1136,6 +1136,16 @@ BASE_FEATURE(kTouchDragAndContextMenu,
"TouchDragAndContextMenu",
base::FEATURE_DISABLED_BY_DEFAULT);
#if BUILDFLAG(IS_ANDROID)
// When the context menu is triggered, the browser allows motion in a small
// region around the initial touch location menu to allow for finger jittering.
// This param holds the movement threshold in DIPs to consider drag an
// intentional drag, which will dismiss the current context menu and prevent new
// menu from showing.
const base::FeatureParam<int> kTouchDragMovementThresholdDip{
&kTouchDragAndContextMenu, "DragAndDropMovementThresholdDipParam", 60};
#endif
// Enables async touchpad pinch zoom events. We check the ACK of the first
// synthetic wheel event in a pinch sequence, then send the rest of the
// synthetic wheel events of the pinch sequence as non-blocking if the first
@ -1422,14 +1432,6 @@ BASE_FEATURE(kWebViewThrottleBackgroundBeginFrame,
"WebViewThrottleBackgroundBeginFrame",
base::FEATURE_DISABLED_BY_DEFAULT);
// When the context menu is triggered, the browser allows motion in a small
// region around the initial touch location menu to allow for finger jittering.
// This param holds the movement threshold in DIPs to consider drag an
// intentional drag, which will dismiss the current context menu and prevent new
// menu from showing.
const char kDragAndDropMovementThresholdDipParam[] =
"DragAndDropMovementThresholdDipParam";
// Temporarily pauses the compositor early in navigation.
BASE_FEATURE(kOptimizeEarlyNavigation,
"OptimizeEarlyNavigation",

@ -253,6 +253,10 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kSuppressDifferentOriginSubframeJSDialogs);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kSyntheticPointerActions);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kThreadingOptimizationsOnIO);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kTouchDragAndContextMenu);
#if BUILDFLAG(IS_ANDROID)
CONTENT_EXPORT extern const base::FeatureParam<int>
kTouchDragMovementThresholdDip;
#endif
CONTENT_EXPORT BASE_DECLARE_FEATURE(kTouchpadAsyncPinchEvents);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kTouchpadOverscrollHistoryNavigation);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kTreatBootstrapAsDefault);
@ -310,8 +314,6 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kWarmUpNetworkProcess);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebNfc);
CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebViewThrottleBackgroundBeginFrame);
extern const char kDragAndDropMovementThresholdDipParam[];
CONTENT_EXPORT BASE_DECLARE_FEATURE(kOptimizeEarlyNavigation);
CONTENT_EXPORT extern const base::FeatureParam<base::TimeDelta>
kCompositorLockTimeout;