Title: [124136] branches/safari-536.26-branch/Source/WebKit2

Diff

Modified: branches/safari-536.26-branch/Source/WebKit2/ChangeLog (124135 => 124136)


--- branches/safari-536.26-branch/Source/WebKit2/ChangeLog	2012-07-31 01:14:15 UTC (rev 124135)
+++ branches/safari-536.26-branch/Source/WebKit2/ChangeLog	2012-07-31 01:21:45 UTC (rev 124136)
@@ -1,5 +1,25 @@
 2012-07-30  Lucas Forschler  <[email protected]>
 
+    Merge 122520
+
+    2012-07-12  Timothy Hatcher  <[email protected]>
+
+            Make the "Inspect Element" context menu item appear in nightly builds again.
+
+            https://webkit.org/b/89323
+
+            Reviewed by Anders Carlsson.
+
+            * Shared/API/c/WKContextMenuItem.cpp:
+            (compatibleContextMenuItemTag): Added. Checks for the specific version of Safari 6 that needs the
+            tag fixed up to match values it expects.
+            (WKContextMenuItemGetTag): On Mac platforms call compatibleContextMenuItemTag to fix up the tag
+            before returning it.
+            * Shared/API/c/WKContextMenuItemTypes.h: Fix the order of the WKContextMenuItemTag enum
+            to be binary compatible with older versions of WebKit2.
+
+2012-07-30  Lucas Forschler  <[email protected]>
+
     Merge 121482
 
     2012-06-28  John Sullivan  <[email protected]>

Modified: branches/safari-536.26-branch/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp (124135 => 124136)


--- branches/safari-536.26-branch/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp	2012-07-31 01:14:15 UTC (rev 124135)
+++ branches/safari-536.26-branch/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp	2012-07-31 01:21:45 UTC (rev 124136)
@@ -32,6 +32,10 @@
 #include "WKAPICast.h"
 #include "WKContextMenuItemTypes.h"
 
+#if PLATFORM(MAC)
+#import <mach-o/dyld.h>
+#endif
+
 using namespace WebCore;
 using namespace WebKit;
 
@@ -80,10 +84,36 @@
 #endif
 }
 
+#if PLATFORM(MAC)
+static WKContextMenuItemTag compatibleContextMenuItemTag(WKContextMenuItemTag tag)
+{
+    static bool needsWorkaround = ^bool {
+        const int32_t safariFrameworkVersionWithIncompatibleContextMenuItemTags = 0x02181900; // 536.25.0 (Safari 6.0)
+        return NSVersionOfRunTimeLibrary("Safari") == safariFrameworkVersionWithIncompatibleContextMenuItemTags;
+    }();
+
+    if (!needsWorkaround)
+        return tag;
+
+    // kWKContextMenuItemTagDictationAlternative was inserted before kWKContextMenuItemTagInspectElement.
+    // DictationAlternative is now at the end like it should have been. To be compatible we need to return
+    // InspectElement for DictationAlternative and shift InspectElement and after by one.
+    if (tag == kWKContextMenuItemTagDictationAlternative)
+        return kWKContextMenuItemTagInspectElement;
+    if (tag >= kWKContextMenuItemTagInspectElement && tag < kWKContextMenuItemBaseApplicationTag)
+        return tag + 1;
+    return tag;
+}
+#endif
+
 WKContextMenuItemTag WKContextMenuItemGetTag(WKContextMenuItemRef itemRef)
 {
 #if ENABLE(CONTEXT_MENUS)
+#if PLATFORM(MAC)
+    return compatibleContextMenuItemTag(toAPI(toImpl(itemRef)->data()->action()));
+#else
     return toAPI(toImpl(itemRef)->data()->action());
+#endif
 #else
     return toAPI(ContextMenuItemTagNoAction);
 #endif

Modified: branches/safari-536.26-branch/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h (124135 => 124136)


--- branches/safari-536.26-branch/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h	2012-07-31 01:14:15 UTC (rev 124135)
+++ branches/safari-536.26-branch/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h	2012-07-31 01:21:45 UTC (rev 124136)
@@ -88,7 +88,6 @@
     kWKContextMenuItemTagRightToLeft,
     kWKContextMenuItemTagPDFSinglePageScrolling,
     kWKContextMenuItemTagPDFFacingPagesScrolling,
-    kWKContextMenuItemTagDictationAlternative,
     kWKContextMenuItemTagInspectElement,
     kWKContextMenuItemTagTextDirectionMenu,
     kWKContextMenuItemTagTextDirectionDefault,
@@ -114,6 +113,7 @@
     kWKContextMenuItemTagEnterVideoFullscreen,
     kWKContextMenuItemTagMediaPlayPause,
     kWKContextMenuItemTagMediaMute,
+    kWKContextMenuItemTagDictationAlternative,
     kWKContextMenuItemBaseApplicationTag = 10000
 };
 typedef uint32_t WKContextMenuItemTag;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to