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

Side by Side Diff: sky/engine/web/WebViewImpl.cpp

Issue 709603006: Remove a bunch of OS(MACOSX) code (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Even more Created 6 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 switch (event.type) { 741 switch (event.type) {
742 case WebInputEvent::Char: 742 case WebInputEvent::Char:
743 if (event.windowsKeyCode == VKEY_SPACE) { 743 if (event.windowsKeyCode == VKEY_SPACE) {
744 int keyCode = ((event.modifiers & WebInputEvent::ShiftKey) ? VKEY_PR IOR : VKEY_NEXT); 744 int keyCode = ((event.modifiers & WebInputEvent::ShiftKey) ? VKEY_PR IOR : VKEY_NEXT);
745 return scrollViewWithKeyboard(keyCode, event.modifiers); 745 return scrollViewWithKeyboard(keyCode, event.modifiers);
746 } 746 }
747 break; 747 break;
748 case WebInputEvent::RawKeyDown: 748 case WebInputEvent::RawKeyDown:
749 if (event.modifiers == WebInputEvent::ControlKey) { 749 if (event.modifiers == WebInputEvent::ControlKey) {
750 switch (event.windowsKeyCode) { 750 switch (event.windowsKeyCode) {
751 #if !OS(MACOSX)
752 case 'A':
753 focusedFrame()->executeCommand(WebString::fromUTF8("SelectAll")) ;
754 return true;
755 case VKEY_INSERT:
756 case 'C':
757 focusedFrame()->executeCommand(WebString::fromUTF8("Copy"));
758 return true;
759 #endif
760 // Match FF behavior in the sense that Ctrl+home/end are the only Ct rl 751 // Match FF behavior in the sense that Ctrl+home/end are the only Ct rl
761 // key combinations which affect scrolling. Safari is buggy in the 752 // key combinations which affect scrolling. Safari is buggy in the
762 // sense that it scrolls the page for all Ctrl+scrolling key 753 // sense that it scrolls the page for all Ctrl+scrolling key
763 // combinations. For e.g. Ctrl+pgup/pgdn/up/down, etc. 754 // combinations. For e.g. Ctrl+pgup/pgdn/up/down, etc.
764 case VKEY_HOME: 755 case VKEY_HOME:
765 case VKEY_END: 756 case VKEY_END:
766 break; 757 break;
767 default: 758 default:
768 return false; 759 return false;
769 } 760 }
770 } 761 }
771 if (!event.isSystemKey && !(event.modifiers & WebInputEvent::ShiftKey)) 762 if (!event.isSystemKey && !(event.modifiers & WebInputEvent::ShiftKey))
772 return scrollViewWithKeyboard(event.windowsKeyCode, event.modifiers) ; 763 return scrollViewWithKeyboard(event.windowsKeyCode, event.modifiers) ;
773 break; 764 break;
774 default: 765 default:
775 break; 766 break;
776 } 767 }
777 return false; 768 return false;
778 } 769 }
779 770
780 bool WebViewImpl::scrollViewWithKeyboard(int keyCode, int modifiers) 771 bool WebViewImpl::scrollViewWithKeyboard(int keyCode, int modifiers)
781 { 772 {
782 ScrollDirection scrollDirection; 773 ScrollDirection scrollDirection;
783 ScrollGranularity scrollGranularity; 774 ScrollGranularity scrollGranularity;
784 #if OS(MACOSX)
785 // Control-Up/Down should be PageUp/Down on Mac.
786 if (modifiers & WebMouseEvent::ControlKey) {
787 if (keyCode == VKEY_UP)
788 keyCode = VKEY_PRIOR;
789 else if (keyCode == VKEY_DOWN)
790 keyCode = VKEY_NEXT;
791 }
792 #endif
793 if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) 775 if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity))
794 return false; 776 return false;
795 777
796 if (LocalFrame* frame = focusedCoreFrame()) 778 if (LocalFrame* frame = focusedCoreFrame())
797 return frame->eventHandler().bubblingScroll(scrollDirection, scrollGranu larity); 779 return frame->eventHandler().bubblingScroll(scrollDirection, scrollGranu larity);
798 return false; 780 return false;
799 } 781 }
800 782
801 bool WebViewImpl::mapKeyCodeForScroll( 783 bool WebViewImpl::mapKeyCodeForScroll(
802 int keyCode, 784 int keyCode,
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 m_layerTreeView->setVisible(visible); 2252 m_layerTreeView->setVisible(visible);
2271 } 2253 }
2272 } 2254 }
2273 2255
2274 bool WebViewImpl::shouldDisableDesktopWorkarounds() 2256 bool WebViewImpl::shouldDisableDesktopWorkarounds()
2275 { 2257 {
2276 return true; 2258 return true;
2277 } 2259 }
2278 2260
2279 } // namespace blink 2261 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698