chromium/third_party/blink/renderer/core/html/forms/select_type.cc

/*
 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * Copyright (C) 1999 Lars Knoll ([email protected])
 *           (C) 1999 Antti Koivisto ([email protected])
 *           (C) 2001 Dirk Mueller ([email protected])
 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
 * reserved.
 *           (C) 2006 Alexey Proskuryakov ([email protected])
 * Copyright (C) 2010 Google Inc. All rights reserved.
 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
 * (http://www.torchmobile.com/)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 */

#include "third_party/blink/renderer/core/html/forms/select_type.h"

#include "build/build_config.h"
#include "third_party/blink/public/mojom/scroll/scroll_into_view_params.mojom-blink.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_mutation_observer_init.h"
#include "third_party/blink/renderer/core/accessibility/ax_object_cache.h"
#include "third_party/blink/renderer/core/css/style_change_reason.h"
#include "third_party/blink/renderer/core/dom/focus_params.h"
#include "third_party/blink/renderer/core/dom/mutation_observer.h"
#include "third_party/blink/renderer/core/dom/mutation_record.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/text.h"
#include "third_party/blink/renderer/core/events/gesture_event.h"
#include "third_party/blink/renderer/core/events/keyboard_event.h"
#include "third_party/blink/renderer/core/events/mouse_event.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/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/html/forms/html_button_element.h"
#include "third_party/blink/renderer/core/html/forms/html_data_list_element.h"
#include "third_party/blink/renderer/core/html/forms/html_form_element.h"
#include "third_party/blink/renderer/core/html/forms/html_opt_group_element.h"
#include "third_party/blink/renderer/core/html/forms/html_select_element.h"
#include "third_party/blink/renderer/core/html/forms/menu_list_inner_element.h"
#include "third_party/blink/renderer/core/html/forms/popup_menu.h"
#include "third_party/blink/renderer/core/html/html_hr_element.h"
#include "third_party/blink/renderer/core/html/html_slot_element.h"
#include "third_party/blink/renderer/core/html/html_span_element.h"
#include "third_party/blink/renderer/core/html/shadow/shadow_element_names.h"
#include "third_party/blink/renderer/core/input/event_handler.h"
#include "third_party/blink/renderer/core/input/input_device_capabilities.h"
#include "third_party/blink/renderer/core/keywords.h"
#include "third_party/blink/renderer/core/layout/layout_box.h"
#include "third_party/blink/renderer/core/page/autoscroll_controller.h"
#include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/spatial_navigation.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/scroll/scroll_alignment.h"
#include "third_party/blink/renderer/core/scroll/scroll_into_view_util.h"
#include "third_party/blink/renderer/platform/text/platform_locale.h"
#include "ui/base/ui_base_features.h"

