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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 14107015: Rename OS(DARWIN) to OS(MACOSX). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 3 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 | « Source/web/WebPluginContainerImpl.cpp ('k') | Source/web/tests/ChromeClientImplTest.cpp » ('j') | 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) 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 546 }
547 547
548 if (m_pagePopup && pagePopup && m_pagePopup->hasSamePopupClient(pagePopup.ge t())) { 548 if (m_pagePopup && pagePopup && m_pagePopup->hasSamePopupClient(pagePopup.ge t())) {
549 // That click triggered a page popup that is the same as the one we just closed. 549 // That click triggered a page popup that is the same as the one we just closed.
550 // It needs to be closed. 550 // It needs to be closed.
551 closePagePopup(m_pagePopup.get()); 551 closePagePopup(m_pagePopup.get());
552 } 552 }
553 553
554 // Dispatch the contextmenu event regardless of if the click was swallowed. 554 // Dispatch the contextmenu event regardless of if the click was swallowed.
555 // On Windows, we handle it on mouse up, not down. 555 // On Windows, we handle it on mouse up, not down.
556 #if OS(DARWIN) 556 #if OS(MACOSX)
557 if (event.button == WebMouseEvent::ButtonRight 557 if (event.button == WebMouseEvent::ButtonRight
558 || (event.button == WebMouseEvent::ButtonLeft 558 || (event.button == WebMouseEvent::ButtonLeft
559 && event.modifiers & WebMouseEvent::ControlKey)) 559 && event.modifiers & WebMouseEvent::ControlKey))
560 mouseContextMenu(event); 560 mouseContextMenu(event);
561 #elif OS(UNIX) 561 #elif OS(UNIX)
562 if (event.button == WebMouseEvent::ButtonRight) 562 if (event.button == WebMouseEvent::ButtonRight)
563 mouseContextMenu(event); 563 mouseContextMenu(event);
564 #endif 564 #endif
565 } 565 }
566 566
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 return true; 926 return true;
927 927
928 RefPtr<Frame> frame = focusedWebCoreFrame(); 928 RefPtr<Frame> frame = focusedWebCoreFrame();
929 if (!frame) 929 if (!frame)
930 return false; 930 return false;
931 931
932 EventHandler* handler = frame->eventHandler(); 932 EventHandler* handler = frame->eventHandler();
933 if (!handler) 933 if (!handler)
934 return keyEventDefault(event); 934 return keyEventDefault(event);
935 935
936 #if !OS(DARWIN) 936 #if !OS(MACOSX)
937 const WebInputEvent::Type contextMenuTriggeringEventType = 937 const WebInputEvent::Type contextMenuTriggeringEventType =
938 #if OS(WINDOWS) 938 #if OS(WINDOWS)
939 WebInputEvent::KeyUp; 939 WebInputEvent::KeyUp;
940 #elif OS(UNIX) 940 #elif OS(UNIX)
941 WebInputEvent::RawKeyDown; 941 WebInputEvent::RawKeyDown;
942 #endif 942 #endif
943 943
944 bool isUnmodifiedMenuKey = !(event.modifiers & WebInputEvent::InputModifiers ) && event.windowsKeyCode == VKEY_APPS; 944 bool isUnmodifiedMenuKey = !(event.modifiers & WebInputEvent::InputModifiers ) && event.windowsKeyCode == VKEY_APPS;
945 bool isShiftF10 = event.modifiers == WebInputEvent::ShiftKey && event.window sKeyCode == VKEY_F10; 945 bool isShiftF10 = event.modifiers == WebInputEvent::ShiftKey && event.window sKeyCode == VKEY_F10;
946 if ((isUnmodifiedMenuKey || isShiftF10) && event.type == contextMenuTriggeri ngEventType) { 946 if ((isUnmodifiedMenuKey || isShiftF10) && event.type == contextMenuTriggeri ngEventType) {
947 sendContextMenuEvent(event); 947 sendContextMenuEvent(event);
948 return true; 948 return true;
949 } 949 }
950 #endif // !OS(DARWIN) 950 #endif // !OS(MACOSX)
951 951
952 PlatformKeyboardEventBuilder evt(event); 952 PlatformKeyboardEventBuilder evt(event);
953 953
954 if (handler->keyEvent(evt)) { 954 if (handler->keyEvent(evt)) {
955 if (WebInputEvent::RawKeyDown == event.type) { 955 if (WebInputEvent::RawKeyDown == event.type) {
956 // Suppress the next keypress event unless the focused node is a plu g-in node. 956 // Suppress the next keypress event unless the focused node is a plu g-in node.
957 // (Flash needs these keypress events to handle non-US keyboards.) 957 // (Flash needs these keypress events to handle non-US keyboards.)
958 Element* element = focusedElement(); 958 Element* element = focusedElement();
959 if (!element || !element->renderer() || !element->renderer()->isEmbe ddedObject()) 959 if (!element || !element->renderer() || !element->renderer()->isEmbe ddedObject())
960 m_suppressNextKeypressEvent = true; 960 m_suppressNextKeypressEvent = true;
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 if (m_client) 1334 if (m_client)
1335 m_client->hasTouchEventHandlers(hasTouchHandlers); 1335 m_client->hasTouchEventHandlers(hasTouchHandlers);
1336 } 1336 }
1337 1337
1338 bool WebViewImpl::hasTouchEventHandlersAt(const WebPoint& point) 1338 bool WebViewImpl::hasTouchEventHandlersAt(const WebPoint& point)
1339 { 1339 {
1340 // FIXME: Implement this. Note that the point must be divided by pageScaleFa ctor. 1340 // FIXME: Implement this. Note that the point must be divided by pageScaleFa ctor.
1341 return true; 1341 return true;
1342 } 1342 }
1343 1343
1344 #if !OS(DARWIN) 1344 #if !OS(MACOSX)
1345 // Mac has no way to open a context menu based on a keyboard event. 1345 // Mac has no way to open a context menu based on a keyboard event.
1346 bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) 1346 bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event)
1347 { 1347 {
1348 // The contextMenuController() holds onto the last context menu that was 1348 // The contextMenuController() holds onto the last context menu that was
1349 // popped up on the page until a new one is created. We need to clear 1349 // popped up on the page until a new one is created. We need to clear
1350 // this menu before propagating the event through the DOM so that we can 1350 // this menu before propagating the event through the DOM so that we can
1351 // detect if we create a new menu for this event, since we won't create 1351 // detect if we create a new menu for this event, since we won't create
1352 // a new menu if the DOM swallows the event and the defaultEventHandler does 1352 // a new menu if the DOM swallows the event and the defaultEventHandler does
1353 // not run. 1353 // not run.
1354 page()->contextMenuController().clearContextMenu(); 1354 page()->contextMenuController().clearContextMenu();
(...skipping 15 matching lines...) Expand all
1370 switch (event.type) { 1370 switch (event.type) {
1371 case WebInputEvent::Char: 1371 case WebInputEvent::Char:
1372 if (event.windowsKeyCode == VKEY_SPACE) { 1372 if (event.windowsKeyCode == VKEY_SPACE) {
1373 int keyCode = ((event.modifiers & WebInputEvent::ShiftKey) ? VKEY_PR IOR : VKEY_NEXT); 1373 int keyCode = ((event.modifiers & WebInputEvent::ShiftKey) ? VKEY_PR IOR : VKEY_NEXT);
1374 return scrollViewWithKeyboard(keyCode, event.modifiers); 1374 return scrollViewWithKeyboard(keyCode, event.modifiers);
1375 } 1375 }
1376 break; 1376 break;
1377 case WebInputEvent::RawKeyDown: 1377 case WebInputEvent::RawKeyDown:
1378 if (event.modifiers == WebInputEvent::ControlKey) { 1378 if (event.modifiers == WebInputEvent::ControlKey) {
1379 switch (event.windowsKeyCode) { 1379 switch (event.windowsKeyCode) {
1380 #if !OS(DARWIN) 1380 #if !OS(MACOSX)
1381 case 'A': 1381 case 'A':
1382 focusedFrame()->executeCommand(WebString::fromUTF8("SelectAll")) ; 1382 focusedFrame()->executeCommand(WebString::fromUTF8("SelectAll")) ;
1383 return true; 1383 return true;
1384 case VKEY_INSERT: 1384 case VKEY_INSERT:
1385 case 'C': 1385 case 'C':
1386 focusedFrame()->executeCommand(WebString::fromUTF8("Copy")); 1386 focusedFrame()->executeCommand(WebString::fromUTF8("Copy"));
1387 return true; 1387 return true;
1388 #endif 1388 #endif
1389 // Match FF behavior in the sense that Ctrl+home/end are the only Ct rl 1389 // Match FF behavior in the sense that Ctrl+home/end are the only Ct rl
1390 // key combinations which affect scrolling. Safari is buggy in the 1390 // key combinations which affect scrolling. Safari is buggy in the
(...skipping 12 matching lines...) Expand all
1403 default: 1403 default:
1404 break; 1404 break;
1405 } 1405 }
1406 return false; 1406 return false;
1407 } 1407 }
1408 1408
1409 bool WebViewImpl::scrollViewWithKeyboard(int keyCode, int modifiers) 1409 bool WebViewImpl::scrollViewWithKeyboard(int keyCode, int modifiers)
1410 { 1410 {
1411 ScrollDirection scrollDirection; 1411 ScrollDirection scrollDirection;
1412 ScrollGranularity scrollGranularity; 1412 ScrollGranularity scrollGranularity;
1413 #if OS(DARWIN) 1413 #if OS(MACOSX)
1414 // Control-Up/Down should be PageUp/Down on Mac. 1414 // Control-Up/Down should be PageUp/Down on Mac.
1415 if (modifiers & WebMouseEvent::ControlKey) { 1415 if (modifiers & WebMouseEvent::ControlKey) {
1416 if (keyCode == VKEY_UP) 1416 if (keyCode == VKEY_UP)
1417 keyCode = VKEY_PRIOR; 1417 keyCode = VKEY_PRIOR;
1418 else if (keyCode == VKEY_DOWN) 1418 else if (keyCode == VKEY_DOWN)
1419 keyCode = VKEY_NEXT; 1419 keyCode = VKEY_NEXT;
1420 } 1420 }
1421 #endif 1421 #endif
1422 if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity)) 1422 if (!mapKeyCodeForScroll(keyCode, &scrollDirection, &scrollGranularity))
1423 return false; 1423 return false;
(...skipping 2690 matching lines...) Expand 10 before | Expand all | Expand 10 after
4114 // the initial viewport width. 4114 // the initial viewport width.
4115 // 2. The author has disabled viewport zoom. 4115 // 2. The author has disabled viewport zoom.
4116 4116
4117 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4117 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4118 4118
4119 return fixedLayoutSize().width == m_size.width 4119 return fixedLayoutSize().width == m_size.width
4120 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4120 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4121 } 4121 }
4122 4122
4123 } // namespace WebKit 4123 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/web/WebPluginContainerImpl.cpp ('k') | Source/web/tests/ChromeClientImplTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698