chromium/third_party/blink/renderer/core/page/focusgroup_controller.cc

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/page/focusgroup_controller.h"

#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/flat_tree_traversal.h"
#include "third_party/blink/renderer/core/dom/focus_params.h"
#include "third_party/blink/renderer/core/dom/focusgroup_flags.h"
#include "third_party/blink/renderer/core/events/keyboard_event.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/input/event_handler.h"
#include "third_party/blink/renderer/core/page/focus_controller.h"
#include "third_party/blink/renderer/core/page/focusgroup_controller_utils.h"
#include "third_party/blink/renderer/core/page/grid_focusgroup_structure_info.h"

namespace blink {

utils;

// static
bool FocusgroupController::HandleArrowKeyboardEvent(KeyboardEvent* event,
                                                    const LocalFrame* frame) {}

// static
bool FocusgroupController::Advance(Element* initial_element,
                                   FocusgroupDirection direction) {}

// static
bool FocusgroupController::AdvanceForward(Element* initial_element,
                                          FocusgroupDirection direction) {}

// static
//
// This function validates that we can exit the current focusgroup by calling
// `CanExitFocusgroupForwardRecursive`, which validates that all ancestor
// focusgroups can be exited safely. We need to validate that the ancestor
// focusgroups can be exited only if they are exited. Here are the key scenarios
// where we prohibit a focusgroup from being exited: a. If we're going to an
// element that isn't part of a focusgroup. b. If we're exiting a root
// focusgroup (one that doesn't extend). c. If we're going to a focusgroup that
// doesn't support the direction. d. If we're exiting a focusgroup that should
// wrap.
bool FocusgroupController::CanExitFocusgroupForward(
    const Element* exiting_focusgroup,
    const Element* next_element,
    FocusgroupDirection direction) {}

// static
bool FocusgroupController::CanExitFocusgroupForwardRecursive(
    const Element* exiting_focusgroup,
    const Element* next_element,
    FocusgroupDirection direction,
    bool check_wrap) {}

// static
Element* FocusgroupController::WrapForward(Element* nearest_focusgroup,
                                           FocusgroupDirection direction) {}

// static
bool FocusgroupController::AdvanceBackward(Element* initial_element,
                                           FocusgroupDirection direction) {}

// static
Element* FocusgroupController::WrapBackward(Element* current,
                                            FocusgroupDirection direction) {}

// static
bool FocusgroupController::AdvanceInGrid(Element* initial_element,
                                         Element* grid_root,
                                         FocusgroupDirection direction) {}

// static
Element* FocusgroupController::WrapOrFlowInGrid(
    Element* element,
    FocusgroupDirection direction,
    GridFocusgroupStructureInfo* helper) {}

// static
void FocusgroupController::Focus(Element* element,
                                 FocusgroupDirection direction) {}

}  // namespace blink