Title: [271708] branches/safari-611.1.10.1-branch/Source
Revision
271708
Author
alanc...@apple.com
Date
2021-01-21 12:13:11 -0800 (Thu, 21 Jan 2021)

Log Message

Cherry-pick r271619. rdar://problem/73461359

    REGRESSION(r269865) Mail's context menu when right clicking on a link does not contain correct entries
    https://bugs.webkit.org/show_bug.cgi?id=220745

    Patch by Alex Christensen <achristen...@webkit.org> on 2021-01-19
    Reviewed by Tim Horton.

    Source/WebCore:

    r269865 broke binary compatibility by changing the values of many WebCore::ContextMenuAction values and many WKContextMenuItemTag values,
    and not in the same way.  In WebContextMenuProxyMac::getContextMenuItem we call NSMenuItem setTag: with the value from WebCore::ContextMenuAction
    and mail compares those values with values from WKContextMenuItemTag in our C API.  This isn't ideal, but we need to retain binary compatibility.

    * platform/ContextMenuItem.h:

    Source/WebKit:

    * Shared/API/c/WKContextMenuItem.cpp:
    Add a bunch of static_asserts to verify that our binary values correspond to each other and don't change.
    * Shared/API/c/WKContextMenuItemTypes.h:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271619 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611.1.10.1-branch/Source/WebCore/ChangeLog (271707 => 271708)


--- branches/safari-611.1.10.1-branch/Source/WebCore/ChangeLog	2021-01-21 20:11:03 UTC (rev 271707)
+++ branches/safari-611.1.10.1-branch/Source/WebCore/ChangeLog	2021-01-21 20:13:11 UTC (rev 271708)
@@ -1,3 +1,42 @@
+2021-01-21  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r271619. rdar://problem/73461359
+
+    REGRESSION(r269865) Mail's context menu when right clicking on a link does not contain correct entries
+    https://bugs.webkit.org/show_bug.cgi?id=220745
+    
+    Patch by Alex Christensen <achristen...@webkit.org> on 2021-01-19
+    Reviewed by Tim Horton.
+    
+    Source/WebCore:
+    
+    r269865 broke binary compatibility by changing the values of many WebCore::ContextMenuAction values and many WKContextMenuItemTag values,
+    and not in the same way.  In WebContextMenuProxyMac::getContextMenuItem we call NSMenuItem setTag: with the value from WebCore::ContextMenuAction
+    and mail compares those values with values from WKContextMenuItemTag in our C API.  This isn't ideal, but we need to retain binary compatibility.
+    
+    * platform/ContextMenuItem.h:
+    
+    Source/WebKit:
+    
+    * Shared/API/c/WKContextMenuItem.cpp:
+    Add a bunch of static_asserts to verify that our binary values correspond to each other and don't change.
+    * Shared/API/c/WKContextMenuItemTypes.h:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-19  Alex Christensen  <achristen...@webkit.org>
+
+            REGRESSION(r269865) Mail's context menu when right clicking on a link does not contain correct entries
+            https://bugs.webkit.org/show_bug.cgi?id=220745
+
+            Reviewed by Tim Horton.
+
+            r269865 broke binary compatibility by changing the values of many WebCore::ContextMenuAction values and many WKContextMenuItemTag values,
+            and not in the same way.  In WebContextMenuProxyMac::getContextMenuItem we call NSMenuItem setTag: with the value from WebCore::ContextMenuAction
+            and mail compares those values with values from WKContextMenuItemTag in our C API.  This isn't ideal, but we need to retain binary compatibility.
+
+            * platform/ContextMenuItem.h:
+
 2021-01-11  Russell Epstein  <repst...@apple.com>
 
         Cherry-pick r271364. rdar://problem/73001152

Modified: branches/safari-611.1.10.1-branch/Source/WebCore/platform/ContextMenuItem.h (271707 => 271708)


--- branches/safari-611.1.10.1-branch/Source/WebCore/platform/ContextMenuItem.h	2021-01-21 20:11:03 UTC (rev 271707)
+++ branches/safari-611.1.10.1-branch/Source/WebCore/platform/ContextMenuItem.h	2021-01-21 20:13:11 UTC (rev 271708)
@@ -118,10 +118,6 @@
     ContextMenuItemTagTextDirectionDefault,
     ContextMenuItemTagTextDirectionLeftToRight,
     ContextMenuItemTagTextDirectionRightToLeft,
