REGRESSION: Important controls are missing from <video> element UI, when compared to QuickTime

https://bugs.webkit.org/show_bug.cgi?id=20599

Add a "Download Video"/"Download Audio" context menu item to download media
elements.

Patch by Ruth Fong <ruth_fong@apple.com> on 2013-06-17
Reviewed by Beth Dakin.

Source/WebCore:

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: Updated to
include localizable strings for "Download Video" and "Download Audio".

* page/ContextMenuController.cpp: Updated to
include and handle a "Download Video/Audio" context menu item.

* platform/ContextMenuItem.h:

* platform/LocalizedStrings.cpp:
* platform/LocalizedStrings.h:
* platform/efl/LocalizedStringsEfl.cpp:
* platform/gtk/LocalizedStringsGtk.cpp:
* platform/qt/LocalizedStringsQt.cpp:
Updated to include localizable strings for "Download Video" and "Download Audio".

Source/WebKit/efl:

* WebCoreSupport/AssertMatchingEnums.cpp:
* ewk/ewk_contextmenu.h:
Updated to include new EWK enum type for "Download Video/Audio" context menu item.

Source/WebKit2:

* Shared/API/c/WKContextMenuItemTypes.h: Updated to include
an enum type for the "Download Video/Audio" context menu item.

* Shared/API/c/WKSharedAPICast.h: Updated to associate
the enums in WebKit and WebCore that handle the "Download Video/Audio"
context menu item.

* UIProcess/API/efl/ewk_context_menu.cpp:
* UIProcess/API/efl/ewk_context_menu_item.cpp:
* UIProcess/API/efl/ewk_context_menu_item.h:
Updated to include new EWK enum type for "Download Video/Audio" context menu item.

