Skip to content

Commit

Permalink
Enable UnifiedTouchAdjustment feature by default
Browse files Browse the repository at this point in the history
Turn blink runtime_enable_feature flags to stable;
Removes content_feature flags used for finch trial;
Makes related histogram as obselete.

intent to ship:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/l5PCVakcOCE

Bug: 805650, 625198
Change-Id: I873a77f98670f5f293b20a1b3a4373ace93027db
Reviewed-on: https://chromium-review.googlesource.com/978626
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557989}
  • Loading branch information
EiraGe authored and Commit Bot committed May 11, 2018
1 parent 403ed15 commit 05e7982
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 77 deletions.
3 changes: 0 additions & 3 deletions content/child/runtime_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,6 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs(
WebRuntimeFeatures::EnableCacheInlineScriptCode(
base::FeatureList::IsEnabled(features::kCacheInlineScriptCode));

if (base::FeatureList::IsEnabled(features::kUnifiedTouchAdjustment))
WebRuntimeFeatures::EnableUnifiedTouchAdjustment(true);

// Make srcset on link rel=preload work with SignedHTTPExchange flag too.
if (base::FeatureList::IsEnabled(features::kSignedHTTPExchange))
WebRuntimeFeatures::EnablePreloadImageSrcSetEnabled(true);
Expand Down
5 changes: 0 additions & 5 deletions content/public/common/content_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,6 @@ const base::Feature kTopDocumentIsolation{"top-document-isolation",
const base::Feature kTouchpadAndWheelScrollLatching{
"TouchpadAndWheelScrollLatching", base::FEATURE_ENABLED_BY_DEFAULT};

// Enables unified touch adjustment which adjusts touch events target to a best
// nearby node.
const base::Feature kUnifiedTouchAdjustment{"UnifiedTouchAdjustment",
base::FEATURE_DISABLED_BY_DEFAULT};

// Use Feature Policy to gate the use of permission features like midi,
// geolocation, camera, microphone, etc.
const base::Feature kUseFeaturePolicyForPermissions{
Expand Down
1 change: 0 additions & 1 deletion content/public/common/content_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ CONTENT_EXPORT extern const base::Feature kTimerThrottlingForHiddenFrames;
CONTENT_EXPORT extern const base::Feature kTopDocumentIsolation;
CONTENT_EXPORT extern const base::Feature kTouchpadAndWheelScrollLatching;
CONTENT_EXPORT extern const base::Feature kTouchpadOverscrollHistoryNavigation;
CONTENT_EXPORT extern const base::Feature kUnifiedTouchAdjustment;
CONTENT_EXPORT extern const base::Feature kUseFeaturePolicyForPermissions;
CONTENT_EXPORT extern const base::Feature kUserActivationV2;
CONTENT_EXPORT extern const base::Feature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Wheel: 0+1
TouchStart: 1+1
TouchMove: 0+0
TouchEnd: 0+0
GestureTapDown: 1+2
GestureShowPress: 1+2
GestureTap: 1+4
GestureTapDown: 0+1
GestureShowPress: 0+1
GestureTap: 0+3
GestureScrollBegin: 0+1
GestureTapCancel: 0+1
GestureScrollUpdate: 0+0
Expand All @@ -38,9 +38,9 @@ Wheel: 0+1 0+1 0+1
TouchStart: 2+0 2+0 1+1
TouchMove: 0+0 0+0 0+0
TouchEnd: 0+0 0+0 0+0
GestureTapDown: 2+0 2+0 1+2
GestureShowPress: 2+0 2+0 1+2
GestureTap: 2+0 2+0 1+4
GestureTapDown: 1+0 1+0 0+1
GestureShowPress: 1+0 1+0 0+1
GestureTap: 1+0 1+0 0+3
GestureScrollBegin: 0+1 0+1 0+1
GestureTapCancel: 1+0 1+0 0+1
GestureScrollUpdate: 0+0 0+0 0+0
Expand All @@ -57,9 +57,9 @@ Wheel: 0+1 0+1 0+0
TouchStart: 2+0 1+1 1+0
TouchMove: 0+0 0+0 0+0
TouchEnd: 0+0 0+0 0+0
GestureTapDown: 2+0 1+1 1+0
GestureShowPress: 2+0 1+1 1+0
GestureTap: 2+0 1+3 1+0
GestureTapDown: 1+0 0+1 0+0
GestureShowPress: 1+0 0+1 0+0
GestureTap: 1+0 0+3 0+0
GestureScrollBegin: 0+1 0+1 0+0
GestureTapCancel: 1+0 0+1 0+0
GestureScrollUpdate: 0+0 0+0 0+0
Expand All @@ -76,9 +76,9 @@ Wheel: 0+1
TouchStart: 1+1
TouchMove: 0+0
TouchEnd: 0+0
GestureTapDown: 1+2
GestureShowPress: 1+2
GestureTap: 1+4 [with multiTargetTapNotification: 2+4]
GestureTapDown: 0+1
GestureShowPress: 0+1
GestureTap: 0+3 [with multiTargetTapNotification: 1+3]
GestureScrollBegin: 0+1
GestureTapCancel: 0+1
GestureScrollUpdate: 0+0
Expand Down
1 change: 0 additions & 1 deletion third_party/blink/public/platform/web_runtime_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ class WebRuntimeFeatures {
BLINK_PLATFORM_EXPORT static void EnableStopLoadingInBackground(bool);
BLINK_PLATFORM_EXPORT static void EnableStopNonTimersInBackground(bool);
BLINK_PLATFORM_EXPORT static void EnablePWAFullCodeCache(bool);
BLINK_PLATFORM_EXPORT static void EnableUnifiedTouchAdjustment(bool);
BLINK_PLATFORM_EXPORT static void EnableMojoBlobURLs(bool);
BLINK_PLATFORM_EXPORT static void EnableOffMainThreadWebSocket(bool);
BLINK_PLATFORM_EXPORT static void EnableExperimentalProductivityFeatures(
Expand Down
56 changes: 10 additions & 46 deletions third_party/blink/renderer/core/input/event_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,6 @@ bool ShouldRefetchEventTarget(const MouseEventWithHitTestResults& mev) {
IsHTMLInputElement(ToShadowRoot(target_node)->host());
}

enum class UMATouchAdjustmentNodeRelation {
kSameNode = 0,
kTouchStartNodeIsDescendantOfTapNode = 1,
kTapNodeIsDescendantOfTouchStartNode = 2,
kOthers = 3,
kTouchAdjustmentNodeRelationCount = 4
};

} // namespace

using namespace HTMLNames;
Expand Down Expand Up @@ -1687,13 +1679,16 @@ GestureEventWithHitTestResults EventHandler::HitTestResultForGestureEvent(
LayoutSize padding;

if (ShouldApplyTouchAdjustment(gesture_event)) {
padding = LayoutSize(adjusted_event.TapAreaInRootFrame());
if (!padding.IsEmpty()) {
padding.Scale(1.f / 2);
// Apply the same bound as touchstart event to adjustment padding
if (RuntimeEnabledFeatures::UnifiedTouchAdjustmentEnabled())
padding = GetHitTestRectForAdjustment(FlooredIntSize(padding));
hit_type |= HitTestRequest::kListBased;
// If gesture_event unique id matches the stored touch event result, do
// point-base hit test. Otherwise add padding and do rect-based hit test.
if (GestureCorrespondsToAdjustedTouch(gesture_event)) {
adjusted_event.ApplyTouchAdjustment(
touch_adjustment_result_.adjusted_point);
} else {
padding = GetHitTestRectForAdjustment(
LayoutSize(adjusted_event.TapAreaInRootFrame()) * 0.5f);
if (!padding.IsEmpty())
hit_type |= HitTestRequest::kListBased;
}
}
LayoutPoint hit_test_point(frame_->View()->RootFrameToContents(
Expand Down Expand Up @@ -1737,37 +1732,6 @@ GestureEventWithHitTestResults EventHandler::HitTestResultForGestureEvent(
UMA_HISTOGRAM_COUNTS_100("Event.Touch.TouchAdjustment.AdjustDistance",
static_cast<int>(adjusted_distance));
}
if (GestureCorrespondsToAdjustedTouch(gesture_event)) {
LayoutPoint stored_adjusted_point(frame_->View()->RootFrameToContents(
touch_adjustment_result_.adjusted_point));
HitTestResult point_base_result = HitTestResultAtPoint(
stored_adjusted_point,
(hit_type | HitTestRequest::kReadOnly) & ~HitTestRequest::kListBased);
if (gesture_event.GetType() == WebInputEvent::kGestureTap) {
if (hit_test_result.InnerNode() && point_base_result.InnerNode()) {
UMATouchAdjustmentNodeRelation relation =
UMATouchAdjustmentNodeRelation::kOthers;
if (hit_test_result.InnerNode() == point_base_result.InnerNode()) {
relation = UMATouchAdjustmentNodeRelation::kSameNode;
} else if (point_base_result.InnerNode()->IsDescendantOf(
hit_test_result.InnerNode())) {
relation = UMATouchAdjustmentNodeRelation::
kTouchStartNodeIsDescendantOfTapNode;
} else if (hit_test_result.InnerNode()->IsDescendantOf(
point_base_result.InnerNode())) {
relation = UMATouchAdjustmentNodeRelation::
kTapNodeIsDescendantOfTouchStartNode;
}
UMA_HISTOGRAM_ENUMERATION(
"Event.Touch.TouchAdjustment.AdjustedNode", relation,
UMATouchAdjustmentNodeRelation::kTouchAdjustmentNodeRelationCount);
}
}
adjusted_event.ApplyTouchAdjustment(
touch_adjustment_result_.adjusted_point);
return GestureEventWithHitTestResults(adjusted_event, point_base_result);
}

return GestureEventWithHitTestResults(adjusted_event, hit_test_result);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ void PointerEventManager::AdjustTouchPointerEvent(
WebPointerProperties::PointerType::kTouch);

LayoutSize padding = GetHitTestRectForAdjustment(
IntSize(pointer_event.width / 2, pointer_event.height / 2));
LayoutSize(pointer_event.width, pointer_event.height) * 0.5f);

if (padding.IsEmpty())
return;
Expand Down
4 changes: 2 additions & 2 deletions third_party/blink/renderer/core/page/touch_adjustment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,10 @@ bool FindBestContextMenuCandidate(Node*& target_node,
subtargets, TouchAdjustment::HybridDistanceFunction);
}

LayoutSize GetHitTestRectForAdjustment(const IntSize& touch_area) {
LayoutSize GetHitTestRectForAdjustment(const LayoutSize& touch_area) {
const LayoutSize max_size(TouchAdjustment::kMaxAdjustmentRadiusDips,
TouchAdjustment::kMaxAdjustmentRadiusDips);
return LayoutSize(touch_area).ShrunkTo(max_size);
return touch_area.ShrunkTo(max_size);
}

} // namespace blink
2 changes: 1 addition & 1 deletion third_party/blink/renderer/core/page/touch_adjustment.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bool FindBestContextMenuCandidate(Node*& target_node,
const IntRect& touch_area,
const HeapVector<Member<Node>>&);

LayoutSize GetHitTestRectForAdjustment(const IntSize& touch_area);
LayoutSize GetHitTestRectForAdjustment(const LayoutSize& touch_area);

struct TouchAdjustmentResult {
uint32_t unique_event_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,6 @@ void WebRuntimeFeatures::EnablePWAFullCodeCache(bool enable) {
RuntimeEnabledFeatures::SetPWAFullCodeCacheEnabled(enable);
}

void WebRuntimeFeatures::EnableUnifiedTouchAdjustment(bool enable) {
RuntimeEnabledFeatures::SetUnifiedTouchAdjustmentEnabled(enable);
}

void WebRuntimeFeatures::EnableMojoBlobURLs(bool enable) {
RuntimeEnabledFeatures::SetMojoBlobURLsEnabled(enable);
}
Expand Down
4 changes: 4 additions & 0 deletions third_party/blink/renderer/platform/geometry/layout_size.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ inline LayoutSize operator-(const LayoutSize& size) {
return LayoutSize(-size.Width(), -size.Height());
}

inline LayoutSize operator*(const LayoutSize& a, const float scale) {
return LayoutSize(a.Width() * scale, a.Height() * scale);
}

inline bool operator==(const LayoutSize& a, const LayoutSize& b) {
return a.Width() == b.Width() && a.Height() == b.Height();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@
},
{
name: "UnifiedTouchAdjustment",
status: "experimental",
status: "stable",
},
{
name: "UserActivationV2",
Expand Down
3 changes: 3 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23615,6 +23615,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.

<histogram name="Event.Touch.TouchAdjustment.AdjustedNode"
enum="TouchAdjustmentNodeRelation">
<obsolete>
Deprecated 03/2018 due to no longer needed.
</obsolete>
<owner>eirage@chromium.org</owner>
<summary>
Records if doing touch adjustment on touchstart have same hit test node as
Expand Down

0 comments on commit 05e7982

Please sign in to comment.