-#if ENABLE(APP_HIGHLIGHTS)
-    ContextMenuItemTagAddHighlightToCurrentGroup,
-    ContextMenuItemTagAddHighlightToNewGroup,
-#endif
 #if PLATFORM(COCOA)
     ContextMenuItemTagCorrectSpellingAutomatically,
     ContextMenuItemTagSubstitutionsMenu,
@@ -149,6 +145,10 @@
     ContextMenuItemTagToggleVideoFullscreen,
     ContextMenuItemTagShareMenu,
     ContextMenuItemTagToggleVideoEnhancedFullscreen,
+#if ENABLE(APP_HIGHLIGHTS)
+    ContextMenuItemTagAddHighlightToCurrentGroup,
+    ContextMenuItemTagAddHighlightToNewGroup,
+#endif
     ContextMenuItemBaseCustomTag = 5000,
     ContextMenuItemLastCustomTag = 5999,
     ContextMenuItemBaseApplicationTag = 10000

Modified: branches/safari-611.1.10.1-branch/Source/WebKit/ChangeLog (271707 => 271708)


--- branches/safari-611.1.10.1-branch/Source/WebKit/ChangeLog	2021-01-21 20:11:03 UTC (rev 271707)
+++ branches/safari-611.1.10.1-branch/Source/WebKit/ChangeLog	2021-01-21 20:13:11 UTC (rev 271708)
@@ -1,3 +1,40 @@
+2021-01-21  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r271619. rdar://problem/73461359
+
+    REGRESSION(r269865) Mail's context menu when right clicking on a link does not contain correct entries
+    https://bugs.webkit.org/show_bug.cgi?id=220745
+    
+    Patch by Alex Christensen <achristen...@webkit.org> on 2021-01-19
+    Reviewed by Tim Horton.
+    
+    Source/WebCore:
+    
+    r269865 broke binary compatibility by changing the values of many WebCore::ContextMenuAction values and many WKContextMenuItemTag values,
+    and not in the same way.  In WebContextMenuProxyMac::getContextMenuItem we call NSMenuItem setTag: with the value from WebCore::ContextMenuAction
+    and mail compares those values with values from WKContextMenuItemTag in our C API.  This isn't ideal, but we need to retain binary compatibility.
+    
+    * platform/ContextMenuItem.h:
+    
+    Source/WebKit:
+    
+    * Shared/API/c/WKContextMenuItem.cpp:
+    Add a bunch of static_asserts to verify that our binary values correspond to each other and don't change.
+    * Shared/API/c/WKContextMenuItemTypes.h:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-19  Alex Christensen  <achristen...@webkit.org>
+
+            REGRESSION(r269865) Mail's context menu when right clicking on a link does not contain correct entries
+            https://bugs.webkit.org/show_bug.cgi?id=220745
+
+            Reviewed by Tim Horton.
+
+            * Shared/API/c/WKContextMenuItem.cpp:
+            Add a bunch of static_asserts to verify that our binary values correspond to each other and don't change.
+            * Shared/API/c/WKContextMenuItemTypes.h:
+
 2021-01-14  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r271477. rdar://problem/73204264

Modified: branches/safari-611.1.10.1-branch/Source/WebKit/Shared/API/c/WKContextMenuItem.cpp (271707 => 271708)


--- branches/safari-611.1.10.1-branch/Source/WebKit/Shared/API/c/WKContextMenuItem.cpp	2021-01-21 20:11:03 UTC (rev 271707)
+++ branches/safari-611.1.10.1-branch/Source/WebKit/Shared/API/c/WKContextMenuItem.cpp	2021-01-21 20:13:11 UTC (rev 271708)
@@ -166,3 +166,97 @@
     UNUSED_PARAM(userDataRef);
 #endif
 }
