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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 // Left and up mean "previous radio button". | 100 // Left and up mean "previous radio button". |
101 // Right and down mean "next radio button". | 101 // Right and down mean "next radio button". |
102 // Tested in WinIE, and even for RTL, left still means previous radio button | 102 // Tested in WinIE, and even for RTL, left still means previous radio button |
103 // (and so moves to the right). Seems strange, but we'll match it. However, | 103 // (and so moves to the right). Seems strange, but we'll match it. However, |
104 // when using Spatial Navigation, we need to be able to navigate without | 104 // when using Spatial Navigation, we need to be able to navigate without |
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() == RTL | 109 bool forward = computedTextDirection() == TextDirection::Rtl |
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 = findNextFocusableRadioButtonInGroup( |
116 toHTMLInputElement(&element()), forward); | 116 toHTMLInputElement(&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); |
(...skipping 114 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 |