Changeset 122520 in webkit


Ignore:
Timestamp:
Jul 12, 2012 3:58:08 PM (12 years ago)
Author:
timothy@apple.com
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.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r122512 r122520  
     12012-07-12  Timothy Hatcher  <timothy@apple.com>
     2
     3        Make the "Inspect Element" context menu item appear in nightly builds again.
     4
     5        https://webkit.org/b/89323
     6
     7        Reviewed by Anders Carlsson.
     8
     9        * Shared/API/c/WKContextMenuItem.cpp:
     10        (compatibleContextMenuItemTag): Added. Checks for the specific version of Safari 6 that needs the
     11        tag fixed up to match values it expects.
     12        (WKContextMenuItemGetTag): On Mac platforms call compatibleContextMenuItemTag to fix up the tag
     13        before returning it.
     14        * Shared/API/c/WKContextMenuItemTypes.h: Fix the order of the WKContextMenuItemTag enum
     15        to be binary compatible with older versions of WebKit2.
     16
    1172012-07-12  Thiago Marcos P. Santos  <thiago.santos@intel.com>
    218
  • trunk/Source/WebKit2/Shared/API/c/WKContextMenuItem.cpp

    r114367 r122520  
    3232#include "WKAPICast.h"
    3333#include "WKContextMenuItemTypes.h"
     34
     35#if PLATFORM(MAC)
     36#import <mach-o/dyld.h>
     37#endif
    3438
    3539using namespace WebCore;
     
    8185}
    8286
     87#if PLATFORM(MAC)
     88static WKContextMenuItemTag compatibleContextMenuItemTag(WKContextMenuItemTag tag)
     89{
     90    static bool needsWorkaround = ^bool {
     91        const int32_t safariFrameworkVersionWithIncompatibleContextMenuItemTags = 0x02181900; // 536.25.0 (Safari 6.0)
     92        return NSVersionOfRunTimeLibrary("Safari") == safariFrameworkVersionWithIncompatibleContextMenuItemTags;
     93    }();
     94
     95    if (!needsWorkaround)
     96        return tag;
     97
     98    // kWKContextMenuItemTagDictationAlternative was inserted before kWKContextMenuItemTagInspectElement.
     99    // DictationAlternative is now at the end like it should have been. To be compatible we need to return
     100    // InspectElement for DictationAlternative and shift InspectElement and after by one.
     101    if (tag == kWKContextMenuItemTagDictationAlternative)
     102        return kWKContextMenuItemTagInspectElement;
     103    if (tag >= kWKContextMenuItemTagInspectElement && tag < kWKContextMenuItemBaseApplicationTag)
     104        return tag + 1;
     105    return tag;
     106}
     107#endif
     108
    83109WKContextMenuItemTag WKContextMenuItemGetTag(WKContextMenuItemRef itemRef)
    84110{
    85111#if ENABLE(CONTEXT_MENUS)
     112#if PLATFORM(MAC)
     113    return compatibleContextMenuItemTag(toAPI(toImpl(itemRef)->data()->action()));
     114#else
    86115    return toAPI(toImpl(itemRef)->data()->action());
     116#endif
    87117#else
    88118    return toAPI(ContextMenuItemTagNoAction);
  • trunk/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h

    r120357 r122520  
    8989    kWKContextMenuItemTagPDFSinglePageScrolling,
    9090    kWKContextMenuItemTagPDFFacingPagesScrolling,
    91     kWKContextMenuItemTagDictationAlternative,
    9291    kWKContextMenuItemTagInspectElement,
    9392    kWKContextMenuItemTagTextDirectionMenu,
     
    115114    kWKContextMenuItemTagMediaPlayPause,
    116115    kWKContextMenuItemTagMediaMute,
     116    kWKContextMenuItemTagDictationAlternative,
    117117    kWKContextMenuItemBaseApplicationTag = 10000
    118118};
Note: See TracChangeset for help on using the changeset viewer.