Changeset 198900 in webkit


Ignore:
Timestamp:
Mar 31, 2016 11:23:29 AM (8 years ago)
Author:
adachan@apple.com
Message:

Add the new "toggle enhanced fullscreen" context menu item to the video context menu on supporting platforms.
https://bugs.webkit.org/show_bug.cgi?id=156031

Reviewed by Eric Carlson.

Source/WebCore:

  • page/ContextMenuController.cpp:

(WebCore::ContextMenuController::contextMenuItemSelected):
Handle the selection of the context menu item.
(WebCore::ContextMenuController::populate):
Add this menu item on Mac.
(WebCore::ContextMenuController::checkOrEnableIfNeeded):
Set the menu item's title depending on the current enhanced fullscreen state
and enable this menu item if supported.

  • platform/ContextMenuItem.h:

Define the new tag for this menu item.

  • platform/LocalizedStrings.cpp:

(WebCore::contextMenuItemTagEnterVideoEnhancedFullscreen):
(WebCore::contextMenuItemTagExitVideoEnhancedFullscreen):

  • platform/LocalizedStrings.h:
  • rendering/HitTestResult.cpp:

(WebCore::HitTestResult::mediaSupportsEnhancedFullscreen):
(WebCore::HitTestResult::mediaIsInEnhancedFullscreen):
(WebCore::HitTestResult::toggleEnhancedFullscreenForVideo):

  • rendering/HitTestResult.h:

Source/WebKit/mac:

  • WebView/WebHTMLView.mm:

(toAction):
(toTag):

  • WebView/WebUIDelegatePrivate.h:

Source/WebKit2:

  • Shared/API/c/WKContextMenuItemTypes.h:
  • Shared/API/c/WKSharedAPICast.h:

