HTMLInputElement* inputElement = toHTMLInputElement(htmlElement);
if (inputElement->form() != element().form())
break;
- if (inputElement->isRadioButton() && inputElement->name() == element().name() && inputElement->isFocusable()) {
+ if (inputElement->type() == InputTypeNames::radio && inputElement->name() == element().name() && inputElement->isFocusable()) {
RefPtrWillBeRawPtr<HTMLInputElement> protector(inputElement);
document.setFocusedElement(inputElement);
inputElement->dispatchSimulatedClick(event, SendNoEvents);
Element* currentFocusedElement = element().document().focusedElement();
if (isHTMLInputElement(currentFocusedElement)) {
HTMLInputElement& focusedInput = toHTMLInputElement(*currentFocusedElement);
- if (focusedInput.isRadioButton() && focusedInput.form() == element().form() && focusedInput.name() == element().name())
+ if (focusedInput.type() == InputTypeNames::radio && focusedInput.form() == element().form() && focusedInput.name() == element().name())
return false;
}
// Restore the original selected radio button if possible.
// Make sure it is still a radio button and only do the restoration if it still belongs to our group.
HTMLInputElement* checkedRadioButton = state.checkedRadioButton.get();
- if (checkedRadioButton
- && checkedRadioButton->isRadioButton()
+ if (!checkedRadioButton)
+ element().setChecked(false);
+ else if (checkedRadioButton->type() == InputTypeNames::radio
&& checkedRadioButton->form() == element().form()
- && checkedRadioButton->name() == element().name()) {
+ && checkedRadioButton->name() == element().name())
checkedRadioButton->setChecked(true);
- }
}
// The work we did in willDispatchClick was default handling.
event->setDefaultHandled();
}
-bool RadioInputType::isRadioButton() const
-{
- return true;
-}
-
-bool RadioInputType::supportsIndeterminateAppearance() const
+bool RadioInputType::shouldAppearIndeterminate() const
{
- return false;
+ return !element().checkedRadioButtonForGroup();
}
} // namespace blink