Title: [198900] trunk/Source
Revision
198900
Author
[email protected]
Date
2016-03-31 11:23:29 -0700 (Thu, 31 Mar 2016)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (198899 => 198900)


--- trunk/Source/WebCore/ChangeLog	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebCore/ChangeLog	2016-03-31 18:23:29 UTC (rev 198900)
@@ -1,3 +1,33 @@
+2016-03-30  Ada Chan  <[email protected]>
+
+        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.
+
+        * 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:
+
 2016-03-31  Nan Wang  <[email protected]>
 
         AX: aria-hidden=false causes video fallback content to be exposed to AX API

Modified: trunk/Source/WebCore/page/ContextMenuController.cpp (198899 => 198900)


--- trunk/Source/WebCore/page/ContextMenuController.cpp	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebCore/page/ContextMenuController.cpp	2016-03-31 18:23:29 UTC (rev 198900)
@@ -279,6 +279,9 @@
     case ContextMenuItemTagMediaMute:
         m_context.hitTestResult().toggleMediaMuteState();
         break;
+    case ContextMenuItemTagToggleVideoEnhancedFullscreen:
+        m_context.hitTestResult().toggleEnhancedFullscreenForVideo();
+        break;
     case ContextMenuItemTagOpenFrameInNewWindow: {
         DocumentLoader* loader = frame->loader().documentLoader();
         if (!loader->unreachableURL().isEmpty())
@@ -766,6 +769,9 @@
         contextMenuItemTagEnterVideoFullscreen());
     ContextMenuItem ToggleVideoFullscreen(ActionType, ContextMenuItemTagToggleVideoFullscreen,
         contextMenuItemTagEnterVideoFullscreen());
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+    ContextMenuItem ToggleVideoEnhancedFullscreen(ActionType, ContextMenuItemTagToggleVideoEnhancedFullscreen, contextMenuItemTagEnterVideoEnhancedFullscreen());
+#endif
 #if PLATFORM(COCOA)
     ContextMenuItem SearchSpotlightItem(ActionType, ContextMenuItemTagSearchInSpotlight, 
         contextMenuItemTagSearchInSpotlight());
@@ -863,6 +869,9 @@
 #else
             appendItem(EnterVideoFullscreen, m_contextMenu.get());
 #endif
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+            appendItem(ToggleVideoEnhancedFullscreen, m_contextMenu.get());
+#endif
             appendItem(*separatorItem(), m_contextMenu.get());
             appendItem(CopyMediaLinkItem, m_contextMenu.get());
             appendItem(OpenMediaInNewWindowItem, m_contextMenu.get());
@@ -1362,6 +1371,12 @@
         case ContextMenuItemTagEnterVideoFullscreen:
             shouldEnable = m_context.hitTestResult().mediaSupportsFullscreen();
             break;
+        case ContextMenuItemTagToggleVideoEnhancedFullscreen:
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+            item.setTitle(m_context.hitTestResult().mediaIsInEnhancedFullscreen() ? contextMenuItemTagExitVideoEnhancedFullscreen() : contextMenuItemTagEnterVideoEnhancedFullscreen());
+#endif
+            shouldEnable = m_context.hitTestResult().mediaSupportsEnhancedFullscreen();
+            break;
         case ContextMenuItemTagOpenFrameInNewWindow:
         case ContextMenuItemTagSpellingGuess:
         case ContextMenuItemTagOther:

Modified: trunk/Source/WebCore/platform/ContextMenuItem.h (198899 => 198900)


--- trunk/Source/WebCore/platform/ContextMenuItem.h	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebCore/platform/ContextMenuItem.h	2016-03-31 18:23:29 UTC (rev 198900)
@@ -146,7 +146,8 @@
     ContextMenuItemTagMediaMute,
     ContextMenuItemTagDictationAlternative,
     ContextMenuItemTagToggleVideoFullscreen,
-    ContextMenuItemTagShareMenu, 
+    ContextMenuItemTagShareMenu,
+    ContextMenuItemTagToggleVideoEnhancedFullscreen,
     ContextMenuItemBaseCustomTag = 5000,
     ContextMenuItemLastCustomTag = 5999,
     ContextMenuItemBaseApplicationTag = 10000

