OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // changing the selection. | 105 // changing the selection. |
106 Document& document = element().document(); | 106 Document& document = element().document(); |
107 if (isSpatialNavigationEnabled(document.frame())) | 107 if (isSpatialNavigationEnabled(document.frame())) |
108 return; | 108 return; |
109 bool forward = computedTextDirection() == TextDirection::kRtl | 109 bool forward = computedTextDirection() == TextDirection::kRtl |
110 ? (key == "ArrowDown" || key == "ArrowLeft") | 110 ? (key == "ArrowDown" || key == "ArrowLeft") |
111 : (key == "ArrowDown" || key == "ArrowRight"); | 111 : (key == "ArrowDown" || key == "ArrowRight"); |
112 | 112 |
113 // We can only stay within the form's children if the form hasn't been demoted | 113 // We can only stay within the form's children if the form hasn't been demoted |
114 // to a leaf because of malformed HTML. | 114 // to a leaf because of malformed HTML. |
115 HTMLInputElement* inputElement = findNextFocusableRadioButtonInGroup( | 115 HTMLInputElement* inputElement = |
116 toHTMLInputElement(&element()), forward); | 116 findNextFocusableRadioButtonInGroup(&element(), forward); |
117 if (!inputElement) { | 117 if (!inputElement) { |
118 // Traverse in reverse direction till last or first radio button | 118 // Traverse in reverse direction till last or first radio button |
119 forward = !(forward); | 119 forward = !(forward); |
120 HTMLInputElement* nextInputElement = findNextFocusableRadioButtonInGroup( | 120 HTMLInputElement* nextInputElement = |
121 toHTMLInputElement(&element()), forward); | 121 findNextFocusableRadioButtonInGroup(&element(), forward); |
122 while (nextInputElement) { | 122 while (nextInputElement) { |
123 inputElement = nextInputElement; | 123 inputElement = nextInputElement; |
124 nextInputElement = | 124 nextInputElement = |
125 findNextFocusableRadioButtonInGroup(nextInputElement, forward); | 125 findNextFocusableRadioButtonInGroup(nextInputElement, forward); |
126 } | 126 } |
127 } | 127 } |
128 if (inputElement) { | 128 if (inputElement) { |
129 document.setFocusedElement(inputElement, | 129 document.setFocusedElement(inputElement, |
130 FocusParams(SelectionBehaviorOnFocus::Restore, | 130 FocusParams(SelectionBehaviorOnFocus::Restore, |
131 WebFocusTypeNone, nullptr)); | 131 WebFocusTypeNone, nullptr)); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 *inputElement, current->form(), forward)) { | 234 *inputElement, current->form(), forward)) { |
235 if (current->form() == inputElement->form() && | 235 if (current->form() == inputElement->form() && |
236 inputElement->type() == InputTypeNames::radio && | 236 inputElement->type() == InputTypeNames::radio && |
237 inputElement->name() == current->name()) | 237 inputElement->name() == current->name()) |
238 return inputElement; | 238 return inputElement; |
239 } | 239 } |
240 return nullptr; | 240 return nullptr; |
241 } | 241 } |
242 | 242 |
243 } // namespace blink | 243 } // namespace blink |
OLD | NEW |