#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 { … };
}
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 { … }
class PopupUpdater : public MutationObserver::Delegate { … };
void MenuListSelectType::ObserveTreeMutation() { … }
void MenuListSelectType::UnobserveTreeMutation() { … }
void MenuListSelectType::DidMutateSubtree() { … }
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() { … }
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 { … }
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 { … }
}