Modified: trunk/Source/WebCore/platform/LocalizedStrings.cpp (198899 => 198900)


--- trunk/Source/WebCore/platform/LocalizedStrings.cpp	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebCore/platform/LocalizedStrings.cpp	2016-03-31 18:23:29 UTC (rev 198900)
@@ -507,6 +507,24 @@
     return WEB_UI_STRING("Exit Full Screen", "Video Exit Fullscreen context menu item");
 }
 
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/ContextMenuLocalizedStringsAdditions.cpp>
+#else
+String contextMenuItemTagEnterVideoEnhancedFullscreen()
+{
+    return { };
+}
+
+String contextMenuItemTagExitVideoEnhancedFullscreen()
+{
+    return { };
+}
+#endif
+
+#endif
+
 String contextMenuItemTagMediaPlay()
 {
     return WEB_UI_STRING("Play", "Media Play context menu item");

Modified: trunk/Source/WebCore/platform/LocalizedStrings.h (198899 => 198900)


--- trunk/Source/WebCore/platform/LocalizedStrings.h	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h	2016-03-31 18:23:29 UTC (rev 198900)
@@ -139,6 +139,10 @@
     String contextMenuItemTagToggleMediaLoop();
     String contextMenuItemTagEnterVideoFullscreen();
     String contextMenuItemTagExitVideoFullscreen();
+#if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
+    String contextMenuItemTagEnterVideoEnhancedFullscreen();
+    String contextMenuItemTagExitVideoEnhancedFullscreen();
+#endif
     String contextMenuItemTagMediaPlay();
     String contextMenuItemTagMediaPause();
     String contextMenuItemTagMediaMute();

Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (198899 => 198900)


--- trunk/Source/WebCore/rendering/HitTestResult.cpp	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp	2016-03-31 18:23:29 UTC (rev 198900)
@@ -773,4 +773,22 @@
     return node->parentElement();
 }
 
+#if USE(APPLE_INTERNAL_SDK)
+#include <WebKitAdditions/HitTestResultAdditions.cpp>
+#else
+bool HitTestResult::mediaSupportsEnhancedFullscreen() const
+{
+    return false;
+}
+
+bool HitTestResult::mediaIsInEnhancedFullscreen() const
+{
+    return false;
+}
+
+void HitTestResult::toggleEnhancedFullscreenForVideo() const
+{
+}
+#endif
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/HitTestResult.h (198899 => 198900)


--- trunk/Source/WebCore/rendering/HitTestResult.h	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebCore/rendering/HitTestResult.h	2016-03-31 18:23:29 UTC (rev 198900)
@@ -127,6 +127,10 @@
     WEBCORE_EXPORT bool mediaIsVideo() const;
     bool mediaMuted() const;
     void toggleMediaMuteState() const;
+    bool mediaSupportsEnhancedFullscreen() const;
+    bool mediaIsInEnhancedFullscreen() const;
+    void toggleEnhancedFullscreenForVideo() const;
+
     WEBCORE_EXPORT bool isDownloadableMedia() const;
     WEBCORE_EXPORT bool isOverTextInsideFormControlElement() const;
     WEBCORE_EXPORT bool allowsCopy() const;

Modified: trunk/Source/WebKit/mac/ChangeLog (198899 => 198900)


--- trunk/Source/WebKit/mac/ChangeLog	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-03-31 18:23:29 UTC (rev 198900)
@@ -1,3 +1,15 @@
+2016-03-30  Ada Chan  <[email protected]>
+
+        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.
+
+        * WebView/WebHTMLView.mm:
+        (toAction):
+        (toTag):
+        * WebView/WebUIDelegatePrivate.h:
+
 2016-03-24  Said Abou-Hallawa  <sabouhallawa@apple,com>
 
         Change NativeImagePtr for CG to be RetainPtr<CGImageRef>

Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (198899 => 198900)


