chromium/third_party/blink/renderer/core/page/grid_focusgroup_structure_info.h

// 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.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_GRID_FOCUSGROUP_STRUCTURE_INFO_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_GRID_FOCUSGROUP_STRUCTURE_INFO_H_

#include <optional>

#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/focusgroup_flags.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/member.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"

namespace blink {

class Element;
class LayoutObject;
class LayoutTable;
class LayoutTableCell;
class LayoutTableRow;

// This interface is used to expose the grid focusgroup navigation functions
// while hiding the type of grid we're in. A grid focusgroup can either be
// 'automatic' or 'manual', but there's no need to expose this additional level
// of complexity to the `FocusgroupController`. The interface is designed so
// that the classes that implements it are stateful, keeping a reference to the
// grid focusgroup root. This will prove useful to reduce the number of times
// helper functions need to do an ancestor chain walk to find the root grid
// focusgroup.
//
// TODO(bebeaudr): Implement ManualGridFocusgroupStructureInfo for 'manual-grid'
// focusgroups.
class GridFocusgroupStructureInfo {};

// An automatic grid focusgroup is one that is created by setting
// focusgroup='grid' on an HTML table element or an element that has
// `display: table`.
class CORE_EXPORT AutomaticGridFocusgroupStructureInfo final
    : public GarbageCollected<AutomaticGridFocusgroupStructureInfo>,
      public GridFocusgroupStructureInfo {};
}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_GRID_FOCUSGROUP_STRUCTURE_INFO_H_