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

Side by Side Diff: webkit/glue/editor_client_impl.cc

Issue 99216: Workaround fix for Alt-Gr case.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The Mac interface forwards most of these commands to the application layer, 5 // The Mac interface forwards most of these commands to the application layer,
6 // and I'm not really sure what to do about most of them. 6 // and I'm not really sure what to do about most of them.
7 7
8 #include "config.h" 8 #include "config.h"
9 #include "webkit/glue/editor_client_impl.h" 9 #include "webkit/glue/editor_client_impl.h"
10 10
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 606 }
607 607
608 if (command.execute(evt)) { 608 if (command.execute(evt)) {
609 WebViewDelegate* d = web_view_->delegate(); 609 WebViewDelegate* d = web_view_->delegate();
610 MaybeRecordCommand(d, command_name); 610 MaybeRecordCommand(d, command_name);
611 return true; 611 return true;
612 } 612 }
613 613
614 // Here we need to filter key events. 614 // Here we need to filter key events.
615 // On Gtk/Linux, it emits key events with ASCII text and ctrl on for ctrl-<x>. 615 // On Gtk/Linux, it emits key events with ASCII text and ctrl on for ctrl-<x>.
616 // In Webkit, EditorClient::handleKeyboardEvent in 616 // In Webkit, EditorClient::handleKeyboardEvent in
617 // WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp drop such events. 617 // WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp drop such events.
618 // On Mac, it emits key events with ASCII text and meta on for Command-<x>. 618 // On Mac, it emits key events with ASCII text and meta on for Command-<x>.
619 // These key events should not emit text insert event. 619 // These key events should not emit text insert event.
620 // Alt key would be used to insert alternative character, so we should let 620 // Alt key would be used to insert alternative character, so we should let
621 // through. Also note that Ctrl-Alt combination equals to AltGr key which is 621 // through. Also note that Ctrl-Alt combination equals to AltGr key which is
622 // also used to insert alternative character. 622 // also used to insert alternative character.
623 // http://code.google.com/p/chromium/issues/detail?id=10846 623 // http://code.google.com/p/chromium/issues/detail?id=10846
624 // In summary, we can't think of a scenario where you'd use control w/o alt or 624 // Windows sets both alt and meta are on when "Alt" key pressed.
625 // meta to do insertion of a ASCII character. 625 // http://code.google.com/p/chromium/issues/detail?id=2215
626 // Also, we should not rely on an assumption that keyboards don't
627 // send ASCII characters when pressing a control key on Windows,
628 // which may be configured to do it so by user.
629 // See also http://en.wikipedia.org/wiki/Keyboard_Layout
626 // TODO(ukai): investigate more detail for various keyboard layout. 630 // TODO(ukai): investigate more detail for various keyboard layout.
627 if (evt->keyEvent()->text().length() == 1) { 631 if (evt->keyEvent()->text().length() == 1) {
628 UChar ch = evt->keyEvent()->text()[0U]; 632 UChar ch = evt->keyEvent()->text()[0U];
629 633
630 // Don't insert null or control characters as they can result in 634 // Don't insert null or control characters as they can result in
631 // unexpected behaviour 635 // unexpected behaviour
632 if (ch < ' ') 636 if (ch < ' ')
633 return false; 637 return false;
638 #if !defined(OS_WIN)
634 // Don't insert ASCII character if ctrl w/o alt or meta is on. 639 // Don't insert ASCII character if ctrl w/o alt or meta is on.
635 if (ch < 0x80 && 640 // On Mac, we should ignore events when meta is on (Command-<x>).
636 ((evt->keyEvent()->ctrlKey() && !evt->keyEvent()->altKey()) || 641 if (ch < 0x80) {
637 evt->keyEvent()->metaKey())) 642 if (evt->keyEvent()->ctrlKey() && !evt->keyEvent()->altKey())
638 return false; 643 return false;
644 #if defined(OS_MACOSX)
645 if (evt->keyEvent()->metaKey())
646 return false;
647 #endif
648 }
649 #endif
639 } 650 }
640 651
641 if (!frame->editor()->canEdit()) 652 if (!frame->editor()->canEdit())
642 return false; 653 return false;
643 654
644 return frame->editor()->insertText(evt->keyEvent()->text(), evt); 655 return frame->editor()->insertText(evt->keyEvent()->text(), evt);
645 } 656 }
646 657
647 // 658 //
648 // End of code block subject to Apple, Inc. copyright 659 // End of code block subject to Apple, Inc. copyright
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 } 958 }
948 return L"(UNKNOWN AFFINITY)"; 959 return L"(UNKNOWN AFFINITY)";
949 } 960 }
950 961
951 std::wstring EditorClientImpl::Describe(WebCore::CSSStyleDeclaration* style) { 962 std::wstring EditorClientImpl::Describe(WebCore::CSSStyleDeclaration* style) {
952 // TODO(pamg): Implement me. It's not clear what WebKit produces for this 963 // TODO(pamg): Implement me. It's not clear what WebKit produces for this
953 // (their [style description] method), and none of the layout tests provide 964 // (their [style description] method), and none of the layout tests provide
954 // an example. But because none of them use it, it's not yet important. 965 // an example. But because none of them use it, it's not yet important.
955 return std::wstring(); 966 return std::wstring();
956 } 967 }
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