--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm	2016-03-31 18:23:29 UTC (rev 198900)
@@ -347,6 +347,8 @@
         return ContextMenuItemTagToggleMediaLoop;
     case WebMenuItemTagEnterVideoFullscreen:
         return ContextMenuItemTagEnterVideoFullscreen;
+    case WebMenuItemTagToggleVideoEnhancedFullscreen:
+        return ContextMenuItemTagToggleVideoEnhancedFullscreen;
     case WebMenuItemTagMediaPlayPause:
         return ContextMenuItemTagMediaPlayPause;
     case WebMenuItemTagMediaMute:
@@ -533,6 +535,8 @@
         return WebMenuItemTagToggleVideoFullscreen;
     case ContextMenuItemTagShareMenu:
         return WebMenuItemTagShareMenu;
+    case ContextMenuItemTagToggleVideoEnhancedFullscreen:
+        return WebMenuItemTagToggleVideoEnhancedFullscreen;
 
     case ContextMenuItemBaseCustomTag ... ContextMenuItemLastCustomTag:
         // We just pass these through.

Modified: trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h (198899 => 198900)


--- trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h	2016-03-31 18:23:29 UTC (rev 198900)
@@ -102,6 +102,7 @@
     WebMenuItemTagDictationAlternative,
     WebMenuItemTagToggleVideoFullscreen,
     WebMenuItemTagShareMenu,
+    WebMenuItemTagToggleVideoEnhancedFullscreen,
 };
 
 // Deprecated; remove when there are no more clients.

Modified: trunk/Source/WebKit2/ChangeLog (198899 => 198900)


--- trunk/Source/WebKit2/ChangeLog	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebKit2/ChangeLog	2016-03-31 18:23:29 UTC (rev 198900)
@@ -1,3 +1,15 @@
+2016-03-30  Ada Chan  <[email protected]>
+
+        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.
+
+        * Shared/API/c/WKContextMenuItemTypes.h:
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toAPI):
+        (WebKit::toImpl):
+
 2016-03-31  Brent Fulgham  <[email protected]>
 
         Unreviewed build fix after r198893.

Modified: trunk/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h (198899 => 198900)


--- trunk/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h	2016-03-31 18:23:29 UTC (rev 198900)
@@ -122,6 +122,7 @@
     kWKContextMenuItemTagOpenLinkInThisWindow,
     kWKContextMenuItemTagToggleVideoFullscreen,
     kWKContextMenuItemTagShareMenu,
+    kWKContextMenuItemTagToggleVideoEnhancedFullscreen,
     kWKContextMenuItemBaseApplicationTag = 10000
 };
 typedef uint32_t WKContextMenuItemTag;

Modified: trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h (198899 => 198900)


--- trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h	2016-03-31 18:16:37 UTC (rev 198899)
+++ trunk/Source/WebKit2/Shared/API/c/WKSharedAPICast.h	2016-03-31 18:23:29 UTC (rev 198900)
@@ -472,6 +472,8 @@
         return kWKContextMenuItemTagToggleVideoFullscreen;
     case WebCore::ContextMenuItemTagEnterVideoFullscreen:
         return kWKContextMenuItemTagEnterVideoFullscreen;
+    case WebCore::ContextMenuItemTagToggleVideoEnhancedFullscreen:
+        return kWKContextMenuItemTagToggleVideoEnhancedFullscreen;
     case WebCore::ContextMenuItemTagMediaPlayPause:
         return kWKContextMenuItemTagMediaPlayPause;
     case WebCore::ContextMenuItemTagMediaMute:
@@ -664,6 +666,8 @@
         return WebCore::ContextMenuItemTagToggleVideoFullscreen;
     case kWKContextMenuItemTagEnterVideoFullscreen:
         return WebCore::ContextMenuItemTagEnterVideoFullscreen;
+    case kWKContextMenuItemTagToggleVideoEnhancedFullscreen:
+        return WebCore::ContextMenuItemTagToggleVideoEnhancedFullscreen;
     case kWKContextMenuItemTagMediaPlayPause:
         return WebCore::ContextMenuItemTagMediaPlayPause;
     case kWKContextMenuItemTagMediaMute:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to