bool AccessibilityMenuList::press() const { RenderMenuList* menuList = toRenderMenuList(m_renderer); if (menuList->popupIsVisible()) menuList->hidePopup(); else menuList->showPopup(); return true; }
bool HTMLSelectElement::platformHandleKeydownEvent(KeyboardEvent* event) { // Allow (Shift) F4 and (Ctrl/Shift) Alt/AltGr + Up/Down arrow to pop the menu, matching Firefox. bool eventShowsMenu = (!event->altKey() && !event->ctrlKey() && event->keyIdentifier() == "F4") || ((event->altGraphKey() || event->altKey()) && (event->keyIdentifier() == "Down" || event->keyIdentifier() == "Up")); if (!eventShowsMenu) return false; // Save the selection so it can be compared to the new selection when dispatching change events during setSelectedIndex, // which gets called from RenderMenuList::valueChanged, which gets called after the user makes a selection from the menu. saveLastSelection(); if (RenderMenuList* menuList = toRenderMenuList(renderer())) menuList->showPopup(); int index = selectedIndex(); ASSERT(index >= 0); ASSERT_WITH_SECURITY_IMPLICATION(index < static_cast<int>(listItems().size())); setSelectedIndex(index); event->setDefaultHandled(); return true; }
bool AccessibilityMenuList::isCollapsed() const { return !toRenderMenuList(m_renderer)->popupIsVisible(); }