Chromium Code Reviews| Index: Source/core/html/forms/RadioInputType.cpp |
| diff --git a/Source/core/html/forms/RadioInputType.cpp b/Source/core/html/forms/RadioInputType.cpp |
| index fc6da4939fac96c1ec9d81843fa8493622c4ce5f..7a90d2fad679dac692fdd4db8b4f66e48e19cef3 100644 |
| --- a/Source/core/html/forms/RadioInputType.cpp |
| +++ b/Source/core/html/forms/RadioInputType.cpp |
| @@ -24,7 +24,7 @@ |
| #include "HTMLNames.h" |
| #include "InputTypeNames.h" |
| -#include "core/dom/NodeTraversal.h" |
| +#include "core/dom/ElementTraversal.h" |
| #include "core/events/KeyboardEvent.h" |
| #include "core/events/MouseEvent.h" |
| #include "core/html/HTMLInputElement.h" |
| @@ -83,15 +83,15 @@ void RadioInputType::handleKeydownEvent(KeyboardEvent* 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()) { |
| @@ -128,9 +128,9 @@ bool RadioInputType::isKeyboardFocusable() const |
| // 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)) { |
|
philipj_slow
2014/03/13 02:49:56
isHTMLInputElement(0) returns false, I guess? I tr
|
| + HTMLInputElement& focusedInput = toHTMLInputElement(*currentFocusedElement); |
| + if (focusedInput.isRadioButton() && focusedInput.form() == element().form() && focusedInput.name() == element().name()) |
| return false; |
| } |