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

Side by Side Diff: third_party/WebKit/Source/core/html/forms/RadioInputType.cpp

Issue 1633553002: Change in focus with movement of Arrow keys for RTL radio buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the use of non-ASCII characters. Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/radio/radio-group-keyboard-change-event-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 // Left and up mean "previous radio button". 95 // Left and up mean "previous radio button".
96 // Right and down mean "next radio button". 96 // Right and down mean "next radio button".
97 // Tested in WinIE, and even for RTL, left still means previous radio button 97 // Tested in WinIE, and even for RTL, left still means previous radio button
98 // (and so moves to the right). Seems strange, but we'll match it. However, 98 // (and so moves to the right). Seems strange, but we'll match it. However,
99 // when using Spatial Navigation, we need to be able to navigate without 99 // when using Spatial Navigation, we need to be able to navigate without
100 // changing the selection. 100 // changing the selection.
101 Document& document = element().document(); 101 Document& document = element().document();
102 if (isSpatialNavigationEnabled(document.frame())) 102 if (isSpatialNavigationEnabled(document.frame()))
103 return; 103 return;
104 bool forward = (key == "Down" || key == "Right"); 104 bool forward = computedTextDirection() == RTL ? (key == "Down" || key == "Le ft") : (key == "Down" || key == "Right");
105 105
106 // We can only stay within the form's children if the form hasn't been demot ed to a leaf because 106 // We can only stay within the form's children if the form hasn't been demot ed to a leaf because
107 // of malformed HTML. 107 // of malformed HTML.
108 HTMLInputElement* inputElement = findNextFocusableRadioButtonInGroup(toHTMLI nputElement(&element()), forward); 108 HTMLInputElement* inputElement = findNextFocusableRadioButtonInGroup(toHTMLI nputElement(&element()), forward);
109 if (!inputElement) { 109 if (!inputElement) {
110 // Traverse in reverse direction till last or first radio button 110 // Traverse in reverse direction till last or first radio button
111 forward = !(forward); 111 forward = !(forward);
112 HTMLInputElement* nextInputElement = findNextFocusableRadioButtonInGroup (toHTMLInputElement(&element()), forward); 112 HTMLInputElement* nextInputElement = findNextFocusableRadioButtonInGroup (toHTMLInputElement(&element()), forward);
113 while (nextInputElement) { 113 while (nextInputElement) {
114 inputElement = nextInputElement; 114 inputElement = nextInputElement;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // The work we did in willDispatchClick was default handling. 202 // The work we did in willDispatchClick was default handling.
203 event->setDefaultHandled(); 203 event->setDefaultHandled();
204 } 204 }
205 205
206 bool RadioInputType::shouldAppearIndeterminate() const 206 bool RadioInputType::shouldAppearIndeterminate() const
207 { 207 {
208 return !element().checkedRadioButtonForGroup(); 208 return !element().checkedRadioButtonForGroup();
209 } 209 }
210 210
211 } // namespace blink 211 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/radio/radio-group-keyboard-change-event-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698