+
+#if PLATFORM(COCOA)
+
+#define STATIC_ASSERT_EQUALS(a, b, c) \
+    static_assert(a == b, ""); \
+    static_assert(a == WebCore::c, "");
+
+// These values must remain equal to retain binary compatibility.
+STATIC_ASSERT_EQUALS(0, kWKContextMenuItemTagNoAction, ContextMenuItemTagNoAction);
+STATIC_ASSERT_EQUALS(1, kWKContextMenuItemTagOpenLinkInNewWindow, ContextMenuItemTagOpenLinkInNewWindow);
+STATIC_ASSERT_EQUALS(2, kWKContextMenuItemTagDownloadLinkToDisk, ContextMenuItemTagDownloadLinkToDisk);
+STATIC_ASSERT_EQUALS(3, kWKContextMenuItemTagCopyLinkToClipboard, ContextMenuItemTagCopyLinkToClipboard);
+STATIC_ASSERT_EQUALS(4, kWKContextMenuItemTagOpenImageInNewWindow, ContextMenuItemTagOpenImageInNewWindow);
+STATIC_ASSERT_EQUALS(5, kWKContextMenuItemTagDownloadImageToDisk, ContextMenuItemTagDownloadImageToDisk);
+STATIC_ASSERT_EQUALS(6, kWKContextMenuItemTagCopyImageToClipboard, ContextMenuItemTagCopyImageToClipboard);
+STATIC_ASSERT_EQUALS(7, kWKContextMenuItemTagOpenFrameInNewWindow, ContextMenuItemTagOpenFrameInNewWindow);
+STATIC_ASSERT_EQUALS(8, kWKContextMenuItemTagCopy, ContextMenuItemTagCopy);
+STATIC_ASSERT_EQUALS(9, kWKContextMenuItemTagGoBack, ContextMenuItemTagGoBack);
+STATIC_ASSERT_EQUALS(10, kWKContextMenuItemTagGoForward, ContextMenuItemTagGoForward);
+STATIC_ASSERT_EQUALS(11, kWKContextMenuItemTagStop, ContextMenuItemTagStop);
+STATIC_ASSERT_EQUALS(12, kWKContextMenuItemTagReload, ContextMenuItemTagReload);
+STATIC_ASSERT_EQUALS(13, kWKContextMenuItemTagCut, ContextMenuItemTagCut);
+STATIC_ASSERT_EQUALS(14, kWKContextMenuItemTagPaste, ContextMenuItemTagPaste);
+STATIC_ASSERT_EQUALS(15, kWKContextMenuItemTagSpellingGuess, ContextMenuItemTagSpellingGuess);
+STATIC_ASSERT_EQUALS(16, kWKContextMenuItemTagNoGuessesFound, ContextMenuItemTagNoGuessesFound);
+STATIC_ASSERT_EQUALS(17, kWKContextMenuItemTagIgnoreSpelling, ContextMenuItemTagIgnoreSpelling);
+STATIC_ASSERT_EQUALS(18, kWKContextMenuItemTagLearnSpelling, ContextMenuItemTagLearnSpelling);
+STATIC_ASSERT_EQUALS(19, kWKContextMenuItemTagOther, ContextMenuItemTagOther);
+STATIC_ASSERT_EQUALS(20, kWKContextMenuItemTagSearchInSpotlight, ContextMenuItemTagSearchInSpotlight);
+STATIC_ASSERT_EQUALS(21, kWKContextMenuItemTagSearchWeb, ContextMenuItemTagSearchWeb);
+STATIC_ASSERT_EQUALS(22, kWKContextMenuItemTagLookUpInDictionary, ContextMenuItemTagLookUpInDictionary);
+STATIC_ASSERT_EQUALS(23, kWKContextMenuItemTagOpenWithDefaultApplication, ContextMenuItemTagOpenWithDefaultApplication);
+STATIC_ASSERT_EQUALS(24, kWKContextMenuItemTagPDFActualSize, ContextMenuItemPDFActualSize);
+STATIC_ASSERT_EQUALS(25, kWKContextMenuItemTagPDFZoomIn, ContextMenuItemPDFZoomIn);
+STATIC_ASSERT_EQUALS(26, kWKContextMenuItemTagPDFZoomOut, ContextMenuItemPDFZoomOut);
+STATIC_ASSERT_EQUALS(27, kWKContextMenuItemTagPDFAutoSize, ContextMenuItemPDFAutoSize);
+STATIC_ASSERT_EQUALS(28, kWKContextMenuItemTagPDFSinglePage, ContextMenuItemPDFSinglePage);
+STATIC_ASSERT_EQUALS(29, kWKContextMenuItemTagPDFFacingPages, ContextMenuItemPDFFacingPages);
+STATIC_ASSERT_EQUALS(30, kWKContextMenuItemTagPDFContinuous, ContextMenuItemPDFContinuous);
+STATIC_ASSERT_EQUALS(31, kWKContextMenuItemTagPDFNextPage, ContextMenuItemPDFNextPage);
+STATIC_ASSERT_EQUALS(32, kWKContextMenuItemTagPDFPreviousPage, ContextMenuItemPDFPreviousPage);
+STATIC_ASSERT_EQUALS(33, kWKContextMenuItemTagOpenLink, ContextMenuItemTagOpenLink);
+STATIC_ASSERT_EQUALS(34, kWKContextMenuItemTagIgnoreGrammar, ContextMenuItemTagIgnoreGrammar);
+STATIC_ASSERT_EQUALS(35, kWKContextMenuItemTagSpellingMenu, ContextMenuItemTagSpellingMenu);
+STATIC_ASSERT_EQUALS(36, kWKContextMenuItemTagShowSpellingPanel, ContextMenuItemTagShowSpellingPanel);
+STATIC_ASSERT_EQUALS(37, kWKContextMenuItemTagCheckSpelling, ContextMenuItemTagCheckSpelling);
+STATIC_ASSERT_EQUALS(38, kWKContextMenuItemTagCheckSpellingWhileTyping, ContextMenuItemTagCheckSpellingWhileTyping);
+STATIC_ASSERT_EQUALS(39, kWKContextMenuItemTagCheckGrammarWithSpelling, ContextMenuItemTagCheckGrammarWithSpelling);
+STATIC_ASSERT_EQUALS(40, kWKContextMenuItemTagFontMenu, ContextMenuItemTagFontMenu);
+STATIC_ASSERT_EQUALS(41, kWKContextMenuItemTagShowFonts, ContextMenuItemTagShowFonts);
+STATIC_ASSERT_EQUALS(42, kWKContextMenuItemTagBold, ContextMenuItemTagBold);
+STATIC_ASSERT_EQUALS(43, kWKContextMenuItemTagItalic, ContextMenuItemTagItalic);
+STATIC_ASSERT_EQUALS(44, kWKContextMenuItemTagUnderline, ContextMenuItemTagUnderline);
+STATIC_ASSERT_EQUALS(45, kWKContextMenuItemTagOutline, ContextMenuItemTagOutline);
+STATIC_ASSERT_EQUALS(46, kWKContextMenuItemTagStyles, ContextMenuItemTagStyles);
+STATIC_ASSERT_EQUALS(47, kWKContextMenuItemTagShowColors, ContextMenuItemTagShowColors);
+STATIC_ASSERT_EQUALS(48, kWKContextMenuItemTagSpeechMenu, ContextMenuItemTagSpeechMenu);
+STATIC_ASSERT_EQUALS(49, kWKContextMenuItemTagStartSpeaking, ContextMenuItemTagStartSpeaking);
+STATIC_ASSERT_EQUALS(50, kWKContextMenuItemTagStopSpeaking, ContextMenuItemTagStopSpeaking);
+STATIC_ASSERT_EQUALS(51, kWKContextMenuItemTagWritingDirectionMenu, ContextMenuItemTagWritingDirectionMenu);
+STATIC_ASSERT_EQUALS(52, kWKContextMenuItemTagDefaultDirection, ContextMenuItemTagDefaultDirection);
+STATIC_ASSERT_EQUALS(53, kWKContextMenuItemTagLeftToRight, ContextMenuItemTagLeftToRight);
+STATIC_ASSERT_EQUALS(54, kWKContextMenuItemTagRightToLeft, ContextMenuItemTagRightToLeft);
+STATIC_ASSERT_EQUALS(55, kWKContextMenuItemTagPDFSinglePageScrolling, ContextMenuItemTagPDFSinglePageScrolling);
+STATIC_ASSERT_EQUALS(56, kWKContextMenuItemTagPDFFacingPagesScrolling, ContextMenuItemTagPDFFacingPagesScrolling);
+STATIC_ASSERT_EQUALS(57, kWKContextMenuItemTagInspectElement, ContextMenuItemTagInspectElement);
+STATIC_ASSERT_EQUALS(58, kWKContextMenuItemTagTextDirectionMenu, ContextMenuItemTagTextDirectionMenu);
+STATIC_ASSERT_EQUALS(59, kWKContextMenuItemTagTextDirectionDefault, ContextMenuItemTagTextDirectionDefault);
+STATIC_ASSERT_EQUALS(60, kWKContextMenuItemTagTextDirectionLeftToRight, ContextMenuItemTagTextDirectionLeftToRight);
+STATIC_ASSERT_EQUALS(61, kWKContextMenuItemTagTextDirectionRightToLeft, ContextMenuItemTagTextDirectionRightToLeft);
+STATIC_ASSERT_EQUALS(62, kWKContextMenuItemTagCorrectSpellingAutomatically, ContextMenuItemTagCorrectSpellingAutomatically);
+STATIC_ASSERT_EQUALS(63, kWKContextMenuItemTagSubstitutionsMenu, ContextMenuItemTagSubstitutionsMenu);
+STATIC_ASSERT_EQUALS(64, kWKContextMenuItemTagShowSubstitutions, ContextMenuItemTagShowSubstitutions);
+STATIC_ASSERT_EQUALS(65, kWKContextMenuItemTagSmartCopyPaste, ContextMenuItemTagSmartCopyPaste);
+STATIC_ASSERT_EQUALS(66, kWKContextMenuItemTagSmartQuotes, ContextMenuItemTagSmartQuotes);
+STATIC_ASSERT_EQUALS(67, kWKContextMenuItemTagSmartDashes, ContextMenuItemTagSmartDashes);
+STATIC_ASSERT_EQUALS(68, kWKContextMenuItemTagSmartLinks, ContextMenuItemTagSmartLinks);
+STATIC_ASSERT_EQUALS(69, kWKContextMenuItemTagTextReplacement, ContextMenuItemTagTextReplacement);
+STATIC_ASSERT_EQUALS(70, kWKContextMenuItemTagTransformationsMenu, ContextMenuItemTagTransformationsMenu);
+STATIC_ASSERT_EQUALS(71, kWKContextMenuItemTagMakeUpperCase, ContextMenuItemTagMakeUpperCase);
+STATIC_ASSERT_EQUALS(72, kWKContextMenuItemTagMakeLowerCase, ContextMenuItemTagMakeLowerCase);
+STATIC_ASSERT_EQUALS(73, kWKContextMenuItemTagCapitalize, ContextMenuItemTagCapitalize);
+STATIC_ASSERT_EQUALS(74, kWKContextMenuItemTagChangeBack, ContextMenuItemTagChangeBack);
+STATIC_ASSERT_EQUALS(75, kWKContextMenuItemTagOpenMediaInNewWindow, ContextMenuItemTagOpenMediaInNewWindow);
+STATIC_ASSERT_EQUALS(76, kWKContextMenuItemTagDownloadMediaToDisk, ContextMenuItemTagDownloadMediaToDisk);
+STATIC_ASSERT_EQUALS(77, kWKContextMenuItemTagCopyMediaLinkToClipboard, ContextMenuItemTagCopyMediaLinkToClipboard);
+STATIC_ASSERT_EQUALS(78, kWKContextMenuItemTagToggleMediaControls, ContextMenuItemTagToggleMediaControls);
+STATIC_ASSERT_EQUALS(79, kWKContextMenuItemTagToggleMediaLoop, ContextMenuItemTagToggleMediaLoop);
+STATIC_ASSERT_EQUALS(80, kWKContextMenuItemTagEnterVideoFullscreen, ContextMenuItemTagEnterVideoFullscreen);
+STATIC_ASSERT_EQUALS(81, kWKContextMenuItemTagMediaPlayPause, ContextMenuItemTagMediaPlayPause);
+STATIC_ASSERT_EQUALS(82, kWKContextMenuItemTagMediaMute, ContextMenuItemTagMediaMute);
+STATIC_ASSERT_EQUALS(83, kWKContextMenuItemTagDictationAlternative, ContextMenuItemTagDictationAlternative);
+
+#endif // PLATFORM(COCOA)

