Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / html / forms / RadioInputType.cpp
index 4e992f6..34d3df0 100644 (file)
@@ -103,7 +103,7 @@ void RadioInputType::handleKeydownEvent(KeyboardEvent* event)
         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);
@@ -139,7 +139,7 @@ bool RadioInputType::isKeyboardFocusable() const
     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;
     }
 
@@ -178,26 +178,21 @@ void RadioInputType::didDispatchClick(Event* event, const ClickHandlingState& st
         // 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