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

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

Issue 776483002: Use the setting to determine whether showing context menu on mouse up. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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/core/page/EventHandler.cpp ('k') | 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) 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 // immediately reopened the select popup. It needs to be closed. 527 // immediately reopened the select popup. It needs to be closed.
528 hideSelectPopup(); 528 hideSelectPopup();
529 } 529 }
530 530
531 if (m_pagePopup && pagePopup && m_pagePopup->hasSamePopupClient(pagePopup.ge t())) { 531 if (m_pagePopup && pagePopup && m_pagePopup->hasSamePopupClient(pagePopup.ge t())) {
532 // That click triggered a page popup that is the same as the one we just closed. 532 // That click triggered a page popup that is the same as the one we just closed.
533 // It needs to be closed. 533 // It needs to be closed.
534 closePagePopup(m_pagePopup.get()); 534 closePagePopup(m_pagePopup.get());
535 } 535 }
536 536
537 // Dispatch the contextmenu event regardless of if the click was swallowed. 537 if (!page()->settings().showContextMenuOnMouseUp()) {
Rick Byers 2014/12/02 19:33:06 This comment is still relevant - keep it.
zino 2014/12/03 12:32:24 Done.
538 #if OS(WIN) 538 #if OS(MACOSX)
539 // On Windows, we handle it on mouse up, not down. 539 if (event.button == WebMouseEvent::ButtonRight
540 #elif OS(MACOSX) 540 || (event.button == WebMouseEvent::ButtonLeft
541 if (event.button == WebMouseEvent::ButtonRight 541 && event.modifiers & WebMouseEvent::ControlKey))
542 || (event.button == WebMouseEvent::ButtonLeft 542 mouseContextMenu(event);
543 && event.modifiers & WebMouseEvent::ControlKey))
544 mouseContextMenu(event);
545 #else 543 #else
546 if (event.button == WebMouseEvent::ButtonRight) 544 if (event.button == WebMouseEvent::ButtonRight)
547 mouseContextMenu(event); 545 mouseContextMenu(event);
548 #endif 546 #endif
547 }
549 } 548 }
550 549
551 void WebViewImpl::mouseContextMenu(const WebMouseEvent& event) 550 void WebViewImpl::mouseContextMenu(const WebMouseEvent& event)
552 { 551 {
553 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 552 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
554 return; 553 return;
555 554
556 m_page->contextMenuController().clearContextMenu(); 555 m_page->contextMenuController().clearContextMenu();
557 556
558 PlatformMouseEventBuilder pme(mainFrameImpl()->frameView(), event); 557 PlatformMouseEventBuilder pme(mainFrameImpl()->frameView(), event);
(...skipping 19 matching lines...) Expand all
578 targetLocalFrame->eventHandler().sendContextMenuEvent(pme); 577 targetLocalFrame->eventHandler().sendContextMenuEvent(pme);
579 m_contextMenuAllowed = false; 578 m_contextMenuAllowed = false;
580 // Actually showing the context menu is handled by the ContextMenuClient 579 // Actually showing the context menu is handled by the ContextMenuClient
581 // implementation... 580 // implementation...
582 } 581 }
583 582
584 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEvent& even t) 583 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEvent& even t)
585 { 584 {
586 PageWidgetEventHandler::handleMouseUp(mainFrame, event); 585 PageWidgetEventHandler::handleMouseUp(mainFrame, event);
587 586
588 #if OS(WIN) 587 if (page()->settings().showContextMenuOnMouseUp()) {
589 // Dispatch the contextmenu event regardless of if the click was swallowed. 588 // Dispatch the contextmenu event regardless of if the click was swallow ed.
590 // On Mac/Linux, we handle it on mouse down, not up. 589 // On Mac/Linux, we handle it on mouse down, not up.
591 if (event.button == WebMouseEvent::ButtonRight) 590 if (event.button == WebMouseEvent::ButtonRight)
592 mouseContextMenu(event); 591 mouseContextMenu(event);
593 #endif 592 }
594 } 593 }
595 594
596 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve nt& event) 595 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve nt& event)
597 { 596 {
598 hidePopups(); 597 hidePopups();
599 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); 598 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event);
600 } 599 }
601 600
602 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci ty) 601 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci ty)
603 { 602 {
(...skipping 3947 matching lines...) Expand 10 before | Expand all | Expand 10 after
4551 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4550 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4552 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4551 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4553 } 4552 }
4554 4553
4555 void WebViewImpl::forceNextWebGLContextCreationToFail() 4554 void WebViewImpl::forceNextWebGLContextCreationToFail()
4556 { 4555 {
4557 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4556 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4558 } 4557 }
4559 4558
4560 } // namespace blink 4559 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/EventHandler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698