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

Side by Side Diff: webkit/api/src/gtk/WebInputEventFactory.cpp

Issue 164139: A quick fix for Issue 18708.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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) 2006-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006-2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 // The key code tells us which physical key was pressed (for example, the 202 // The key code tells us which physical key was pressed (for example, the
203 // A key went down or up). It does not determine whether A should be lower 203 // A key went down or up). It does not determine whether A should be lower
204 // or upper case. This is what text does, which should be the keyval. 204 // or upper case. This is what text does, which should be the keyval.
205 result.windowsKeyCode = gdkEventToWindowsKeyCode(event); 205 result.windowsKeyCode = gdkEventToWindowsKeyCode(event);
206 result.nativeKeyCode = event->hardware_keycode; 206 result.nativeKeyCode = event->hardware_keycode;
207 207
208 switch (event->keyval) { 208 switch (event->keyval) {
209 // We need to treat the enter key as a key press of character \r. This 209 // We need to treat the enter key as a key press of character \r. This
210 // is apparently just how webkit handles it and what it expects. 210 // is apparently just how webkit handles it and what it expects.
211 // On the other hand, IE and Firefox treat the control+enter keys as a key
212 // press of character '\n'. We also emulate this behavior since Google
213 // Docs and Spreadsheets depend on it.
211 case GDK_ISO_Enter: 214 case GDK_ISO_Enter:
212 case GDK_KP_Enter: 215 case GDK_KP_Enter:
213 case GDK_Return: 216 case GDK_Return:
214 result.unmodifiedText[0] = result.text[0] = static_cast<WebUChar>('\r'); 217 result.unmodifiedText[0] = result.text[0] =
218 static_cast<WebUChar>((event->state & GDK_CONTROL_MASK) ? '\n' : '\r');
215 break; 219 break;
216 default: 220 default:
217 // This should set text to 0 when it's not a real character. 221 // This should set text to 0 when it's not a real character.
218 // FIXME: fix for non BMP chars 222 // FIXME: fix for non BMP chars
219 // TODO(james.su@gmail.com): 223 // TODO(james.su@gmail.com):
220 // Support control characters input like Windows. 224 // Support control characters input like Windows.
221 // See: http://en.wikipedia.org/wiki/Control_characters 225 // See: http://en.wikipedia.org/wiki/Control_characters
222 result.unmodifiedText[0] = result.text[0] = 226 result.unmodifiedText[0] = result.text[0] =
223 static_cast<WebUChar>(gdk_keyval_to_unicode(event->keyval)); 227 static_cast<WebUChar>(gdk_keyval_to_unicode(event->keyval));
224 } 228 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 case GDK_SCROLL_RIGHT: 387 case GDK_SCROLL_RIGHT:
384 result.deltaX = -scrollbarPixelsPerTick; 388 result.deltaX = -scrollbarPixelsPerTick;
385 result.wheelTicksX = 1; 389 result.wheelTicksX = 1;
386 break; 390 break;
387 } 391 }
388 392
389 return result; 393 return result;
390 } 394 }
391 395
392 } // namespace WebKit 396 } // namespace WebKit
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698