Modified: branches/safari-611.1.10.1-branch/Source/WebKit/Shared/API/c/WKContextMenuItemTypes.h (271707 => 271708)


--- branches/safari-611.1.10.1-branch/Source/WebKit/Shared/API/c/WKContextMenuItemTypes.h	2021-01-21 20:11:03 UTC (rev 271707)
+++ branches/safari-611.1.10.1-branch/Source/WebKit/Shared/API/c/WKContextMenuItemTypes.h	2021-01-21 20:13:11 UTC (rev 271708)
@@ -56,8 +56,6 @@
     kWKContextMenuItemTagSearchInSpotlight,
     kWKContextMenuItemTagSearchWeb,
     kWKContextMenuItemTagLookUpInDictionary,
-    kWKContextMenuItemTagAddHighlightToCurrentGroup,
-    kWKContextMenuItemTagAddHighlightToNewGroup,
     kWKContextMenuItemTagOpenWithDefaultApplication,
     kWKContextMenuItemTagPDFActualSize,
     kWKContextMenuItemTagPDFZoomIn,
@@ -125,6 +123,8 @@
     kWKContextMenuItemTagToggleVideoFullscreen,
     kWKContextMenuItemTagShareMenu,
     kWKContextMenuItemTagToggleVideoEnhancedFullscreen,
+    kWKContextMenuItemTagAddHighlightToCurrentGroup,
+    kWKContextMenuItemTagAddHighlightToNewGroup,
     kWKContextMenuItemBaseApplicationTag = 10000
 };
 typedef uint32_t WKContextMenuItemTag;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to