namespace blink {

class PopupUpdater;

namespace {

HTMLOptionElement* EventTargetOption(const Event& event) {}

bool CanAssignToSelectSlot(const Node& node) {}

bool CanAssignToCustomizableSelectSlot(const Node& node) {}

class PopoverElementForAppearanceAuto : public HTMLDivElement {};

}  // anonymous namespace

// TODO(crbug.com/1511354): Rename this class to PopUpSelectType
class MenuListSelectType final : public SelectType {};

void MenuListSelectType::Trace(Visitor* visitor) const {}

bool MenuListSelectType::DefaultEventHandler(const Event& event) {}

bool MenuListSelectType::ShouldOpenPopupForKeyDownEvent(
    const KeyboardEvent& event) {}

bool MenuListSelectType::ShouldOpenPopupForKeyPressEvent(
    const KeyboardEvent& event) {}

bool MenuListSelectType::HandlePopupOpenKeyboardEvent() {}

void MenuListSelectType::CreateShadowSubtree(ShadowRoot& root) {}

void MenuListSelectType::ManuallyAssignSlots() {}

HTMLButtonElement* MenuListSelectType::SlottedButton() const {}

HTMLButtonElement* MenuListSelectType::DisplayedButton() const {}

HTMLElement* MenuListSelectType::PopoverForAppearanceBase() const {}

bool MenuListSelectType::IsAppearanceBaseSelect() const {}

HTMLSelectElement::SelectAutofillPreviewElement*
MenuListSelectType::GetAutofillPreviewElement() const {}

Element& MenuListSelectType::InnerElementForAppearanceAuto() const {}

void MenuListSelectType::ShowPopup(PopupMenu::ShowEventType type) {}

void MenuListSelectType::HidePopup() {}

void MenuListSelectType::PopupDidHide() {}

bool MenuListSelectType::PopupIsVisible() const {}

void MenuListSelectType::SetNativePopupIsVisible(bool popup_is_visible) {}

PopupMenu* MenuListSelectType::PopupForTesting() const {}

AXObject* MenuListSelectType::PopupRootAXObject() const {}

void MenuListSelectType::ShowPicker() {}

void MenuListSelectType::DidSelectOption(
    HTMLOptionElement* element,
    HTMLSelectElement::SelectOptionFlags flags,
    bool should_update_popup) {}

void MenuListSelectType::DispatchEventsIfSelectedOptionChanged() {}

void MenuListSelectType::DidBlur() {}

void MenuListSelectType::DidSetSuggestedOption(HTMLOptionElement* option) {}

void MenuListSelectType::SaveLastSelection() {}

void MenuListSelectType::DidDetachLayoutTree() {}

void MenuListSelectType::DidRecalcStyle(const StyleRecalcChange change) {}

String MenuListSelectType::UpdateTextStyleInternal() {}

void MenuListSelectType::UpdateTextStyleAndContent() {}

void MenuListSelectType::DidUpdateActiveOption(HTMLOptionElement* option) {}

HTMLOptionElement* MenuListSelectType::OptionToBeShown() const {}

void MenuListSelectType::MaximumOptionWidthMightBeChanged() const {}

// PopupUpdater notifies updates of the specified SELECT element subtree to
// a PopupMenu object.
class PopupUpdater : public MutationObserver::Delegate {};

void MenuListSelectType::ObserveTreeMutation() {}

void MenuListSelectType::UnobserveTreeMutation() {}

void MenuListSelectType::DidMutateSubtree() {}

// ============================================================================

// TODO(crbug.com/1511354): Rename this class to InPageSelectType
class ListBoxSelectType final : public SelectType {};

void ListBoxSelectType::Trace(Visitor* visitor) const {}

bool ListBoxSelectType::DefaultEventHandler(const Event& event) {}

void ListBoxSelectType::DidSelectOption(
    HTMLOptionElement* element,
    HTMLSelectElement::SelectOptionFlags flags,
    bool should_update_popup) {}

void ListBoxSelectType::OptionRemoved(HTMLOptionElement& option) {}

void ListBoxSelectType::DidBlur() {}

void ListBoxSelectType::DidSetSuggestedOption(HTMLOptionElement* option) {}

void ListBoxSelectType::SaveLastSelection() {}

void ListBoxSelectType::UpdateMultiSelectFocus() {}

HTMLOptionElement* ListBoxSelectType::SpatialNavigationFocusedOption() {}

void ListBoxSelectType::SetActiveSelectionAnchor(HTMLOptionElement* option) {}

void ListBoxSelectType::SetActiveSelectionEnd(HTMLOptionElement* option) {}

HTMLOptionElement* ListBoxSelectType::ActiveSelectionEnd() const {}

void ListBoxSelectType::ScrollToSelection() {}

void ListBoxSelectType::ScrollToOption(HTMLOptionElement* option) {}

void ListBoxSelectType::ScrollToOptionTask() {}

void ListBoxSelectType::SelectAll() {}

// Returns the index of the next valid item one page away from |start_option|
// in direction |direction|.
HTMLOptionElement* ListBoxSelectType::NextSelectableOptionPageAway(
    HTMLOptionElement* start_option,
    SkipDirection direction) const {}

void ListBoxSelectType::ToggleSelection(HTMLOptionElement& option) {}

void ListBoxSelectType::UpdateSelectedState(HTMLOptionElement* clicked_option,
                                            SelectionMode mode) {}

void ListBoxSelectType::UpdateListBoxSelection(bool deselect_other_options,
                                               bool scroll) {}

void ListBoxSelectType::SaveListboxActiveSelection() {}

void ListBoxSelectType::HandleMouseRelease() {}

void ListBoxSelectType::ListBoxOnChange() {}

void ListBoxSelectType::ClearLastOnChangeSelection() {}

void ListBoxSelectType::CreateShadowSubtree(ShadowRoot& root) {}

void ListBoxSelectType::ManuallyAssignSlots() {}

HTMLButtonElement* ListBoxSelectType::SlottedButton() const {}

HTMLButtonElement* ListBoxSelectType::DisplayedButton() const {}

HTMLElement* ListBoxSelectType::PopoverForAppearanceBase() const {}

bool ListBoxSelectType::IsAppearanceBaseSelect() const {}

HTMLSelectElement::SelectAutofillPreviewElement*
ListBoxSelectType::GetAutofillPreviewElement() const {}

// ============================================================================

SelectType::SelectType(HTMLSelectElement& select) :{}

SelectType* SelectType::Create(HTMLSelectElement& select) {}

void SelectType::WillBeDestroyed() {}

void SelectType::Trace(Visitor* visitor) const {}

void SelectType::OptionRemoved(HTMLOptionElement& option) {}

void SelectType::DidDetachLayoutTree() {}

void SelectType::DidRecalcStyle(const StyleRecalcChange) {}

void SelectType::UpdateTextStyle() {}

void SelectType::UpdateTextStyleAndContent() {}

HTMLOptionElement* SelectType::OptionToBeShown() const {}

const ComputedStyle* SelectType::OptionStyle() const {}

void SelectType::MaximumOptionWidthMightBeChanged() const {}

HTMLOptionElement* SelectType::SpatialNavigationFocusedOption() {}

HTMLOptionElement* SelectType::ActiveSelectionEnd() const {}

void SelectType::ScrollToSelection() {}

void SelectType::ScrollToOption(HTMLOptionElement* option) {}

void SelectType::SelectAll() {}

void SelectType::SaveListboxActiveSelection() {}

void SelectType::HandleMouseRelease() {}

void SelectType::ListBoxOnChange() {}

void SelectType::ClearLastOnChangeSelection() {}

Element& SelectType::InnerElementForAppearanceAuto() const {}

void SelectType::ShowPicker() {}

void SelectType::ShowPopup(PopupMenu::ShowEventType) {}

void SelectType::HidePopup() {}

void SelectType::PopupDidHide() {}

bool SelectType::PopupIsVisible() const {}

PopupMenu* SelectType::PopupForTesting() const {}

AXObject* SelectType::PopupRootAXObject() const {}

// Returns the 1st valid OPTION |skip| items from |list_index| in direction
// |direction| if there is one.
// Otherwise, it returns the valid OPTION closest to that boundary which is past
// |list_index| if there is one.
// Otherwise, it returns nullptr.
// Valid means that it is enabled and visible.
HTMLOptionElement* SelectType::NextValidOption(int list_index,
                                               SkipDirection direction,
                                               int skip) const {}

HTMLOptionElement* SelectType::NextSelectableOption(
    HTMLOptionElement* start_option) const {}

HTMLOptionElement* SelectType::PreviousSelectableOption(
    HTMLOptionElement* start_option) const {}

HTMLOptionElement* SelectType::FirstSelectableOption() const {}

HTMLOptionElement* SelectType::LastSelectableOption() const {}

}  // namespace blink