Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1163)

Unified Diff: Source/core/html/forms/RadioInputType.cpp

Issue 198453003: Use new is*Element() helper functions more in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)) {
+ HTMLInputElement& focusedInput = toHTMLInputElement(*currentFocusedElement);
+ if (focusedInput.isRadioButton() && focusedInput.form() == element().form() && focusedInput.name() == element().name())
return false;
}

Powered by Google App Engine
This is Rietveld 408576698