Polish context menus for media elements

https://bugs.webkit.org/show_bug.cgi?id=118078
<rdar://problem/14278960>

Patch by Ruth Fong <ruth_fong@apple.com> on 2013-06-27
Reviewed by Eric Carlson.

No new tests: media/context-menu-action.html,
which has been disabled by bug 116651, is used to test context menus.

* English.lproj/Localizable.strings: Changed "Fullscreen" to "Full Screen"
and added strings "Show Controls" and "Hide Controls".

* page/ContextMenuController.cpp: Updated to include a new context menu item
that toggles betweeen "Show Controls" and "Hide Controls".

* platform/ContextMenuItem.h:

* platform/LocalizedStrings.cpp:
* platform/LocalizedStrings.h:
* platform/efl/LocalizedStringsEfl.cpp:
* platform/gtk/LocalizedStringsGtk.cpp:
* platform/qt/LocalizedStringsQt.cpp:
Added equivalents of localized strings "Show Controls" and "Hide Controls".

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@152117 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ca529ecf
2013-06-27 Ruth Fong <ruth_fong@apple.com>
Polish context menus for media elements
https://bugs.webkit.org/show_bug.cgi?id=118078
<rdar://problem/14278960>
Reviewed by Eric Carlson.
No new tests: media/context-menu-action.html,
which has been disabled by bug 116651, is used to test context menus.
* English.lproj/Localizable.strings: Changed "Fullscreen" to "Full Screen"
and added strings "Show Controls" and "Hide Controls".
* page/ContextMenuController.cpp: Updated to include a new context menu item
that toggles betweeen "Show Controls" and "Hide Controls".
* platform/ContextMenuItem.h:
* platform/LocalizedStrings.cpp:
* platform/LocalizedStrings.h:
* platform/efl/LocalizedStringsEfl.cpp:
* platform/gtk/LocalizedStringsGtk.cpp:
* platform/qt/LocalizedStringsQt.cpp:
Added equivalents of localized strings "Show Controls" and "Hide Controls".
2013-06-27 Chris Fleizach <cfleizach@apple.com> 2013-06-27 Chris Fleizach <cfleizach@apple.com>
AX: IOS: crash while navigating with SVG AX: IOS: crash while navigating with SVG
B/* accessibility help text for media controller time value >= 1 day */ B/* accessibility help text for media controller time value >= 1 day */
......
...@@ -745,6 +745,12 @@ static bool selectionContainsPossibleWord(Frame* frame) ...@@ -745,6 +745,12 @@ static bool selectionContainsPossibleWord(Frame* frame)
#define SUPPORTS_TOGGLE_VIDEO_FULLSCREEN 0 #define SUPPORTS_TOGGLE_VIDEO_FULLSCREEN 0
#endif #endif
#if PLATFORM(MAC)
#define SUPPORTS_TOGGLE_SHOW_HIDE_MEDIA_CONTROLS 1
#else
#define SUPPORTS_TOGGLE_SHOW_HIDE_MEDIA_CONTROLS 0
#endif
void ContextMenuController::populate() void ContextMenuController::populate()
{ {
ContextMenuItem OpenLinkItem(ActionType, ContextMenuItemTagOpenLink, contextMenuItemTagOpenLink()); ContextMenuItem OpenLinkItem(ActionType, ContextMenuItemTagOpenLink, contextMenuItemTagOpenLink());
...@@ -771,8 +777,13 @@ void ContextMenuController::populate() ...@@ -771,8 +777,13 @@ void ContextMenuController::populate()
contextMenuItemTagMediaPlay()); contextMenuItemTagMediaPlay());
ContextMenuItem MediaMute(ActionType, ContextMenuItemTagMediaMute, ContextMenuItem MediaMute(ActionType, ContextMenuItemTagMediaMute,
contextMenuItemTagMediaMute()); contextMenuItemTagMediaMute());
#if SUPPORTS_TOGGLE_SHOW_HIDE_MEDIA_CONTROLS
ContextMenuItem ToggleMediaControls(ActionType, ContextMenuItemTagToggleMediaControls,
contextMenuItemTagHideMediaControls());
#else
ContextMenuItem ToggleMediaControls(CheckableActionType, ContextMenuItemTagToggleMediaControls, ContextMenuItem ToggleMediaControls(CheckableActionType, ContextMenuItemTagToggleMediaControls,
contextMenuItemTagToggleMediaControls()); contextMenuItemTagToggleMediaControls());
#endif
ContextMenuItem ToggleMediaLoop(CheckableActionType, ContextMenuItemTagToggleMediaLoop, ContextMenuItem ToggleMediaLoop(CheckableActionType, ContextMenuItemTagToggleMediaLoop,
contextMenuItemTagToggleMediaLoop()); contextMenuItemTagToggleMediaLoop());
ContextMenuItem EnterVideoFullscreen(ActionType, ContextMenuItemTagEnterVideoFullscreen, ContextMenuItem EnterVideoFullscreen(ActionType, ContextMenuItemTagEnterVideoFullscreen,
...@@ -1363,7 +1374,11 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const ...@@ -1363,7 +1374,11 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const
item.setTitle(contextMenuItemTagCopyAudioLinkToClipboard()); item.setTitle(contextMenuItemTagCopyAudioLinkToClipboard());
break; break;
case ContextMenuItemTagToggleMediaControls: case ContextMenuItemTagToggleMediaControls:
#if SUPPORTS_TOGGLE_SHOW_HIDE_MEDIA_CONTROLS
item.setTitle(m_hitTestResult.mediaControlsEnabled() ? contextMenuItemTagHideMediaControls() : contextMenuItemTagShowMediaControls());
#else
shouldCheck = m_hitTestResult.mediaControlsEnabled(); shouldCheck = m_hitTestResult.mediaControlsEnabled();
#endif
break; break;
case ContextMenuItemTagToggleMediaLoop: case ContextMenuItemTagToggleMediaLoop:
shouldCheck = m_hitTestResult.mediaLoopEnabled(); shouldCheck = m_hitTestResult.mediaLoopEnabled();
......
...@@ -494,6 +494,16 @@ String contextMenuItemTagToggleMediaControls() ...@@ -494,6 +494,16 @@ String contextMenuItemTagToggleMediaControls()
return WEB_UI_STRING("Controls", "Media Controls context menu item"); return WEB_UI_STRING("Controls", "Media Controls context menu item");
} }
String contextMenuItemTagShowMediaControls()
{
return WEB_UI_STRING("Show Controls", "Show Media Controls context menu item");
}
String contextMenuItemTagHideMediaControls()
{
return WEB_UI_STRING("Hide Controls", "Hide Media Controls context menu item");
}
String contextMenuItemTagToggleMediaLoop() String contextMenuItemTagToggleMediaLoop()
{ {
return WEB_UI_STRING("Loop", "Media Loop context menu item"); return WEB_UI_STRING("Loop", "Media Loop context menu item");
...@@ -501,12 +511,12 @@ String contextMenuItemTagToggleMediaLoop() ...@@ -501,12 +511,12 @@ String contextMenuItemTagToggleMediaLoop()
String contextMenuItemTagEnterVideoFullscreen() String contextMenuItemTagEnterVideoFullscreen()
{ {
return WEB_UI_STRING("Enter Fullscreen", "Video Enter Fullscreen context menu item"); return WEB_UI_STRING("Enter Full Screen", "Video Enter Fullscreen context menu item");
} }
String contextMenuItemTagExitVideoFullscreen() String contextMenuItemTagExitVideoFullscreen()
{ {
return WEB_UI_STRING("Exit Fullscreen", "Video Exit Fullscreen context menu item"); return WEB_UI_STRING("Exit Full Screen", "Video Exit Fullscreen context menu item");
} }
String contextMenuItemTagMediaPlay() String contextMenuItemTagMediaPlay()
......
...@@ -137,6 +137,8 @@ namespace WebCore { ...@@ -137,6 +137,8 @@ namespace WebCore {
String contextMenuItemTagCopyVideoLinkToClipboard(); String contextMenuItemTagCopyVideoLinkToClipboard();
String contextMenuItemTagCopyAudioLinkToClipboard(); String contextMenuItemTagCopyAudioLinkToClipboard();
String contextMenuItemTagToggleMediaControls(); String contextMenuItemTagToggleMediaControls();
String contextMenuItemTagShowMediaControls();
String contextMenuItemTagHideMediaControls();
String contextMenuItemTagToggleMediaLoop(); String contextMenuItemTagToggleMediaLoop();
String contextMenuItemTagEnterVideoFullscreen(); String contextMenuItemTagEnterVideoFullscreen();
String contextMenuItemTagExitVideoFullscreen(); String contextMenuItemTagExitVideoFullscreen();
......
...@@ -153,6 +153,16 @@ String contextMenuItemTagToggleMediaControls() ...@@ -153,6 +153,16 @@ String contextMenuItemTagToggleMediaControls()
return String::fromUTF8("Toggle Media Controls"); return String::fromUTF8("Toggle Media Controls");
} }
String contextMenuItemTagShowMediaControls()
{
return String::fromUTF8("Show Media Controls");
}
String contextMenuitemTagHideMediaControls()
{
return String::fromUTF8("Hide Media Controls");
}
String contextMenuItemTagToggleMediaLoop() String contextMenuItemTagToggleMediaLoop()
{ {
return String::fromUTF8("Toggle Media Loop Playback"); return String::fromUTF8("Toggle Media Loop Playback");
......
...@@ -166,6 +166,16 @@ String contextMenuItemTagToggleMediaControls() ...@@ -166,6 +166,16 @@ String contextMenuItemTagToggleMediaControls()
return String::fromUTF8(_("_Toggle Media Controls")); return String::fromUTF8(_("_Toggle Media Controls"));
} }
String contextMenuItemTagShowMediaControls()
{
return String::fromUTF8(_("_Show Media Controls"));
}
String contextMenuItemTagHideMediaControls()
{
return String::fromUTF8(_("_Hide Media Controls"));
}
String contextMenuItemTagToggleMediaLoop() String contextMenuItemTagToggleMediaLoop()
{ {
return String::fromUTF8(_("Toggle Media _Loop Playback")); return String::fromUTF8(_("Toggle Media _Loop Playback"));
......
...@@ -158,6 +158,16 @@ String contextMenuItemTagToggleMediaControls() ...@@ -158,6 +158,16 @@ String contextMenuItemTagToggleMediaControls()
return QCoreApplication::translate("QWebPage", "Toggle Controls", "Toggle Media Controls"); return QCoreApplication::translate("QWebPage", "Toggle Controls", "Toggle Media Controls");
} }
String contextMenuItemTagShowMediaControls()
{
return QCoreApplication::translate("QWebPage", "Show Controls", "Show Media Controls");
}
String contextMenuItemTagHideMediaControls()
{
return QCoreApplication::translate("QWebPage", "Hide Controls", "Hide Media Controls");
}
String contextMenuItemTagToggleMediaLoop() String contextMenuItemTagToggleMediaLoop()
{ {
return QCoreApplication::translate("QWebPage", "Toggle Loop", "Toggle Media Loop Playback"); return QCoreApplication::translate("QWebPage", "Toggle Loop", "Toggle Media Loop Playback");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment