OLD | NEW |
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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Dispatch the contextmenu event regardless of if the click was swallowed. |
538 #if OS(WIN) | 538 if (!page()->settings().showContextMenuOnMouseUp()) { |
539 // On Windows, we handle it on mouse up, not down. | 539 #if OS(MACOSX) |
540 #elif OS(MACOSX) | 540 if (event.button == WebMouseEvent::ButtonRight |
541 if (event.button == WebMouseEvent::ButtonRight | 541 || (event.button == WebMouseEvent::ButtonLeft |
542 || (event.button == WebMouseEvent::ButtonLeft | 542 && event.modifiers & WebMouseEvent::ControlKey)) |
543 && event.modifiers & WebMouseEvent::ControlKey)) | 543 mouseContextMenu(event); |
544 mouseContextMenu(event); | |
545 #else | 544 #else |
546 if (event.button == WebMouseEvent::ButtonRight) | 545 if (event.button == WebMouseEvent::ButtonRight) |
547 mouseContextMenu(event); | 546 mouseContextMenu(event); |
548 #endif | 547 #endif |
| 548 } |
549 } | 549 } |
550 | 550 |
551 void WebViewImpl::mouseContextMenu(const WebMouseEvent& event) | 551 void WebViewImpl::mouseContextMenu(const WebMouseEvent& event) |
552 { | 552 { |
553 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 553 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
554 return; | 554 return; |
555 | 555 |
556 m_page->contextMenuController().clearContextMenu(); | 556 m_page->contextMenuController().clearContextMenu(); |
557 | 557 |
558 PlatformMouseEventBuilder pme(mainFrameImpl()->frameView(), event); | 558 PlatformMouseEventBuilder pme(mainFrameImpl()->frameView(), event); |
(...skipping 19 matching lines...) Expand all Loading... |
578 targetLocalFrame->eventHandler().sendContextMenuEvent(pme); | 578 targetLocalFrame->eventHandler().sendContextMenuEvent(pme); |
579 m_contextMenuAllowed = false; | 579 m_contextMenuAllowed = false; |
580 // Actually showing the context menu is handled by the ContextMenuClient | 580 // Actually showing the context menu is handled by the ContextMenuClient |
581 // implementation... | 581 // implementation... |
582 } | 582 } |
583 | 583 |
584 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEvent& even
t) | 584 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEvent& even
t) |
585 { | 585 { |
586 PageWidgetEventHandler::handleMouseUp(mainFrame, event); | 586 PageWidgetEventHandler::handleMouseUp(mainFrame, event); |
587 | 587 |
588 #if OS(WIN) | 588 if (page()->settings().showContextMenuOnMouseUp()) { |
589 // Dispatch the contextmenu event regardless of if the click was swallowed. | 589 // Dispatch the contextmenu event regardless of if the click was swallow
ed. |
590 // On Mac/Linux, we handle it on mouse down, not up. | 590 // On Mac/Linux, we handle it on mouse down, not up. |
591 if (event.button == WebMouseEvent::ButtonRight) | 591 if (event.button == WebMouseEvent::ButtonRight) |
592 mouseContextMenu(event); | 592 mouseContextMenu(event); |
593 #endif | 593 } |
594 } | 594 } |
595 | 595 |
596 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve
nt& event) | 596 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve
nt& event) |
597 { | 597 { |
598 hidePopups(); | 598 hidePopups(); |
599 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); | 599 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); |
600 } | 600 } |
601 | 601 |
602 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci
ty) | 602 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci
ty) |
603 { | 603 { |
(...skipping 3946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4550 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4550 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4551 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4551 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4552 } | 4552 } |
4553 | 4553 |
4554 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4554 void WebViewImpl::forceNextWebGLContextCreationToFail() |
4555 { | 4555 { |
4556 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4556 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
4557 } | 4557 } |
4558 | 4558 |
4559 } // namespace blink | 4559 } // namespace blink |
OLD | NEW |