#include "core/html/forms/RadioInputType.h"
#include "HTMLNames.h"
-#include "core/dom/NodeTraversal.h"
+#include "InputTypeNames.h"
+#include "core/dom/ElementTraversal.h"
#include "core/events/KeyboardEvent.h"
#include "core/events/MouseEvent.h"
#include "core/html/HTMLInputElement.h"
-#include "core/html/forms/InputTypeNames.h"
#include "core/page/SpatialNavigation.h"
#include "platform/text/PlatformLocale.h"
#include "wtf/PassOwnPtr.h"
using namespace HTMLNames;
-PassRefPtr<InputType> RadioInputType::create(HTMLInputElement& element)
+PassRefPtrWillBeRawPtr<InputType> RadioInputType::create(HTMLInputElement& element)
{
- return adoptRef(new RadioInputType(element));
+ return adoptRefWillBeNoop(new RadioInputType(element));
}
const AtomicString& RadioInputType::formControlType() const
{
- return InputTypeNames::radio();
+ return InputTypeNames::radio;
}
bool RadioInputType::valueMissing(const String&) const
String RadioInputType::valueMissingText() const
{
- return locale().queryString(WebKit::WebLocalizedString::ValidationValueMissingForRadio);
+ return locale().queryString(blink::WebLocalizedString::ValidationValueMissingForRadio);
}
void RadioInputType::handleClickEvent(MouseEvent* event)
// We can only stay within the form's children if the form hasn't been demoted to a leaf because
// of malformed HTML.
- Node* node = &element();
- while ((node = (forward ? NodeTraversal::next(node) : NodeTraversal::previous(node)))) {
+ HTMLElement* htmlElement = &element();
+ while ((htmlElement = (forward ? Traversal<HTMLElement>::next(*htmlElement) : Traversal<HTMLElement>::previous(*htmlElement)))) {
// Once we encounter a form element, we know we're through.
- if (node->hasTagName(formTag))
+ if (isHTMLFormElement(*htmlElement))
break;
// Look for more radio buttons.
- if (!node->hasTagName(inputTag))
+ if (!isHTMLInputElement(*htmlElement))
continue;
- HTMLInputElement* inputElement = toHTMLInputElement(node);
+ HTMLInputElement* inputElement = toHTMLInputElement(htmlElement);
if (inputElement->form() != element().form())
break;
if (inputElement->isRadioButton() && inputElement->name() == element().name() && inputElement->isFocusable()) {
RefPtr<HTMLInputElement> protector(inputElement);
document.setFocusedElement(inputElement);
- inputElement->dispatchSimulatedClick(event, SendNoEvents, DoNotShowPressedLook);
+ inputElement->dispatchSimulatedClick(event, SendNoEvents);
event->setDefaultHandled();
return;
}
// Never allow keyboard tabbing to leave you in the same radio group. Always
// skip any other elements in the group.
Element* currentFocusedElement = element().document().focusedElement();
- if (currentFocusedElement && currentFocusedElement->hasTagName(inputTag)) {
- HTMLInputElement* focusedInput = toHTMLInputElement(currentFocusedElement);
- if (focusedInput->isRadioButton() && focusedInput->form() == element().form() && focusedInput->name() == element().name())
+ if (isHTMLInputElement(currentFocusedElement)) {
+ HTMLInputElement& focusedInput = toHTMLInputElement(*currentFocusedElement);
+ if (focusedInput.isRadioButton() && focusedInput.form() == element().form() && focusedInput.name() == element().name())
return false;
}