Commit 49d07de2 authored by Lan Wei's avatar Lan Wei Committed by Commit Bot

Do not update mouse cursor after layout is changed

After we enabled flag of NoHoverAfterLayoutChangeEnabled, we did not
see any improvement of the HitTest count, now we do not update the
mouse cursor as well to see if we get any improvement.

We will update the hover effect and mouse cursor after the layout is
changed in a following patch.

Bug: 877132
Change-Id: Ie8e56df652e2b04add2880cb75aa28f52bb92e56
Reviewed-on: https://chromium-review.googlesource.com/c/1274201Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Commit-Queue: Lan Wei <lanwei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599382}
parent 35bbced8
<!DOCTYPE html>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<script src='../../resources/gesture-util.js'></script>
<script src="resources/expect-cursor-update.js"></script>
<style>
#test-container {
position: relative;
padding: 10px;
}
#target {
cursor: text;
background-color: blue;
width: 100px;
height: 100px;
}
#overlay {
cursor: wait;
width: 200px;
height: 200px;
background: rgba(255,0,0,0.2);
position: absolute;
left: 0;
top: 0;
}
</style>
<div id="test-container">
<div id="target"></div>
</div>
<script>
var addedOverlay = false;
function addOverlay() {
var testContainer = document.getElementById('test-container');
var overlay = document.createElement('div');
overlay.id='overlay';
testContainer.appendChild(overlay);
addedOverlay = true;
}
window.onload = async () => {
if (window.internals) {
internals.runtimeFlags.noHoverAfterLayoutChangeEnabled = true;
}
promise_test (async () => {
document.addEventListener('click', addOverlay);
var target = document.getElementById('target');
var rect = target.getBoundingClientRect();
await mouseMoveTo(rect.left + 3, rect.top + 3);
await waitFor( () => { return internals.getCurrentCursorInfo() == 'type=IBeam hotSpot=0,0';}, 'wait for move to target');
await mouseClickOn(rect.left + 3, rect.top + 3);
await waitFor(() => { return addedOverlay; });
await conditionHolds( () => { return internals.getCurrentCursorInfo() == 'type=IBeam hotSpot=0,0';}, 'wait for no mouse cursor change');
}, 'Tests that there is no mouse cursor update when the element underneath the mouse cursor is changed.');
}
</script>
\ No newline at end of file
...@@ -614,7 +614,6 @@ void MouseEventManager::MayUpdateHoverWhenContentUnderMouseChanged( ...@@ -614,7 +614,6 @@ void MouseEventManager::MayUpdateHoverWhenContentUnderMouseChanged(
if (RuntimeEnabledFeatures::NoHoverAfterLayoutChangeEnabled() && if (RuntimeEnabledFeatures::NoHoverAfterLayoutChangeEnabled() &&
update_hover_reason == update_hover_reason ==
MouseEventManager::UpdateHoverReason::kLayoutOrStyleChanged) { MouseEventManager::UpdateHoverReason::kLayoutOrStyleChanged) {
frame_->LocalFrameRoot().GetEventHandler().ScheduleCursorUpdate();
return; return;
} }
......
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