Title: [122520] trunk/Source/WebKit2
- Revision
- 122520
- Author
- [email protected]
- Date
- 2012-07-12 15:58:08 -0700 (Thu, 12 Jul 2012)
Log Message
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.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (122519 => 122520)
--- trunk/Source/WebKit2/ChangeLog 2012-07-12 22:43:44 UTC (rev 122519)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-12 22:58:08 UTC (rev 122520)
@@ -1,3 +1,19 @@
+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-12 Thiago Marcos P. Santos <[email protected]>
[EFL] Port the test framework to WebKit 2
Modified: trunk/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp (122519 => 122520)
--- trunk/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp 2012-07-12 22:43:44 UTC (rev 122519)
+++ trunk/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp 2012-07-12 22:58:08 UTC (rev 122520)
@@ -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: trunk/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h (122519 => 122520)
--- trunk/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h 2012-07-12 22:43:44 UTC (rev 122519)
+++ trunk/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h 2012-07-12 22:58:08 UTC (rev 122520)
@@ -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