Commit 1f586f6b authored by Alexey Baskakov's avatar Alexey Baskakov Committed by Commit Bot

Revert "Do not apply hover during scroll"

This reverts commit cdafdcb9.

Reason for revert: Time outs on Mac https://bugs.chromium.org/p/chromium/issues/detail?id=892016

Original change's description:
> Do not apply hover during scroll
> 
> In order to improve the performance and eliminate the issues that the
> fake mouse move events cause to the testing and web developers, we
> should not send fake mouse move events during scroll. This is
> implemented behind a flag.
> 
> We will update the hover effect after scroll finishes in a following
> patch.
> 
> Bug: 877132
> Change-Id: Iee838f50e0a52b5048081d79f91442ddf0467e8f
> Reviewed-on: https://chromium-review.googlesource.com/c/1211907
> Commit-Queue: Lan Wei <lanwei@chromium.org>
> Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
> Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
> Reviewed-by: David Bokan <bokan@chromium.org>
> Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#596049}

TBR=dgozman@chromium.org,bokan@chromium.org,lanwei@chromium.org,dtapuska@chromium.org,nzolghadr@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 877132
Change-Id: Ia388825045560d1d4cd4275e4ec5572819f2b6a1
Reviewed-on: https://chromium-review.googlesource.com/c/1260603Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
Commit-Queue: Alexey Baskakov <loyso@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596529}
parent 0b676b13
...@@ -499,9 +499,6 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( ...@@ -499,9 +499,6 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs(
WebRuntimeFeatures::EnableNoHoverAfterLayoutChange( WebRuntimeFeatures::EnableNoHoverAfterLayoutChange(
base::FeatureList::IsEnabled(features::kNoHoverAfterLayoutChange)); base::FeatureList::IsEnabled(features::kNoHoverAfterLayoutChange));
WebRuntimeFeatures::EnableNoHoverDuringScroll(
base::FeatureList::IsEnabled(features::kNoHoverDuringScroll));
} }
} // namespace content } // namespace content
<!DOCTYPE html>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<script src='../../resources/gesture-util.js'></script>
<style>
body, html {
margin: 0;
}
div {
height: 50px;
width: 100%;
}
.hoverme {
background-color: rgb(0, 0, 255);
}
.hoverme:hover {
background-color: rgb(255, 255, 0);
}
.message {
width: 100%;
text-align: left;
}
</style>
<div class="message">
First move your mouse cursor to the page, you will see the text under the mouse cursor changed to "currently hovered". <br>
Scroll mouse wheel slowly, you should not see any text under the mouse changed to "currently hovered" while the scrolling is in process and finishes.
</div>
<script>
let array;
const numHoverElements = 30;
const elementHeight = 50;
const textWhenNotHovered = "hover over me";
const textWhenHovered = "currently hovered";
const textWhenWasHovered = "was hovered";
const mouse = GestureSourceType.MOUSE_INPUT;
function buildPage() {
for (let i = 0; i < numHoverElements; i++) {
let div = document.createElement('div');
div.className = "hoverme";
div.innerHTML = textWhenNotHovered;
document.body.appendChild(div);
}
array = document.getElementsByClassName('hoverme');
for (let element of array) {
element.addEventListener('mouseover', function (e) {
this.innerHTML = textWhenHovered;
});
element.addEventListener('mouseout', function (e) {
this.innerHTML = textWhenWasHovered;
});
}
}
window.onload = async () => {
if (window.internals) {
internals.settings.setScrollAnimatorEnabled(false);
internals.runtimeFlags.noHoverDuringScrollEnabled = true;
}
buildPage();
await waitForCompositorCommit();
promise_test(async () => {
let x = array[0].offsetLeft + 10;
let y = array[0].offsetTop + 10;
// Move cursor to 1st element.
await mouseMoveTo(x, y);
await waitFor( () => { return array[0].innerHTML == textWhenHovered;}, 'wait for moveto 1st element');
assert_equals(array[0].innerHTML, textWhenHovered);
assert_equals(array[1].innerHTML, textWhenNotHovered);
assert_equals(getComputedStyle(array[0]).backgroundColor, 'rgb(255, 255, 0)');
// Scroll end up at 4th element. Hover state does not update during scrolling
// so that 2nd, 3rd and 4th elements do not see the mouseover and mouseout events.
assert_equals(document.scrollingElement.scrollTop, 0);
await smoothScroll(3 * elementHeight, x, y, mouse, 'down', SPEED_INSTANT);
// Wait enough time to see if we fire a fake mouse move event to update the hover state.
await waitForAnimationEnd(() => { return document.scrollingElement.scrollTop; }, 200, 100);
assert_approx_equals(document.scrollingElement.scrollTop, 3 * elementHeight, 10);
assert_equals(array[0].innerHTML, textWhenHovered);
assert_equals(array[1].innerHTML, textWhenNotHovered);
assert_equals(array[2].innerHTML, textWhenNotHovered);
assert_equals(array[3].innerHTML, textWhenNotHovered);
assert_equals(array[4].innerHTML, textWhenNotHovered);
assert_equals(getComputedStyle(array[0]).backgroundColor, 'rgb(255, 255, 0)');
assert_equals(getComputedStyle(array[1]).backgroundColor, 'rgb(0, 0, 255)');
assert_equals(getComputedStyle(array[2]).backgroundColor, 'rgb(0, 0, 255)');
assert_equals(getComputedStyle(array[3]).backgroundColor, 'rgb(0, 0, 255)');
}, 'Mouse wheel scroll on the page, no hover update during scrolling.');
}
</script>
\ No newline at end of file
...@@ -113,7 +113,6 @@ class WebRuntimeFeatures { ...@@ -113,7 +113,6 @@ class WebRuntimeFeatures {
BLINK_PLATFORM_EXPORT static void EnableNetInfoDownlinkMax(bool); BLINK_PLATFORM_EXPORT static void EnableNetInfoDownlinkMax(bool);
BLINK_PLATFORM_EXPORT static void EnableNetworkService(bool); BLINK_PLATFORM_EXPORT static void EnableNetworkService(bool);
BLINK_PLATFORM_EXPORT static void EnableNoHoverAfterLayoutChange(bool); BLINK_PLATFORM_EXPORT static void EnableNoHoverAfterLayoutChange(bool);
BLINK_PLATFORM_EXPORT static void EnableNoHoverDuringScroll(bool);
BLINK_PLATFORM_EXPORT static void EnableNotificationConstructor(bool); BLINK_PLATFORM_EXPORT static void EnableNotificationConstructor(bool);
BLINK_PLATFORM_EXPORT static void EnableNotificationContentImage(bool); BLINK_PLATFORM_EXPORT static void EnableNotificationContentImage(bool);
BLINK_PLATFORM_EXPORT static void EnableNotifications(bool); BLINK_PLATFORM_EXPORT static void EnableNotifications(bool);
......
...@@ -620,10 +620,8 @@ void MouseEventManager::MayUpdateHoverWhenContentUnderMouseChanged( ...@@ -620,10 +620,8 @@ void MouseEventManager::MayUpdateHoverWhenContentUnderMouseChanged(
if (update_hover_reason == if (update_hover_reason ==
MouseEventManager::UpdateHoverReason::kScrollOffsetChanged && MouseEventManager::UpdateHoverReason::kScrollOffsetChanged &&
(RuntimeEnabledFeatures::NoHoverDuringScrollEnabled() || mouse_pressed_)
mouse_pressed_)) {
return; return;
}
// TODO(lanwei): When the mouse position is unknown, we do not send the fake // TODO(lanwei): When the mouse position is unknown, we do not send the fake
// mousemove event for now, so we cannot update the hover states and mouse // mousemove event for now, so we cannot update the hover states and mouse
......
...@@ -216,10 +216,6 @@ void WebRuntimeFeatures::EnableNoHoverAfterLayoutChange(bool enable) { ...@@ -216,10 +216,6 @@ void WebRuntimeFeatures::EnableNoHoverAfterLayoutChange(bool enable) {
RuntimeEnabledFeatures::SetNoHoverAfterLayoutChangeEnabled(enable); RuntimeEnabledFeatures::SetNoHoverAfterLayoutChangeEnabled(enable);
} }
void WebRuntimeFeatures::EnableNoHoverDuringScroll(bool enable) {
RuntimeEnabledFeatures::SetNoHoverDuringScrollEnabled(enable);
}
void WebRuntimeFeatures::EnableNotificationConstructor(bool enable) { void WebRuntimeFeatures::EnableNotificationConstructor(bool enable) {
RuntimeEnabledFeatures::SetNotificationConstructorEnabled(enable); RuntimeEnabledFeatures::SetNotificationConstructorEnabled(enable);
} }
......
...@@ -817,10 +817,6 @@ ...@@ -817,10 +817,6 @@
name: "NoHoverAfterLayoutChange", name: "NoHoverAfterLayoutChange",
settable_from_internals: true, settable_from_internals: true,
}, },
{
name: "NoHoverDuringScroll",
settable_from_internals: true,
},
{ {
name: "NoIdleEncodingForLayoutTests", name: "NoIdleEncodingForLayoutTests",
status: "test", status: "test",
......
...@@ -19,7 +19,4 @@ const base::Feature kSendMouseLeaveEvents{"SendMouseLeaveEvents", ...@@ -19,7 +19,4 @@ const base::Feature kSendMouseLeaveEvents{"SendMouseLeaveEvents",
const base::Feature kNoHoverAfterLayoutChange{ const base::Feature kNoHoverAfterLayoutChange{
"NoHoverAfterLayoutChange", base::FEATURE_DISABLED_BY_DEFAULT}; "NoHoverAfterLayoutChange", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kNoHoverDuringScroll{"NoHoverDuringScroll",
base::FEATURE_DISABLED_BY_DEFAULT};
} }
...@@ -20,15 +20,8 @@ extern const base::Feature kResamplingScrollEvents; ...@@ -20,15 +20,8 @@ extern const base::Feature kResamplingScrollEvents;
// the native platforms. crbug.com/450631 // the native platforms. crbug.com/450631
extern const base::Feature kSendMouseLeaveEvents; extern const base::Feature kSendMouseLeaveEvents;
// When enabled, this feature prevents Blink from changing the hover state and // Do not update hover after the layout is changed.
// dispatching mouse enter/exit events for elements under the mouse after the
// layout under the mouse cursor is changed.
extern const base::Feature kNoHoverAfterLayoutChange; extern const base::Feature kNoHoverAfterLayoutChange;
// When enabled, this feature prevents Blink from changing the hover state and
// dispatching mouse enter/exit events for elements under the mouse as the page
// is scrolled.
extern const base::Feature kNoHoverDuringScroll;
} }
#endif // UI_EVENTS_BLINK_BLINK_FEATURES_H_ #endif // UI_EVENTS_BLINK_BLINK_FEATURES_H_
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