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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 break; | 236 break; |
237 case ContextMenuItemTagDownloadImageToDisk: | 237 case ContextMenuItemTagDownloadImageToDisk: |
238 // FIXME: Some day we should be able to do this from within WebCore. | 238 // FIXME: Some day we should be able to do this from within WebCore. |
239 m_client->downloadURL(m_hitTestResult.absoluteImageURL()); | 239 m_client->downloadURL(m_hitTestResult.absoluteImageURL()); |
240 break; | 240 break; |
241 case ContextMenuItemTagCopyImageToClipboard: | 241 case ContextMenuItemTagCopyImageToClipboard: |
242 // FIXME: The Pasteboard class is not written yet | 242 // FIXME: The Pasteboard class is not written yet |
243 // For now, call into the client. This is temporary! | 243 // For now, call into the client. This is temporary! |
244 frame->editor()->copyImage(m_hitTestResult); | 244 frame->editor()->copyImage(m_hitTestResult); |
245 break; | 245 break; |
246 #if PLATFORM(QT) || PLATFORM(GTK) | |
247 case ContextMenuItemTagCopyImageUrlToClipboard: | |
248 frame->editor()->copyURL(m_hitTestResult.absoluteImageURL(), m_hitTestRe
sult.textContent()); | |
249 break; | |
250 #endif | |
251 case ContextMenuItemTagOpenMediaInNewWindow: | 246 case ContextMenuItemTagOpenMediaInNewWindow: |
252 openNewWindow(m_hitTestResult.absoluteMediaURL(), frame); | 247 openNewWindow(m_hitTestResult.absoluteMediaURL(), frame); |
253 break; | 248 break; |
254 case ContextMenuItemTagCopyMediaLinkToClipboard: | 249 case ContextMenuItemTagCopyMediaLinkToClipboard: |
255 frame->editor()->copyURL(m_hitTestResult.absoluteMediaURL(), m_hitTestRe
sult.textContent()); | 250 frame->editor()->copyURL(m_hitTestResult.absoluteMediaURL(), m_hitTestRe
sult.textContent()); |
256 break; | 251 break; |
257 case ContextMenuItemTagToggleMediaControls: | 252 case ContextMenuItemTagToggleMediaControls: |
258 m_hitTestResult.toggleMediaControlsDisplay(); | 253 m_hitTestResult.toggleMediaControlsDisplay(); |
259 break; | 254 break; |
260 case ContextMenuItemTagToggleMediaLoop: | 255 case ContextMenuItemTagToggleMediaLoop: |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 case ContextMenuItemTagUnicodeInsertZWSMark: | 323 case ContextMenuItemTagUnicodeInsertZWSMark: |
329 insertUnicodeCharacter(zeroWidthSpace, frame); | 324 insertUnicodeCharacter(zeroWidthSpace, frame); |
330 break; | 325 break; |
331 case ContextMenuItemTagUnicodeInsertZWJMark: | 326 case ContextMenuItemTagUnicodeInsertZWJMark: |
332 insertUnicodeCharacter(zeroWidthJoiner, frame); | 327 insertUnicodeCharacter(zeroWidthJoiner, frame); |
333 break; | 328 break; |
334 case ContextMenuItemTagUnicodeInsertZWNJMark: | 329 case ContextMenuItemTagUnicodeInsertZWNJMark: |
335 insertUnicodeCharacter(zeroWidthNonJoiner, frame); | 330 insertUnicodeCharacter(zeroWidthNonJoiner, frame); |
336 break; | 331 break; |
337 #endif | 332 #endif |
338 #if PLATFORM(GTK) || PLATFORM(QT) | |
339 case ContextMenuItemTagSelectAll: | |
340 frame->editor()->command("SelectAll").execute(); | |
341 break; | |
342 #endif | |
343 case ContextMenuItemTagSpellingGuess: { | 333 case ContextMenuItemTagSpellingGuess: { |
344 FrameSelection* frameSelection = frame->selection(); | 334 FrameSelection* frameSelection = frame->selection(); |
345 if (frame->editor()->shouldInsertText(item->title(), frameSelection->toN
ormalizedRange().get(), EditorInsertActionPasted)) { | 335 if (frame->editor()->shouldInsertText(item->title(), frameSelection->toN
ormalizedRange().get(), EditorInsertActionPasted)) { |
346 Document* document = frame->document(); | 336 Document* document = frame->document(); |
347 ReplaceSelectionCommand::CommandOptions replaceOptions = ReplaceSele
ctionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting; | 337 ReplaceSelectionCommand::CommandOptions replaceOptions = ReplaceSele
ctionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting; |
348 | 338 |
349 if (frame->editor()->behavior().shouldAllowSpellingSuggestionsWithou
tSelection()) { | 339 if (frame->editor()->behavior().shouldAllowSpellingSuggestionsWithou
tSelection()) { |
350 ASSERT(frameSelection->isCaretOrRange()); | 340 ASSERT(frameSelection->isCaretOrRange()); |
351 VisibleSelection wordSelection(frameSelection->base()); | 341 VisibleSelection wordSelection(frameSelection->base()); |
352 wordSelection.expandUsingGranularity(WordGranularity); | 342 wordSelection.expandUsingGranularity(WordGranularity); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 ContextMenuItem DownloadFileItem(ActionType, ContextMenuItemTagDownloadLinkT
oDisk, | 725 ContextMenuItem DownloadFileItem(ActionType, ContextMenuItemTagDownloadLinkT
oDisk, |
736 contextMenuItemTagDownloadLinkToDisk()); | 726 contextMenuItemTagDownloadLinkToDisk()); |
737 ContextMenuItem CopyLinkItem(ActionType, ContextMenuItemTagCopyLinkToClipboa
rd, | 727 ContextMenuItem CopyLinkItem(ActionType, ContextMenuItemTagCopyLinkToClipboa
rd, |
738 contextMenuItemTagCopyLinkToClipboard()); | 728 contextMenuItemTagCopyLinkToClipboard()); |
739 ContextMenuItem OpenImageInNewWindowItem(ActionType, ContextMenuItemTagOpenI
mageInNewWindow, | 729 ContextMenuItem OpenImageInNewWindowItem(ActionType, ContextMenuItemTagOpenI
mageInNewWindow, |
740 contextMenuItemTagOpenImageInNewWindow()); | 730 contextMenuItemTagOpenImageInNewWindow()); |
741 ContextMenuItem DownloadImageItem(ActionType, ContextMenuItemTagDownloadImag
eToDisk, | 731 ContextMenuItem DownloadImageItem(ActionType, ContextMenuItemTagDownloadImag
eToDisk, |
742 contextMenuItemTagDownloadImageToDisk()); | 732 contextMenuItemTagDownloadImageToDisk()); |
743 ContextMenuItem CopyImageItem(ActionType, ContextMenuItemTagCopyImageToClipb
oard, | 733 ContextMenuItem CopyImageItem(ActionType, ContextMenuItemTagCopyImageToClipb
oard, |
744 contextMenuItemTagCopyImageToClipboard()); | 734 contextMenuItemTagCopyImageToClipboard()); |
745 #if PLATFORM(QT) || PLATFORM(GTK) | |
746 ContextMenuItem CopyImageUrlItem(ActionType, ContextMenuItemTagCopyImageUrlT
oClipboard, | |
747 contextMenuItemTagCopyImageUrlToClipboard()); | |
748 #endif | |
749 ContextMenuItem OpenMediaInNewWindowItem(ActionType, ContextMenuItemTagOpenM
ediaInNewWindow, String()); | 735 ContextMenuItem OpenMediaInNewWindowItem(ActionType, ContextMenuItemTagOpenM
ediaInNewWindow, String()); |
750 ContextMenuItem CopyMediaLinkItem(ActionType, ContextMenuItemTagCopyMediaLin
kToClipboard, | 736 ContextMenuItem CopyMediaLinkItem(ActionType, ContextMenuItemTagCopyMediaLin
kToClipboard, |
751 String()); | 737 String()); |
752 ContextMenuItem MediaPlayPause(ActionType, ContextMenuItemTagMediaPlayPause,
| 738 ContextMenuItem MediaPlayPause(ActionType, ContextMenuItemTagMediaPlayPause,
|
753 contextMenuItemTagMediaPlay()); | 739 contextMenuItemTagMediaPlay()); |
754 ContextMenuItem MediaMute(ActionType, ContextMenuItemTagMediaMute, | 740 ContextMenuItem MediaMute(ActionType, ContextMenuItemTagMediaMute, |
755 contextMenuItemTagMediaMute()); | 741 contextMenuItemTagMediaMute()); |
756 ContextMenuItem ToggleMediaControls(CheckableActionType, ContextMenuItemTagT
oggleMediaControls, | 742 ContextMenuItem ToggleMediaControls(CheckableActionType, ContextMenuItemTagT
oggleMediaControls, |
757 contextMenuItemTagToggleMediaControls()); | 743 contextMenuItemTagToggleMediaControls()); |
758 ContextMenuItem ToggleMediaLoop(CheckableActionType, ContextMenuItemTagToggl
eMediaLoop, | 744 ContextMenuItem ToggleMediaLoop(CheckableActionType, ContextMenuItemTagToggl
eMediaLoop, |
759 contextMenuItemTagToggleMediaLoop()); | 745 contextMenuItemTagToggleMediaLoop()); |
760 ContextMenuItem EnterVideoFullscreen(ActionType, ContextMenuItemTagEnterVide
oFullscreen, | 746 ContextMenuItem EnterVideoFullscreen(ActionType, ContextMenuItemTagEnterVide
oFullscreen, |
761 contextMenuItemTagEnterVideoFullscreen()); | 747 contextMenuItemTagEnterVideoFullscreen()); |
762 #if PLATFORM(MAC) | |
763 ContextMenuItem SearchSpotlightItem(ActionType, ContextMenuItemTagSearchInSp
otlight, | |
764 contextMenuItemTagSearchInSpotlight()); | |
765 #endif | |
766 #if !PLATFORM(GTK) | |
767 ContextMenuItem SearchWebItem(ActionType, ContextMenuItemTagSearchWeb, conte
xtMenuItemTagSearchWeb()); | 748 ContextMenuItem SearchWebItem(ActionType, ContextMenuItemTagSearchWeb, conte
xtMenuItemTagSearchWeb()); |
768 #endif | |
769 ContextMenuItem CopyItem(ActionType, ContextMenuItemTagCopy, contextMenuItem
TagCopy()); | 749 ContextMenuItem CopyItem(ActionType, ContextMenuItemTagCopy, contextMenuItem
TagCopy()); |
770 ContextMenuItem BackItem(ActionType, ContextMenuItemTagGoBack, contextMenuIt
emTagGoBack()); | 750 ContextMenuItem BackItem(ActionType, ContextMenuItemTagGoBack, contextMenuIt
emTagGoBack()); |
771 ContextMenuItem ForwardItem(ActionType, ContextMenuItemTagGoForward, contex
tMenuItemTagGoForward()); | 751 ContextMenuItem ForwardItem(ActionType, ContextMenuItemTagGoForward, contex
tMenuItemTagGoForward()); |
772 ContextMenuItem StopItem(ActionType, ContextMenuItemTagStop, contextMenuItem
TagStop()); | 752 ContextMenuItem StopItem(ActionType, ContextMenuItemTagStop, contextMenuItem
TagStop()); |
773 ContextMenuItem ReloadItem(ActionType, ContextMenuItemTagReload, contextMenu
ItemTagReload()); | 753 ContextMenuItem ReloadItem(ActionType, ContextMenuItemTagReload, contextMenu
ItemTagReload()); |
774 ContextMenuItem OpenFrameItem(ActionType, ContextMenuItemTagOpenFrameInNewWi
ndow, | 754 ContextMenuItem OpenFrameItem(ActionType, ContextMenuItemTagOpenFrameInNewWi
ndow, |
775 contextMenuItemTagOpenFrameInNewWindow()); | 755 contextMenuItemTagOpenFrameInNewWindow()); |
776 ContextMenuItem NoGuessesItem(ActionType, ContextMenuItemTagNoGuessesFound, | 756 ContextMenuItem NoGuessesItem(ActionType, ContextMenuItemTagNoGuessesFound, |
777 contextMenuItemTagNoGuessesFound()); | 757 contextMenuItemTagNoGuessesFound()); |
778 ContextMenuItem IgnoreSpellingItem(ActionType, ContextMenuItemTagIgnoreSpell
ing, | 758 ContextMenuItem IgnoreSpellingItem(ActionType, ContextMenuItemTagIgnoreSpell
ing, |
779 contextMenuItemTagIgnoreSpelling()); | 759 contextMenuItemTagIgnoreSpelling()); |
780 ContextMenuItem LearnSpellingItem(ActionType, ContextMenuItemTagLearnSpellin
g, | 760 ContextMenuItem LearnSpellingItem(ActionType, ContextMenuItemTagLearnSpellin
g, |
781 contextMenuItemTagLearnSpelling()); | 761 contextMenuItemTagLearnSpelling()); |
782 ContextMenuItem IgnoreGrammarItem(ActionType, ContextMenuItemTagIgnoreGramma
r, | 762 ContextMenuItem IgnoreGrammarItem(ActionType, ContextMenuItemTagIgnoreGramma
r, |
783 contextMenuItemTagIgnoreGrammar()); | 763 contextMenuItemTagIgnoreGrammar()); |
784 ContextMenuItem CutItem(ActionType, ContextMenuItemTagCut, contextMenuItemTa
gCut()); | 764 ContextMenuItem CutItem(ActionType, ContextMenuItemTagCut, contextMenuItemTa
gCut()); |
785 ContextMenuItem PasteItem(ActionType, ContextMenuItemTagPaste, contextMenuIt
emTagPaste()); | 765 ContextMenuItem PasteItem(ActionType, ContextMenuItemTagPaste, contextMenuIt
emTagPaste()); |
786 #if PLATFORM(GTK) | |
787 ContextMenuItem DeleteItem(ActionType, ContextMenuItemTagDelete, contextMenu
ItemTagDelete()); | |
788 #endif | |
789 #if PLATFORM(GTK) || PLATFORM(QT) | |
790 ContextMenuItem SelectAllItem(ActionType, ContextMenuItemTagSelectAll, conte
xtMenuItemTagSelectAll()); | |
791 #endif | |
792 | 766 |
793 Node* node = m_hitTestResult.innerNonSharedNode(); | 767 Node* node = m_hitTestResult.innerNonSharedNode(); |
794 if (!node) | 768 if (!node) |
795 return; | 769 return; |
796 #if PLATFORM(GTK) | 770 #if PLATFORM(GTK) |
797 if (!m_hitTestResult.isContentEditable() && (node->isElementNode() && toElem
ent(node)->isFormControlElement())) | 771 if (!m_hitTestResult.isContentEditable() && (node->isElementNode() && toElem
ent(node)->isFormControlElement())) |
798 return; | 772 return; |
799 #endif | 773 #endif |
800 Frame* frame = node->document()->frame(); | 774 Frame* frame = node->document()->frame(); |
801 if (!frame) | 775 if (!frame) |
802 return; | 776 return; |
803 | 777 |
804 if (!m_hitTestResult.isContentEditable()) { | 778 if (!m_hitTestResult.isContentEditable()) { |
805 FrameLoader* loader = frame->loader(); | 779 FrameLoader* loader = frame->loader(); |
806 KURL linkURL = m_hitTestResult.absoluteLinkURL(); | 780 KURL linkURL = m_hitTestResult.absoluteLinkURL(); |
807 if (!linkURL.isEmpty()) { | 781 if (!linkURL.isEmpty()) { |
808 if (loader->client()->canHandleRequest(ResourceRequest(linkURL))) { | 782 if (loader->client()->canHandleRequest(ResourceRequest(linkURL))) { |
809 appendItem(OpenLinkItem, m_contextMenu.get()); | 783 appendItem(OpenLinkItem, m_contextMenu.get()); |
810 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get()); | 784 appendItem(OpenLinkInNewWindowItem, m_contextMenu.get()); |
811 appendItem(DownloadFileItem, m_contextMenu.get()); | 785 appendItem(DownloadFileItem, m_contextMenu.get()); |
812 } | 786 } |
813 #if PLATFORM(QT) | |
814 if (m_hitTestResult.isSelected()) | |
815 appendItem(CopyItem, m_contextMenu.get()); | |
816 #endif | |
817 appendItem(CopyLinkItem, m_contextMenu.get()); | 787 appendItem(CopyLinkItem, m_contextMenu.get()); |
818 } | 788 } |
819 | 789 |
820 KURL imageURL = m_hitTestResult.absoluteImageURL(); | 790 KURL imageURL = m_hitTestResult.absoluteImageURL(); |
821 if (!imageURL.isEmpty()) { | 791 if (!imageURL.isEmpty()) { |
822 if (!linkURL.isEmpty()) | 792 if (!linkURL.isEmpty()) |
823 appendItem(*separatorItem(), m_contextMenu.get()); | 793 appendItem(*separatorItem(), m_contextMenu.get()); |
824 | 794 |
825 appendItem(OpenImageInNewWindowItem, m_contextMenu.get()); | 795 appendItem(OpenImageInNewWindowItem, m_contextMenu.get()); |
826 appendItem(DownloadImageItem, m_contextMenu.get()); | 796 appendItem(DownloadImageItem, m_contextMenu.get()); |
827 if (imageURL.isLocalFile() || m_hitTestResult.image()) | 797 if (imageURL.isLocalFile() || m_hitTestResult.image()) |
828 appendItem(CopyImageItem, m_contextMenu.get()); | 798 appendItem(CopyImageItem, m_contextMenu.get()); |
829 #if PLATFORM(QT) || PLATFORM(GTK) | |
830 appendItem(CopyImageUrlItem, m_contextMenu.get()); | |
831 #endif | |
832 } | 799 } |
833 | 800 |
834 KURL mediaURL = m_hitTestResult.absoluteMediaURL(); | 801 KURL mediaURL = m_hitTestResult.absoluteMediaURL(); |
835 if (!mediaURL.isEmpty()) { | 802 if (!mediaURL.isEmpty()) { |
836 if (!linkURL.isEmpty() || !imageURL.isEmpty()) | 803 if (!linkURL.isEmpty() || !imageURL.isEmpty()) |
837 appendItem(*separatorItem(), m_contextMenu.get()); | 804 appendItem(*separatorItem(), m_contextMenu.get()); |
838 | 805 |
839 appendItem(MediaPlayPause, m_contextMenu.get()); | 806 appendItem(MediaPlayPause, m_contextMenu.get()); |
840 appendItem(MediaMute, m_contextMenu.get()); | 807 appendItem(MediaMute, m_contextMenu.get()); |
841 appendItem(ToggleMediaControls, m_contextMenu.get()); | 808 appendItem(ToggleMediaControls, m_contextMenu.get()); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 | 972 |
1006 #if PLATFORM(MAC) && INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM | 973 #if PLATFORM(MAC) && INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM |
1007 appendItem(LookUpInDictionaryItem, m_contextMenu.get()); | 974 appendItem(LookUpInDictionaryItem, m_contextMenu.get()); |
1008 appendItem(*separatorItem(), m_contextMenu.get()); | 975 appendItem(*separatorItem(), m_contextMenu.get()); |
1009 #endif | 976 #endif |
1010 } | 977 } |
1011 | 978 |
1012 appendItem(CutItem, m_contextMenu.get()); | 979 appendItem(CutItem, m_contextMenu.get()); |
1013 appendItem(CopyItem, m_contextMenu.get()); | 980 appendItem(CopyItem, m_contextMenu.get()); |
1014 appendItem(PasteItem, m_contextMenu.get()); | 981 appendItem(PasteItem, m_contextMenu.get()); |
1015 #if PLATFORM(GTK) | |
1016 appendItem(DeleteItem, m_contextMenu.get()); | |
1017 appendItem(*separatorItem(), m_contextMenu.get()); | |
1018 #endif | |
1019 #if PLATFORM(GTK) || PLATFORM(QT) | |
1020 appendItem(SelectAllItem, m_contextMenu.get()); | |
1021 #endif | |
1022 | 982 |
1023 if (!inPasswordField) { | 983 if (!inPasswordField) { |
1024 #if !PLATFORM(GTK) | |
1025 appendItem(*separatorItem(), m_contextMenu.get()); | 984 appendItem(*separatorItem(), m_contextMenu.get()); |
1026 ContextMenuItem SpellingAndGrammarMenuItem(SubmenuType, ContextMenuI
temTagSpellingMenu, | 985 ContextMenuItem SpellingAndGrammarMenuItem(SubmenuType, ContextMenuI
temTagSpellingMenu, |
1027 contextMenuItemTagSpellingMenu()); | 986 contextMenuItemTagSpellingMenu()); |
1028 createAndAppendSpellingAndGrammarSubMenu(SpellingAndGrammarMenuItem)
; | 987 createAndAppendSpellingAndGrammarSubMenu(SpellingAndGrammarMenuItem)
; |
1029 appendItem(SpellingAndGrammarMenuItem, m_contextMenu.get()); | 988 appendItem(SpellingAndGrammarMenuItem, m_contextMenu.get()); |
1030 #endif | |
1031 #if PLATFORM(MAC) | 989 #if PLATFORM(MAC) |
1032 ContextMenuItem substitutionsMenuItem(SubmenuType, ContextMenuItemTa
gSubstitutionsMenu, | 990 ContextMenuItem substitutionsMenuItem(SubmenuType, ContextMenuItemTa
gSubstitutionsMenu, |
1033 contextMenuItemTagSubstitutionsMenu()); | 991 contextMenuItemTagSubstitutionsMenu()); |
1034 createAndAppendSubstitutionsSubMenu(substitutionsMenuItem); | 992 createAndAppendSubstitutionsSubMenu(substitutionsMenuItem); |
1035 appendItem(substitutionsMenuItem, m_contextMenu.get()); | 993 appendItem(substitutionsMenuItem, m_contextMenu.get()); |
1036 ContextMenuItem transformationsMenuItem(SubmenuType, ContextMenuItem
TagTransformationsMenu, | 994 ContextMenuItem transformationsMenuItem(SubmenuType, ContextMenuItem
TagTransformationsMenu, |
1037 contextMenuItemTagTransformationsMenu()); | 995 contextMenuItemTagTransformationsMenu()); |
1038 createAndAppendTransformationsSubMenu(transformationsMenuItem); | 996 createAndAppendTransformationsSubMenu(transformationsMenuItem); |
1039 appendItem(transformationsMenuItem, m_contextMenu.get()); | 997 appendItem(transformationsMenuItem, m_contextMenu.get()); |
1040 #endif | 998 #endif |
1041 #if PLATFORM(GTK) | |
1042 bool shouldShowFontMenu = frame->editor()->canEditRichly(); | |
1043 #else | |
1044 bool shouldShowFontMenu = true; | 999 bool shouldShowFontMenu = true; |
1045 #endif | |
1046 if (shouldShowFontMenu) { | 1000 if (shouldShowFontMenu) { |
1047 ContextMenuItem FontMenuItem(SubmenuType, ContextMenuItemTagFont
Menu, | 1001 ContextMenuItem FontMenuItem(SubmenuType, ContextMenuItemTagFont
Menu, |
1048 contextMenuItemTagFontMenu()); | 1002 contextMenuItemTagFontMenu()); |
1049 createAndAppendFontSubMenu(FontMenuItem); | 1003 createAndAppendFontSubMenu(FontMenuItem); |
1050 appendItem(FontMenuItem, m_contextMenu.get()); | 1004 appendItem(FontMenuItem, m_contextMenu.get()); |
1051 } | 1005 } |
1052 #if PLATFORM(MAC) | 1006 #if PLATFORM(MAC) |
1053 ContextMenuItem SpeechMenuItem(SubmenuType, ContextMenuItemTagSpeech
Menu, contextMenuItemTagSpeechMenu()); | 1007 ContextMenuItem SpeechMenuItem(SubmenuType, ContextMenuItemTagSpeech
Menu, contextMenuItemTagSpeechMenu()); |
1054 createAndAppendSpeechSubMenu(SpeechMenuItem); | 1008 createAndAppendSpeechSubMenu(SpeechMenuItem); |
1055 appendItem(SpeechMenuItem, m_contextMenu.get()); | 1009 appendItem(SpeechMenuItem, m_contextMenu.get()); |
1056 #endif | 1010 #endif |
1057 #if PLATFORM(GTK) | |
1058 EditorClient* client = frame->editor()->client(); | |
1059 if (client && client->shouldShowUnicodeMenu()) { | |
1060 ContextMenuItem UnicodeMenuItem(SubmenuType, ContextMenuItemTagU
nicode, contextMenuItemTagUnicode()); | |
1061 createAndAppendUnicodeSubMenu(UnicodeMenuItem); | |
1062 appendItem(*separatorItem(), m_contextMenu.get()); | |
1063 appendItem(UnicodeMenuItem, m_contextMenu.get()); | |
1064 } | |
1065 #else | |
1066 ContextMenuItem WritingDirectionMenuItem(SubmenuType, ContextMenuIte
mTagWritingDirectionMenu, | 1011 ContextMenuItem WritingDirectionMenuItem(SubmenuType, ContextMenuIte
mTagWritingDirectionMenu, |
1067 contextMenuItemTagWritingDirectionMenu()); | 1012 contextMenuItemTagWritingDirectionMenu()); |
1068 createAndAppendWritingDirectionSubMenu(WritingDirectionMenuItem); | 1013 createAndAppendWritingDirectionSubMenu(WritingDirectionMenuItem); |
1069 appendItem(WritingDirectionMenuItem, m_contextMenu.get()); | 1014 appendItem(WritingDirectionMenuItem, m_contextMenu.get()); |
1070 if (Page* page = frame->page()) { | 1015 if (Page* page = frame->page()) { |
1071 if (Settings* settings = page->settings()) { | 1016 if (Settings* settings = page->settings()) { |
1072 bool includeTextDirectionSubmenu = settings->textDirectionSu
bmenuInclusionBehavior() == TextDirectionSubmenuAlwaysIncluded | 1017 bool includeTextDirectionSubmenu = settings->textDirectionSu
bmenuInclusionBehavior() == TextDirectionSubmenuAlwaysIncluded |
1073 || (settings->textDirectionSubmenuInclusionBehavior() ==
TextDirectionSubmenuAutomaticallyIncluded && frame->editor()->hasBidiSelection(
)); | 1018 || (settings->textDirectionSubmenuInclusionBehavior() ==
TextDirectionSubmenuAutomaticallyIncluded && frame->editor()->hasBidiSelection(
)); |
1074 if (includeTextDirectionSubmenu) { | 1019 if (includeTextDirectionSubmenu) { |
1075 ContextMenuItem TextDirectionMenuItem(SubmenuType, Conte
xtMenuItemTagTextDirectionMenu, | 1020 ContextMenuItem TextDirectionMenuItem(SubmenuType, Conte
xtMenuItemTagTextDirectionMenu, |
1076 contextMenuItemTagTextDirectionMenu()); | 1021 contextMenuItemTagTextDirectionMenu()); |
1077 createAndAppendTextDirectionSubMenu(TextDirectionMenuIte
m); | 1022 createAndAppendTextDirectionSubMenu(TextDirectionMenuIte
m); |
1078 appendItem(TextDirectionMenuItem, m_contextMenu.get()); | 1023 appendItem(TextDirectionMenuItem, m_contextMenu.get()); |
1079 } | 1024 } |
1080 } | 1025 } |
1081 } | 1026 } |
1082 #endif | |
1083 } | 1027 } |
1084 } | 1028 } |
1085 } | 1029 } |
1086 | 1030 |
1087 void ContextMenuController::addInspectElementItem() | 1031 void ContextMenuController::addInspectElementItem() |
1088 { | 1032 { |
1089 Node* node = m_hitTestResult.innerNonSharedNode(); | 1033 Node* node = m_hitTestResult.innerNonSharedNode(); |
1090 if (!node) | 1034 if (!node) |
1091 return; | 1035 return; |
1092 | 1036 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 case ContextMenuItemTagFontMenu: | 1246 case ContextMenuItemTagFontMenu: |
1303 #endif | 1247 #endif |
1304 case ContextMenuItemTagNoAction: | 1248 case ContextMenuItemTagNoAction: |
1305 case ContextMenuItemTagOpenLinkInNewWindow: | 1249 case ContextMenuItemTagOpenLinkInNewWindow: |
1306 case ContextMenuItemTagOpenLinkInThisWindow: | 1250 case ContextMenuItemTagOpenLinkInThisWindow: |
1307 case ContextMenuItemTagDownloadLinkToDisk: | 1251 case ContextMenuItemTagDownloadLinkToDisk: |
1308 case ContextMenuItemTagCopyLinkToClipboard: | 1252 case ContextMenuItemTagCopyLinkToClipboard: |
1309 case ContextMenuItemTagOpenImageInNewWindow: | 1253 case ContextMenuItemTagOpenImageInNewWindow: |
1310 case ContextMenuItemTagDownloadImageToDisk: | 1254 case ContextMenuItemTagDownloadImageToDisk: |
1311 case ContextMenuItemTagCopyImageToClipboard: | 1255 case ContextMenuItemTagCopyImageToClipboard: |
1312 #if PLATFORM(QT) || PLATFORM(GTK) | |
1313 case ContextMenuItemTagCopyImageUrlToClipboard: | |
1314 #endif | |
1315 break; | 1256 break; |
1316 case ContextMenuItemTagOpenMediaInNewWindow: | 1257 case ContextMenuItemTagOpenMediaInNewWindow: |
1317 if (m_hitTestResult.mediaIsVideo()) | 1258 if (m_hitTestResult.mediaIsVideo()) |
1318 item.setTitle(contextMenuItemTagOpenVideoInNewWindow()); | 1259 item.setTitle(contextMenuItemTagOpenVideoInNewWindow()); |
1319 else | 1260 else |
1320 item.setTitle(contextMenuItemTagOpenAudioInNewWindow()); | 1261 item.setTitle(contextMenuItemTagOpenAudioInNewWindow()); |
1321 break; | 1262 break; |
1322 case ContextMenuItemTagCopyMediaLinkToClipboard: | 1263 case ContextMenuItemTagCopyMediaLinkToClipboard: |
1323 if (m_hitTestResult.mediaIsVideo()) | 1264 if (m_hitTestResult.mediaIsVideo()) |
1324 item.setTitle(contextMenuItemTagCopyVideoLinkToClipboard()); | 1265 item.setTitle(contextMenuItemTagCopyVideoLinkToClipboard()); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformE
vent::MousePressed, 1, false, false, false, false, currentTime()); | 1332 PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformE
vent::MousePressed, 1, false, false, false, false, currentTime()); |
1392 bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent); | 1333 bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent); |
1393 if (handled && client()) | 1334 if (handled && client()) |
1394 client()->showContextMenu(); | 1335 client()->showContextMenu(); |
1395 } | 1336 } |
1396 #endif | 1337 #endif |
1397 | 1338 |
1398 } // namespace WebCore | 1339 } // namespace WebCore |
1399 | 1340 |
1400 #endif // ENABLE(CONTEXT_MENUS) | 1341 #endif // ENABLE(CONTEXT_MENUS) |
OLD | NEW |