void AccessibilityListBox::setSelectedChildren(AccessibilityChildrenVector& children) { if (!canSetSelectedChildrenAttribute()) return; Node* selectNode = m_renderer->node(); if (!selectNode) return; // disable any selected options unsigned length = m_children.size(); for (unsigned i = 0; i < length; i++) { AccessibilityListBoxOption* listBoxOption = static_cast<AccessibilityListBoxOption*>(m_children[i].get()); if (listBoxOption->isSelected()) listBoxOption->setSelected(false); } length = children.size(); for (unsigned i = 0; i < length; i++) { AccessibilityObject* obj = children[i].get(); if (obj->roleValue() != ListBoxOptionRole) continue; static_cast<AccessibilityListBoxOption*>(obj)->setSelected(true); } }
void AccessibilityListBox::setSelectedChildren(const AccessibilityChildrenVector& children) { if (!canSetSelectedChildrenAttribute()) return; Node* selectNode = m_renderer->node(); if (!selectNode) return; // disable any selected options for (const auto& child : m_children) { AccessibilityListBoxOption* listBoxOption = toAccessibilityListBoxOption(child.get()); if (listBoxOption->isSelected()) listBoxOption->setSelected(false); } for (const auto& obj : children) { if (obj->roleValue() != ListBoxOptionRole) continue; toAccessibilityListBoxOption(obj.get())->setSelected(true); } }