OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Igalia S.L | 3 * Copyright (C) 2010 Igalia S.L |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 if (!node) | 537 if (!node) |
538 return; | 538 return; |
539 Frame* frame = node->document()->frame(); | 539 Frame* frame = node->document()->frame(); |
540 if (!frame) | 540 if (!frame) |
541 return; | 541 return; |
542 | 542 |
543 if (!m_hitTestResult.isContentEditable()) { | 543 if (!m_hitTestResult.isContentEditable()) { |
544 FrameLoader* loader = frame->loader(); | 544 FrameLoader* loader = frame->loader(); |
545 KURL linkURL = m_hitTestResult.absoluteLinkURL(); | 545 KURL linkURL = m_hitTestResult.absoluteLinkURL(); |
546 if (!linkURL.isEmpty()) { | 546 if (!linkURL.isEmpty()) { |
547 if (loader->client()->canHandleRequest(ResourceRequest(linkURL))) { | 547 appendItem(OpenLinkItem, m_contextMenu.get()); |
548 appendItem(OpenLinkItem, m_contextMenu.get()); | 548 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get()); |
549 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get()); | 549 appendItem(DownloadFileItem, m_contextMenu.get()); |
550 appendItem(DownloadFileItem, m_contextMenu.get()); | |
551 } | |
552 appendItem(CopyLinkItem, m_contextMenu.get()); | 550 appendItem(CopyLinkItem, m_contextMenu.get()); |
553 } | 551 } |
554 | 552 |
555 KURL imageURL = m_hitTestResult.absoluteImageURL(); | 553 KURL imageURL = m_hitTestResult.absoluteImageURL(); |
556 if (!imageURL.isEmpty()) { | 554 if (!imageURL.isEmpty()) { |
557 if (!linkURL.isEmpty()) | 555 if (!linkURL.isEmpty()) |
558 appendItem(*separatorItem(), m_contextMenu.get()); | 556 appendItem(*separatorItem(), m_contextMenu.get()); |
559 | 557 |
560 appendItem(OpenImageInNewWindowItem, m_contextMenu.get()); | 558 appendItem(OpenImageInNewWindowItem, m_contextMenu.get()); |
561 appendItem(DownloadImageItem, m_contextMenu.get()); | 559 appendItem(DownloadImageItem, m_contextMenu.get()); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 if (!dictationAlternatives.isEmpty()) { | 652 if (!dictationAlternatives.isEmpty()) { |
655 for (size_t i = 0; i < dictationAlternatives.size(); ++i) { | 653 for (size_t i = 0; i < dictationAlternatives.size(); ++i) { |
656 ContextMenuItem item(ActionType, ContextMenuItemTagDicta
tionAlternative, dictationAlternatives[i]); | 654 ContextMenuItem item(ActionType, ContextMenuItemTagDicta
tionAlternative, dictationAlternatives[i]); |
657 appendItem(item, m_contextMenu.get()); | 655 appendItem(item, m_contextMenu.get()); |
658 } | 656 } |
659 appendItem(*separatorItem(), m_contextMenu.get()); | 657 appendItem(*separatorItem(), m_contextMenu.get()); |
660 } | 658 } |
661 } | 659 } |
662 } | 660 } |
663 | 661 |
664 FrameLoader* loader = frame->loader(); | |
665 KURL linkURL = m_hitTestResult.absoluteLinkURL(); | 662 KURL linkURL = m_hitTestResult.absoluteLinkURL(); |
666 if (!linkURL.isEmpty()) { | 663 if (!linkURL.isEmpty()) { |
667 if (loader->client()->canHandleRequest(ResourceRequest(linkURL))) { | 664 appendItem(OpenLinkItem, m_contextMenu.get()); |
668 appendItem(OpenLinkItem, m_contextMenu.get()); | 665 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get()); |
669 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get()); | 666 appendItem(DownloadFileItem, m_contextMenu.get()); |
670 appendItem(DownloadFileItem, m_contextMenu.get()); | |
671 } | |
672 appendItem(CopyLinkItem, m_contextMenu.get()); | 667 appendItem(CopyLinkItem, m_contextMenu.get()); |
673 appendItem(*separatorItem(), m_contextMenu.get()); | 668 appendItem(*separatorItem(), m_contextMenu.get()); |
674 } | 669 } |
675 | 670 |
676 if (m_hitTestResult.isSelected() && !inPasswordField && selectionContain
sPossibleWord(frame)) { | 671 if (m_hitTestResult.isSelected() && !inPasswordField && selectionContain
sPossibleWord(frame)) { |
677 appendItem(SearchWebItem, m_contextMenu.get()); | 672 appendItem(SearchWebItem, m_contextMenu.get()); |
678 appendItem(*separatorItem(), m_contextMenu.get()); | 673 appendItem(*separatorItem(), m_contextMenu.get()); |
679 } | 674 } |
680 | 675 |
681 appendItem(CutItem, m_contextMenu.get()); | 676 appendItem(CutItem, m_contextMenu.get()); |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 { | 926 { |
932 // Simulate a click in the middle of the accessibility object. | 927 // Simulate a click in the middle of the accessibility object. |
933 PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformE
vent::MousePressed, 1, false, false, false, false, currentTime()); | 928 PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformE
vent::MousePressed, 1, false, false, false, false, currentTime()); |
934 bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent); | 929 bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent); |
935 if (handled && client()) | 930 if (handled && client()) |
936 client()->showContextMenu(); | 931 client()->showContextMenu(); |
937 } | 932 } |
938 #endif | 933 #endif |
939 | 934 |
940 } // namespace WebCore | 935 } // namespace WebCore |
OLD | NEW |