(WebKit::toAPI):
(WebKit::toImpl):

Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r198895 r198900  
     12016-03-30  Ada Chan  <adachan@apple.com>
     2
     3        Add the new "toggle enhanced fullscreen" context menu item to the video context menu on supporting platforms.
     4        https://bugs.webkit.org/show_bug.cgi?id=156031
     5
     6        Reviewed by Eric Carlson.
     7
     8        * page/ContextMenuController.cpp:
     9        (WebCore::ContextMenuController::contextMenuItemSelected):
     10        Handle the selection of the context menu item.
     11        (WebCore::ContextMenuController::populate):
     12        Add this menu item on Mac.
     13        (WebCore::ContextMenuController::checkOrEnableIfNeeded):
     14        Set the menu item's title depending on the current enhanced fullscreen state
     15        and enable this menu item if supported.
     16
     17        * platform/ContextMenuItem.h:
     18        Define the new tag for this menu item.
     19
     20        * platform/LocalizedStrings.cpp:
     21        (WebCore::contextMenuItemTagEnterVideoEnhancedFullscreen):
     22        (WebCore::contextMenuItemTagExitVideoEnhancedFullscreen):
     23        * platform/LocalizedStrings.h:
     24
     25        * rendering/HitTestResult.cpp:
     26        (WebCore::HitTestResult::mediaSupportsEnhancedFullscreen):
     27        (WebCore::HitTestResult::mediaIsInEnhancedFullscreen):
     28        (WebCore::HitTestResult::toggleEnhancedFullscreenForVideo):
     29        * rendering/HitTestResult.h:
     30
    1312016-03-31  Nan Wang  <n_wang@apple.com>
    232
  • trunk/Source/WebCore/page/ContextMenuController.cpp

    r194305 r198900  
    280280        m_context.hitTestResult().toggleMediaMuteState();
    281281        break;
     282    case ContextMenuItemTagToggleVideoEnhancedFullscreen:
     283        m_context.hitTestResult().toggleEnhancedFullscreenForVideo();
     284        break;
    282285    case ContextMenuItemTagOpenFrameInNewWindow: {
    283286        DocumentLoader* loader = frame->loader().documentLoader();
     
    767770    ContextMenuItem ToggleVideoFullscreen(ActionType, ContextMenuItemTagToggleVideoFullscreen,
    768771        contextMenuItemTagEnterVideoFullscreen());
     772#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
     773    ContextMenuItem ToggleVideoEnhancedFullscreen(ActionType, ContextMenuItemTagToggleVideoEnhancedFullscreen, contextMenuItemTagEnterVideoEnhancedFullscreen());
     774#endif
    769775#if PLATFORM(COCOA)
    770776    ContextMenuItem SearchSpotlightItem(ActionType, ContextMenuItemTagSearchInSpotlight,
     
    863869#else
    864870            appendItem(EnterVideoFullscreen, m_contextMenu.get());
     871#endif
     872#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
     873            appendItem(ToggleVideoEnhancedFullscreen, m_contextMenu.get());
    865874#endif
    866875            appendItem(*separatorItem(), m_contextMenu.get());
     
    13631372            shouldEnable = m_context.hitTestResult().mediaSupportsFullscreen();
    13641373            break;
     1374        case ContextMenuItemTagToggleVideoEnhancedFullscreen:
     1375#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
     1376            item.setTitle(m_context.hitTestResult().mediaIsInEnhancedFullscreen() ? contextMenuItemTagExitVideoEnhancedFullscreen() : contextMenuItemTagEnterVideoEnhancedFullscreen());
     1377#endif
     1378            shouldEnable = m_context.hitTestResult().mediaSupportsEnhancedFullscreen();
     1379            break;
    13651380        case ContextMenuItemTagOpenFrameInNewWindow:
    13661381        case ContextMenuItemTagSpellingGuess:
  • trunk/Source/WebCore/platform/ContextMenuItem.h

    r192394 r198900  
    147147    ContextMenuItemTagDictationAlternative,
    148148    ContextMenuItemTagToggleVideoFullscreen,
    149     ContextMenuItemTagShareMenu,
     149    ContextMenuItemTagShareMenu,
     150    ContextMenuItemTagToggleVideoEnhancedFullscreen,
    150151    ContextMenuItemBaseCustomTag = 5000,
    151152    ContextMenuItemLastCustomTag = 5999,
  • trunk/Source/WebCore/platform/LocalizedStrings.cpp

    r198381 r198900  
    507507    return WEB_UI_STRING("Exit Full Screen", "Video Exit Fullscreen context menu item");
    508508}
     509
     510#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
     511
     512#if USE(APPLE_INTERNAL_SDK)
     513#include <WebKitAdditions/ContextMenuLocalizedStringsAdditions.cpp>
     514#else
     515String contextMenuItemTagEnterVideoEnhancedFullscreen()
     516{
     517    return { };
     518}
     519
     520String contextMenuItemTagExitVideoEnhancedFullscreen()
     521{
     522    return { };
     523}
     524#endif
     525
     526#endif
    509527
    510528String contextMenuItemTagMediaPlay()
  • trunk/Source/WebCore/platform/LocalizedStrings.h

    r198381 r198900  
    140140    String contextMenuItemTagEnterVideoFullscreen();
    141141    String contextMenuItemTagExitVideoFullscreen();
     142#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
     143    String contextMenuItemTagEnterVideoEnhancedFullscreen();
     144    String contextMenuItemTagExitVideoEnhancedFullscreen();
     145#endif
    142146    String contextMenuItemTagMediaPlay();
    143147    String contextMenuItemTagMediaPause();
  • trunk/Source/WebCore/rendering/HitTestResult.cpp

    r195487 r198900  
    774774}
    775775
     776#if USE(APPLE_INTERNAL_SDK)
     777#include <WebKitAdditions/HitTestResultAdditions.cpp>
     778#else
     779bool HitTestResult::mediaSupportsEnhancedFullscreen() const
     780{
     781    return false;
     782}
     783
     784bool HitTestResult::mediaIsInEnhancedFullscreen() const
     785{
     786    return false;
     787}
     788
     789void HitTestResult::toggleEnhancedFullscreenForVideo() const
     790{
     791}
     792#endif
     793
    776794} // namespace WebCore
  • trunk/Source/WebCore/rendering/HitTestResult.h

    r182957 r198900  
    128128    bool mediaMuted() const;
    129129    void toggleMediaMuteState() const;
     130    bool mediaSupportsEnhancedFullscreen() const;
     131    bool mediaIsInEnhancedFullscreen() const;
     132    void toggleEnhancedFullscreenForVideo() const;
     133
    130134    WEBCORE_EXPORT bool isDownloadableMedia() const;
    131135    WEBCORE_EXPORT bool isOverTextInsideFormControlElement() const;
  • trunk/Source/WebKit/mac/ChangeLog

    r198655 r198900  
     12016-03-30  Ada Chan  <adachan@apple.com>
     2
     3        Add the new "toggle enhanced fullscreen" context menu item to the video context menu on supporting platforms.
     4        https://bugs.webkit.org/show_bug.cgi?id=156031
     5
     6        Reviewed by Eric Carlson.
     7
     8        * WebView/WebHTMLView.mm:
     9        (toAction):
     10        (toTag):
     11        * WebView/WebUIDelegatePrivate.h:
     12
    1132016-03-24  Said Abou-Hallawa  <sabouhallawa@apple,com>
    214
  • trunk/Source/WebKit/mac/WebView/WebHTMLView.mm

    r198547 r198900  
    348348    case WebMenuItemTagEnterVideoFullscreen:
    349349        return ContextMenuItemTagEnterVideoFullscreen;
     350    case WebMenuItemTagToggleVideoEnhancedFullscreen:
     351        return ContextMenuItemTagToggleVideoEnhancedFullscreen;
    350352    case WebMenuItemTagMediaPlayPause:
    351353        return ContextMenuItemTagMediaPlayPause;
     
    534536    case ContextMenuItemTagShareMenu:
    535537        return WebMenuItemTagShareMenu;
     538    case ContextMenuItemTagToggleVideoEnhancedFullscreen:
     539        return WebMenuItemTagToggleVideoEnhancedFullscreen;
    536540
    537541    case ContextMenuItemBaseCustomTag ... ContextMenuItemLastCustomTag:
  • trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h

    r193944 r198900  
    103103    WebMenuItemTagToggleVideoFullscreen,
    104104    WebMenuItemTagShareMenu,
     105    WebMenuItemTagToggleVideoEnhancedFullscreen,
    105106};
    106107
  • trunk/Source/WebKit2/ChangeLog

    r198896 r198900  
     12016-03-30  Ada Chan  <adachan@apple.com>
     2
     3        Add the new "toggle enhanced fullscreen" context menu item to the video context menu on supporting platforms.
     4        https://bugs.webkit.org/show_bug.cgi?id=156031
     5
     6        Reviewed by Eric Carlson.
     7
     8        * Shared/API/c/WKContextMenuItemTypes.h:
     9        * Shared/API/c/WKSharedAPICast.h:
     10        (WebKit::toAPI):
     11        (WebKit::toImpl):
     12
    1132016-03-31  Brent Fulgham  <bfulgham@apple.com>
    214
  • trunk/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h

    r182303 r198900  
    123123    kWKContextMenuItemTagToggleVideoFullscreen,
    124124    kWKContextMenuItemTagShareMenu,
     125    kWKContextMenuItemTagToggleVideoEnhancedFullscreen,
    125126    kWKContextMenuItemBaseApplicationTag = 10000
    126127};
  • trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h

    r194496 r198900  
    473473    case WebCore::ContextMenuItemTagEnterVideoFullscreen:
    474474        return kWKContextMenuItemTagEnterVideoFullscreen;
     475    case WebCore::ContextMenuItemTagToggleVideoEnhancedFullscreen:
     476        return kWKContextMenuItemTagToggleVideoEnhancedFullscreen;
    475477    case WebCore::ContextMenuItemTagMediaPlayPause:
    476478        return kWKContextMenuItemTagMediaPlayPause;
     
    665667    case kWKContextMenuItemTagEnterVideoFullscreen:
    666668        return WebCore::ContextMenuItemTagEnterVideoFullscreen;
     669    case kWKContextMenuItemTagToggleVideoEnhancedFullscreen:
     670        return WebCore::ContextMenuItemTagToggleVideoEnhancedFullscreen;
    667671    case kWKContextMenuItemTagMediaPlayPause:
    668672        return WebCore::ContextMenuItemTagMediaPlayPause;
Note: See TracChangeset for help on using the changeset viewer.