Commit d297b61f authored by Jeonghee Ahn's avatar Jeonghee Ahn Committed by Commit Bot

[SpatNav] Trigger fake mouse hover after focus.

After the hover event, some element may change shape or even disappeared.
Current implementation trigger hover first and the focus is moved.
If the target element disappeared due to a hover event, SpatNav does not
finish completely.
Then the focus dose not move at all, but the target element get hover
status.

Events of hover are incidental, so moving focus should be first.
This patch change the order of event occurrence.

Bug: 1021426
Change-Id: Id20bda8ab94c97d4eeef6526cf5954effce7e78b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1897403Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Commit-Queue: Jeonghee Ahn <jeonghee27.ahn@lge.com>
Cr-Commit-Position: refs/heads/master@{#713389}
parent 2da203c8
...@@ -457,10 +457,10 @@ void SpatialNavigationController::MoveInterestTo(Node* next_node) { ...@@ -457,10 +457,10 @@ void SpatialNavigationController::MoveInterestTo(Node* next_node) {
element = interest_element_; element = interest_element_;
} }
DispatchMouseMoveAt(element); if (!element) {
DispatchMouseMoveAt(nullptr);
if (!element)
return; return;
}
// Before focusing the new element, check if we're leaving an iframe (= moving // Before focusing the new element, check if we're leaving an iframe (= moving
// focus out of an iframe). In this case, we want the exited [nested] iframes // focus out of an iframe). In this case, we want the exited [nested] iframes
...@@ -470,6 +470,7 @@ void SpatialNavigationController::MoveInterestTo(Node* next_node) { ...@@ -470,6 +470,7 @@ void SpatialNavigationController::MoveInterestTo(Node* next_node) {
element->focus(FocusParams(SelectionBehaviorOnFocus::kReset, element->focus(FocusParams(SelectionBehaviorOnFocus::kReset,
kWebFocusTypeSpatialNavigation, nullptr)); kWebFocusTypeSpatialNavigation, nullptr));
DispatchMouseMoveAt(element);
} }
void SpatialNavigationController::DispatchMouseMoveAt(Element* element) { void SpatialNavigationController::DispatchMouseMoveAt(Element* element) {
......
<!DOCTYPE html>
<style>
#btn1:hover {
visibility: hidden;
}
#btn2:hover {
display: none;
}
</style>
<button id="btn0">Button 0</button>
<button id="btn1">Button 1</button>
<button id="btn2">Button 2</button>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/snav-testharness.js"></script>
<script>
var resultMap = [
["Right", "btn0"],
["Right", "btn1"],
["Right", "btn2"]
];
snav.assertFocusMoves(resultMap);
</script>
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