diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 17:21:03 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 16:25:15 +0000 |
commit | c551f43206405019121bd2b2c93714319a0a3300 (patch) | |
tree | 1f48c30631c421fd4bbb3c36da20183c8a2ed7d7 /chromium/third_party/blink/renderer/core/page/spatial_navigation_controller.cc | |
parent | 7961cea6d1041e3e454dae6a1da660b453efd238 (diff) | |
download | qtwebengine-chromium-c551f43206405019121bd2b2c93714319a0a3300.tar.gz |
BASELINE: Update Chromium to 79.0.3945.139
Change-Id: I336b7182fab9bca80b709682489c07db112eaca5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/page/spatial_navigation_controller.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/page/spatial_navigation_controller.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/chromium/third_party/blink/renderer/core/page/spatial_navigation_controller.cc b/chromium/third_party/blink/renderer/core/page/spatial_navigation_controller.cc index 4315f0eba48..57746336350 100644 --- a/chromium/third_party/blink/renderer/core/page/spatial_navigation_controller.cc +++ b/chromium/third_party/blink/renderer/core/page/spatial_navigation_controller.cc @@ -4,7 +4,7 @@ #include "third_party/blink/renderer/core/page/spatial_navigation_controller.h" -#include "services/service_manager/public/cpp/interface_provider.h" +#include "third_party/blink/public/common/browser_interface_broker_proxy.h" #include "third_party/blink/public/platform/web_scroll_into_view_params.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/element.h" @@ -96,7 +96,6 @@ static void ConsiderForBestCandidate(SpatialNavigationDirection direction, if (distance == kMaxDistance) return; - if (distance < *best_distance && IsUnobscured(candidate)) { *best_candidate = candidate; *best_distance = distance; @@ -139,12 +138,20 @@ bool SpatialNavigationController::HandleArrowKeyboardEvent( if (direction == SpatialNavigationDirection::kNone) return false; + // If the focus has already moved by a previous handler, return false. + const Element* focused = GetFocusedElement(); + if (focused && focused != event->target()) { + // SpatNav does not need to handle this arrow key because + // the webpage had a key-handler that already moved focus. + return false; + } + // In focusless mode, the user must explicitly move focus in and out of an // editable so we can avoid advancing interest and we should swallow the // event. This prevents double-handling actions for things like search box // suggestions. if (RuntimeEnabledFeatures::FocuslessSpatialNavigationEnabled()) { - if (Element* focused = GetFocusedElement()) { + if (focused) { if (HasEditableStyle(*focused) || focused->IsTextControl()) return true; } @@ -466,8 +473,11 @@ void SpatialNavigationController::MoveInterestTo(Node* next_node) { } void SpatialNavigationController::DispatchMouseMoveAt(Element* element) { - FloatPoint event_position = - element ? RectInViewport(*element).Location() : FloatPoint(-1, -1); + FloatPoint event_position(-1, -1); + if (element) { + event_position = RectInViewport(*element).Location(); + event_position.Move(1, 1); + } // TODO(bokan): Can we get better screen coordinates? FloatPoint event_position_screen = event_position; @@ -639,7 +649,7 @@ SpatialNavigationController::GetSpatialNavigationHost() { if (!frame) return spatial_navigation_host_; - frame->GetInterfaceProvider().GetInterface( + frame->GetBrowserInterfaceBroker().GetInterface( spatial_navigation_host_.BindNewPipeAndPassReceiver( frame->GetTaskRunner(TaskType::kMiscPlatformAPI))); } |