Changeset 191412 in webkit
- Timestamp:
- Oct 21, 2015 4:14:31 PM (9 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r191409 r191412 1 2015-10-21 Anders Carlsson <andersca@apple.com> 2 3 Move services menu handling out into a separate function 4 https://bugs.webkit.org/show_bug.cgi?id=150420 5 6 Reviewed by Tim Horton. 7 8 * UIProcess/mac/WebContextMenuProxyMac.h: 9 * UIProcess/mac/WebContextMenuProxyMac.mm: 10 (WebKit::WebContextMenuProxyMac::showServicesMenu): 11 (WebKit::WebContextMenuProxyMac::show): 12 (WebKit::WebContextMenuProxyMac::showContextMenu): 13 (WebKit::WebContextMenuProxyMac::populate): Deleted. 14 1 15 2015-10-21 Wenson Hsieh <wenson_hsieh@apple.com> 2 16 -
trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.h
r191407 r191412 60 60 virtual void show() override; 61 61 62 void populate(const Vector<RefPtr<WebContextMenuItem>>&);62 void showContextMenu(); 63 63 64 64 #if ENABLE(SERVICE_CONTROLS) 65 void showServicesMenu(); 65 66 void setupServicesMenu(); 66 67 WebCore::ContextMenuItem shareMenuItem(); -
trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
r191407 r191412 319 319 } 320 320 321 void WebContextMenuProxyMac::showServicesMenu() 322 { 323 setupServicesMenu(); 324 325 [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setMenuProxy:this]; 326 [m_menu popUpMenuPositioningItem:nil atLocation:m_context.menuLocation() inView:m_webView]; 327 } 328 321 329 void WebContextMenuProxyMac::clearServicesMenu() 322 330 { … … 361 369 #endif 362 370 363 void WebContextMenuProxyMac::populate(const Vector<RefPtr<WebContextMenuItem>>& items) 364 { 371 void WebContextMenuProxyMac::show() 372 { 373 Ref<WebPageProxy> protect(m_page); 374 365 375 #if ENABLE(SERVICE_CONTROLS) 366 376 if (m_context.isServicesMenu()) { 367 s etupServicesMenu();377 showServicesMenu(); 368 378 return; 369 379 } 370 380 #endif 371 381 372 m_menu = [[NSMenu alloc] initWithTitle:@""]; 373 [m_menu setAutoenablesItems:NO]; 374 375 populateNSMenu(m_menu.get(), nsMenuItemVector(items)); 376 } 377 378 void WebContextMenuProxyMac::show() 379 { 380 // Unless this is an image control, give the PageContextMenuClient one last swipe at changing the menu. 381 bool askClientToChangeMenu = true; 382 #if ENABLE(SERVICE_CONTROLS) 383 if (m_context.isServicesMenu() || m_context.controlledImage()) 384 askClientToChangeMenu = false; 385 #endif 386 382 showContextMenu(); 383 } 384 385 void WebContextMenuProxyMac::showContextMenu() 386 { 387 387 Vector<RefPtr<WebContextMenuItem>> proposedAPIItems; 388 388 for (auto& item : m_context.menuItems()) { … … 402 402 bool useProposedItems = true; 403 403 404 if ( askClientToChangeMenu &&m_page.contextMenuClient().getContextMenuFromProposedMenu(m_page, proposedAPIItems, clientItems, m_context.webHitTestResultData(), m_page.process().transformHandlesToObjects(m_userData.object()).get()))404 if (m_page.contextMenuClient().getContextMenuFromProposedMenu(m_page, proposedAPIItems, clientItems, m_context.webHitTestResultData(), m_page.process().transformHandlesToObjects(m_userData.object()).get())) 405 405 useProposedItems = false; 406 406 407 407 const Vector<RefPtr<WebContextMenuItem>>& items = useProposedItems ? proposedAPIItems : clientItems; 408 408 409 #if ENABLE(SERVICE_CONTROLS)410 if (items.isEmpty() && !m_context.isServicesMenu())411 return;412 #else413 409 if (items.isEmpty()) 414 410 return; 415 #endif 416 417 populate(items); 411 412 m_menu = [[NSMenu alloc] initWithTitle:@""]; 413 [m_menu setAutoenablesItems:NO]; 414 415 populateNSMenu(m_menu.get(), nsMenuItemVector(items)); 418 416 419 417 [[WKMenuTarget sharedMenuTarget] setMenuProxy:this]; 420 421 #if ENABLE(SERVICE_CONTROLS)422 if (m_context.isServicesMenu())423 [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setMenuProxy:this];424 #endif425 426 Ref<WebPageProxy> protect(m_page);427 428 418 [m_menu popUpMenuPositioningItem:nil atLocation:m_context.menuLocation() inView:m_webView]; 429 419 }
Note: See TracChangeset
for help on using the changeset viewer.