* UIProcess/WebPageProxy.cpp: Updated to
handle the "Download Video/Audio" context menu item mouse click
and download the media item in the UI process.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151656 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent aeefa61e
2013-06-17 Ruth Fong <ruth_fong@apple.com>
REGRESSION: Important controls are missing from <video> element UI, when compared to QuickTime
https://bugs.webkit.org/show_bug.cgi?id=20599
Add a "Download Video"/"Download Audio" context menu item to download media
elements.
Reviewed by Beth Dakin.
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: Updated to
include localizable strings for "Download Video" and "Download Audio".
* page/ContextMenuController.cpp: Updated to
include and handle a "Download Video/Audio" context menu item.
* platform/ContextMenuItem.h:
* platform/LocalizedStrings.cpp:
* platform/LocalizedStrings.h:
* platform/efl/LocalizedStringsEfl.cpp:
* platform/gtk/LocalizedStringsGtk.cpp:
* platform/qt/LocalizedStringsQt.cpp:
Updated to include localizable strings for "Download Video" and "Download Audio".
2013-06-17 Zoltan Horvath <zoltan@webkit.org>
[CSS Shapes] Consider bottom borders when calculating the position of the overflow
B/* accessibility help text for media controller time value >= 1 day */
......
......@@ -228,7 +228,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
openNewWindow(m_hitTestResult.absoluteLinkURL(), frame);
break;
case ContextMenuItemTagDownloadLinkToDisk:
// FIXME: Some day we should be able to do this from within WebCore.
// FIXME: Some day we should be able to do this from within WebCore. (Bug 117709)
m_client->downloadURL(m_hitTestResult.absoluteLinkURL());
break;
case ContextMenuItemTagCopyLinkToClipboard:
......@@ -238,7 +238,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
openNewWindow(m_hitTestResult.absoluteImageURL(), frame);
break;
case ContextMenuItemTagDownloadImageToDisk:
// FIXME: Some day we should be able to do this from within WebCore.
// FIXME: Some day we should be able to do this from within WebCore. (Bug 117709)
m_client->downloadURL(m_hitTestResult.absoluteImageURL());
break;
case ContextMenuItemTagCopyImageToClipboard:
......@@ -254,6 +254,10 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
case ContextMenuItemTagOpenMediaInNewWindow:
openNewWindow(m_hitTestResult.absoluteMediaURL(), frame);
break;
case ContextMenuItemTagDownloadMediaToDisk:
// FIXME: Some day we should be able to do this from within WebCore. (Bug 117709)
m_client->downloadURL(m_hitTestResult.absoluteMediaURL());
break;
case ContextMenuItemTagCopyMediaLinkToClipboard:
frame->editor().copyURL(m_hitTestResult.absoluteMediaURL(), m_hitTestResult.textContent());
break;
......@@ -761,8 +765,8 @@ void ContextMenuController::populate()
contextMenuItemTagCopyImageUrlToClipboard());
#endif
ContextMenuItem OpenMediaInNewWindowItem(ActionType, ContextMenuItemTagOpenMediaInNewWindow, String());
ContextMenuItem CopyMediaLinkItem(ActionType, ContextMenuItemTagCopyMediaLinkToClipboard,
String());
ContextMenuItem DownloadMediaItem(ActionType, ContextMenuItemTagDownloadMediaToDisk, String());
ContextMenuItem CopyMediaLinkItem(ActionType, ContextMenuItemTagCopyMediaLinkToClipboard, String());
ContextMenuItem MediaPlayPause(ActionType, ContextMenuItemTagMediaPlayPause,
contextMenuItemTagMediaPlay());
ContextMenuItem MediaMute(ActionType, ContextMenuItemTagMediaMute,
......@@ -864,6 +868,8 @@ void ContextMenuController::populate()
appendItem(*separatorItem(), m_contextMenu.get());
appendItem(CopyMediaLinkItem, m_contextMenu.get());
appendItem(OpenMediaInNewWindowItem, m_contextMenu.get());
if (loader->client()->canHandleRequest(ResourceRequest(mediaURL)))
appendItem(DownloadMediaItem, m_contextMenu.get());
}
if (imageURL.isEmpty() && linkURL.isEmpty() && mediaURL.isEmpty()) {
......@@ -1344,6 +1350,12 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const
else
item.setTitle(contextMenuItemTagOpenAudioInNewWindow());
break;
case ContextMenuItemTagDownloadMediaToDisk:
if (m_hitTestResult.mediaIsVideo())
item.setTitle(contextMenuItemTagDownloadVideoToDisk());
else
item.setTitle(contextMenuItemTagDownloadAudioToDisk());
break;
case ContextMenuItemTagCopyMediaLinkToClipboard:
if (m_hitTestResult.mediaIsVideo())
item.setTitle(contextMenuItemTagCopyVideoLinkToClipboard());
......
......@@ -153,6 +153,7 @@ namespace WebCore {
ContextMenuItemTagChangeBack,
#endif
ContextMenuItemTagOpenMediaInNewWindow,
ContextMenuItemTagDownloadMediaToDisk,
ContextMenuItemTagCopyMediaLinkToClipboard,
ContextMenuItemTagToggleMediaControls,
ContextMenuItemTagToggleMediaLoop,
......
......@@ -469,6 +469,16 @@ String contextMenuItemTagOpenAudioInNewWindow()
return WEB_UI_STRING("Open Audio in New Window", "Open Audio in New Window context menu item");
}
String contextMenuItemTagDownloadVideoToDisk()
{
return WEB_UI_STRING("Download Video", "Download Video To Disk context menu item");
}
String contextMenuItemTagDownloadAudioToDisk()
{
return WEB_UI_STRING("Download Audio", "Download Audio To Disk context menu item");
}
String contextMenuItemTagCopyVideoLinkToClipboard()
{
return WEB_UI_STRING("Copy Video Address", "Copy Video Address Location context menu item");
......
......@@ -132,6 +132,8 @@ namespace WebCore {
#endif
String contextMenuItemTagOpenVideoInNewWindow();
String contextMenuItemTagOpenAudioInNewWindow();
String contextMenuItemTagDownloadVideoToDisk();
String contextMenuItemTagDownloadAudioToDisk();
String contextMenuItemTagCopyVideoLinkToClipboard();
String contextMenuItemTagCopyAudioLinkToClipboard();
String contextMenuItemTagToggleMediaControls();
......
......@@ -128,6 +128,16 @@ String contextMenuItemTagOpenAudioInNewWindow()
return String::fromUTF8("Open Audio in New Window");
}
String contextMenuItemTagDownloadVideoToDisk()
{
return String::fromUTF8("Download Video");
}
String contextMenuItemTagDownloadAudioToDisk()
{
return String::fromUTF8("Download Audio");
}
String contextMenuItemTagCopyVideoLinkToClipboard()
{
return String::fromUTF8("Copy Video Link Location");
......
......@@ -141,6 +141,16 @@ String contextMenuItemTagOpenAudioInNewWindow()
return String::fromUTF8(_("Open _Audio in New Window"));
}
String contextMenuItemTagDownloadVideoToDisk()
{
return String::fromUTF8(_("Download _Video"));
}
String contextMenuItemTagDownloadAudioToDisk()
{
return String::fromUTF8(_("Download _Audio"));
}
String contextMenuItemTagCopyVideoLinkToClipboard()
{
return String::fromUTF8(_("Cop_y Video Link Location"));
......
......@@ -133,6 +133,16 @@ String contextMenuItemTagOpenAudioInNewWindow()
return QCoreApplication::translate("QWebPage", "Open Audio", "Open Audio in New Window");
}
String contextMenuItemTagDownloadVideoToDisk()
{
return QCoreApplication::translate("QWebPage", "Download Video", "Download Video context menu item");
}
String contextMenuItemTagDownloadAudioToDisk()
{
return QCoreApplication::translate("QWebPage", "Download Audio", "Download Audio context menu item");
}
String contextMenuItemTagCopyVideoLinkToClipboard()
{
return QCoreApplication::translate("QWebPage", "Copy Video", "Copy Video Link Location");
......
2013-06-17 Ruth Fong <ruth_fong@apple.com>
REGRESSION: Important controls are missing from <video> element UI, when compared to QuickTime
https://bugs.webkit.org/show_bug.cgi?id=20599
Add a "Download Video"/"Download Audio" context menu item to download media
elements.
Reviewed by Beth Dakin.
* WebCoreSupport/AssertMatchingEnums.cpp:
* ewk/ewk_contextmenu.h:
Updated to include new EWK enum type for "Download Video/Audio" context menu item.
2013-06-13 Ryuan Choi <ryuan.choi@samsung.com>
[EFL] Refactor ewk_view_scroll to remove internal structure.
......
......@@ -156,6 +156,7 @@ COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT, C
COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT, ContextMenuItemTagTextDirectionLeftToRight);
COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT, ContextMenuItemTagTextDirectionRightToLeft);
COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW, ContextMenuItemTagOpenMediaInNewWindow);
COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_MEDIA_TO_DISK, ContextMenuItemTagDownloadMediaToDisk);
COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD, ContextMenuItemTagCopyMediaLinkToClipboard);
COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS, ContextMenuItemTagToggleMediaControls);
COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP, ContextMenuItemTagToggleMediaLoop);
......
......@@ -115,6 +115,7 @@ enum _Ewk_Context_Menu_Action {
EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT,
EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT,
EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW,
EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_MEDIA_TO_DISK,
EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD,
EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS,
EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP,
......
2013-06-17 Ruth Fong <ruth_fong@apple.com>
REGRESSION: Important controls are missing from <video> element UI, when compared to QuickTime
https://bugs.webkit.org/show_bug.cgi?id=20599
Add a "Download Video"/"Download Audio" context menu item to download media
elements.
Reviewed by Beth Dakin.
* Shared/API/c/WKContextMenuItemTypes.h: Updated to include
an enum type for the "Download Video/Audio" context menu item.
* Shared/API/c/WKSharedAPICast.h: Updated to associate
the enums in WebKit and WebCore that handle the "Download Video/Audio"
context menu item.
* UIProcess/API/efl/ewk_context_menu.cpp:
* UIProcess/API/efl/ewk_context_menu_item.cpp:
* UIProcess/API/efl/ewk_context_menu_item.h:
Updated to include new EWK enum type for "Download Video/Audio" context menu item.
* UIProcess/WebPageProxy.cpp: Updated to
handle the "Download Video/Audio" context menu item mouse click
and download the media item in the UI process.
2013-06-17 Ralph Thomas <ralpht@gmail.com>
[CoordinatedGraphics][CSS Shaders] Use forwarding header for TextureMapperPlatformCompiledProgram.h
......
......@@ -107,6 +107,7 @@ enum {
kWKContextMenuItemTagCapitalize,
kWKContextMenuItemTagChangeBack,
kWKContextMenuItemTagOpenMediaInNewWindow,
kWKContextMenuItemTagDownloadMediaToDisk,
kWKContextMenuItemTagCopyMediaLinkToClipboard,
kWKContextMenuItemTagToggleMediaControls,
kWKContextMenuItemTagToggleMediaLoop,
......
......@@ -462,6 +462,8 @@ inline WKContextMenuItemTag toAPI(WebCore::ContextMenuAction action)
return kWKContextMenuItemTagTextDirectionRightToLeft;
case WebCore::ContextMenuItemTagOpenMediaInNewWindow:
return kWKContextMenuItemTagOpenMediaInNewWindow;
case WebCore::ContextMenuItemTagDownloadMediaToDisk:
return kWKContextMenuItemTagDownloadMediaToDisk;
case WebCore::ContextMenuItemTagCopyMediaLinkToClipboard:
return kWKContextMenuItemTagCopyMediaLinkToClipboard;
case WebCore::ContextMenuItemTagToggleMediaControls:
......@@ -654,6 +656,8 @@ inline WebCore::ContextMenuAction toImpl(WKContextMenuItemTag tag)
return WebCore::ContextMenuItemTagTextDirectionRightToLeft;
case kWKContextMenuItemTagOpenMediaInNewWindow:
return WebCore::ContextMenuItemTagOpenMediaInNewWindow;
case kWKContextMenuItemTagDownloadMediaToDisk:
return WebCore::ContextMenuItemTagDownloadMediaToDisk;
case kWKContextMenuItemTagCopyMediaLinkToClipboard:
return WebCore::ContextMenuItemTagCopyMediaLinkToClipboard;
case kWKContextMenuItemTagToggleMediaControls:
......
......@@ -307,6 +307,8 @@ static WKContextMenuItemTag getWKTagFromEwkAction(Ewk_Context_Menu_Item_Action a
return kWKContextMenuItemTagTextDirectionRightToLeft;
case EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW:
return kWKContextMenuItemTagOpenMediaInNewWindow;
case EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_MEDIA_TO_DISK:
return kWKContextMenuItemTagDownloadMediaToDisk;
case EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD:
return kWKContextMenuItemTagCopyMediaLinkToClipboard;
case EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS:
......
......@@ -300,6 +300,8 @@ static Ewk_Context_Menu_Item_Action getEwkActionFromWKTag(WKContextMenuItemTag a
return EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT;
case kWKContextMenuItemTagOpenMediaInNewWindow:
return EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW;
case kWKContextMenuItemTagDownloadMediaToDisk:
return EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_MEDIA_TO_DISK;
case kWKContextMenuItemTagCopyMediaLinkToClipboard:
return EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD;
case kWKContextMenuItemTagToggleMediaControls:
......
......@@ -120,6 +120,7 @@ typedef enum {
EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT,
EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT,
EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW,
EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_MEDIA_TO_DISK,
EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD,
EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS,
EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP,
......
......@@ -3344,6 +3344,10 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
m_process->context()->download(this, KURL(KURL(), m_activeContextMenuHitTestResultData.absoluteLinkURL));
return;
}
if (item.action() == ContextMenuItemTagDownloadMediaToDisk) {
m_process->context()->download(this, KURL(KURL(), m_activeContextMenuHitTestResultData.absoluteMediaURL));
return;
}
if (item.action() == ContextMenuItemTagCheckSpellingWhileTyping) {
TextChecker::setContinuousSpellCheckingEnabled(!TextChecker::state().isContinuousSpellCheckingEnabled);
m_process->updateTextCheckerState();
......
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