Commit fd50428d authored by philn@webkit.org's avatar philn@webkit.org

2010-09-20 Philippe Normand <pnormand@igalia.com>

        Reviewed by Eric Carlson.

        [GTK] enhanced context menu for media elements
        https://bugs.webkit.org/show_bug.cgi?id=45021

        New items in the media Element context menu:
        - play/pause
        - mute/unmute
        - controls display control
        - switch to fullscreen (for video only)
        - loop playback control
        - copy media url to clipboard
        - open in new window

        Test: media/context-menu-actions.html

        * page/ContextMenuController.cpp:
        (WebCore::ContextMenuController::contextMenuItemSelected):
        * platform/ContextMenu.cpp:
        (WebCore::ContextMenu::populate):
        (WebCore::ContextMenu::checkOrEnableIfNeeded):
        * platform/ContextMenuItem.h:
        * platform/LocalizationStrategy.h:
        * platform/LocalizedStrings.cpp:
        (WebCore::contextMenuItemTagOpenVideoInNewWindow):
        (WebCore::contextMenuItemTagOpenAudioInNewWindow):
        (WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebCore::contextMenuItemTagToggleMediaControls):
        (WebCore::contextMenuItemTagToggleMediaLoop):
        (WebCore::contextMenuItemTagEnterVideoFullscreen):
        (WebCore::contextMenuItemTagMediaPlay):
        (WebCore::contextMenuItemTagMediaPause):
        (WebCore::contextMenuItemTagMediaMute):
        * platform/LocalizedStrings.h:
        * platform/android/LocalizedStringsAndroid.cpp:
        (WebCore::contextMenuItemTagOpenVideoInNewWindow):
        (WebCore::contextMenuItemTagOpenAudioInNewWindow):
        (WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebCore::contextMenuItemTagToggleMediaControls):
        (WebCore::contextMenuItemTagToggleMediaLoop):
        (WebCore::contextMenuItemTagEnterVideoFullscreen):
        (WebCore::contextMenuItemTagMediaPlay):
        (WebCore::contextMenuItemTagMediaPause):
        (WebCore::contextMenuItemTagMediaMute):
        * platform/brew/LocalizedStringsBrew.cpp:
        (WebCore::contextMenuItemTagOpenVideoInNewWindow):
        (WebCore::contextMenuItemTagOpenAudioInNewWindow):
        (WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebCore::contextMenuItemTagToggleMediaControls):
        (WebCore::contextMenuItemTagToggleMediaLoop):
        (WebCore::contextMenuItemTagEnterVideoFullscreen):
        (WebCore::contextMenuItemTagMediaPlay):
        (WebCore::contextMenuItemTagMediaPause):
        (WebCore::contextMenuItemTagMediaMute):
        * platform/efl/LocalizedStringsEfl.cpp:
        (WebCore::contextMenuItemTagOpenVideoInNewWindow):
        (WebCore::contextMenuItemTagOpenAudioInNewWindow):
        (WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebCore::contextMenuItemTagToggleMediaControls):
        (WebCore::contextMenuItemTagToggleMediaLoop):
        (WebCore::contextMenuItemTagEnterVideoFullscreen):
        (WebCore::contextMenuItemTagMediaPlay):
        (WebCore::contextMenuItemTagMediaPause):
        (WebCore::contextMenuItemTagMediaMute):
        * platform/gtk/ContextMenuItemGtk.cpp:
        (WebCore::gtkStockIDFromContextMenuAction):
        * platform/gtk/LocalizedStringsGtk.cpp:
        (WebCore::contextMenuItemTagOpenVideoInNewWindow):
        (WebCore::contextMenuItemTagOpenAudioInNewWindow):
        (WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebCore::contextMenuItemTagToggleMediaControls):
        (WebCore::contextMenuItemTagToggleMediaLoop):
        (WebCore::contextMenuItemTagEnterVideoFullscreen):
        (WebCore::contextMenuItemTagMediaPlay):
        (WebCore::contextMenuItemTagMediaPause):
        (WebCore::contextMenuItemTagMediaMute):
        * platform/haiku/LocalizedStringsHaiku.cpp:
        (WebCore::contextMenuItemTagOpenVideoInNewWindow):
        (WebCore::contextMenuItemTagOpenAudioInNewWindow):
        (WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebCore::contextMenuItemTagToggleMediaControls):
        (WebCore::contextMenuItemTagToggleMediaLoop):
        (WebCore::contextMenuItemTagEnterVideoFullscreen):
        (WebCore::contextMenuItemTagMediaPlay):
        (WebCore::contextMenuItemTagMediaPause):
        (WebCore::contextMenuItemTagMediaMute):
        * platform/wx/LocalizedStringsWx.cpp:
        (WebCore::contextMenuItemTagOpenVideoInNewWindow):
        (WebCore::contextMenuItemTagOpenAudioInNewWindow):
        (WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebCore::contextMenuItemTagToggleMediaControls):
        (WebCore::contextMenuItemTagToggleMediaLoop):
        (WebCore::contextMenuItemTagEnterVideoFullscreen):
        (WebCore::contextMenuItemTagMediaPlay):
        (WebCore::contextMenuItemTagMediaPause):
        (WebCore::contextMenuItemTagMediaMute):
        * rendering/HitTestResult.cpp:
        (WebCore::HitTestResult::absoluteMediaURL):
        (WebCore::HitTestResult::mediaSupportsFullscreen):
        (WebCore::HitTestResult::mediaElement):
        (WebCore::HitTestResult::toggleMediaControlsDisplay):
        (WebCore::HitTestResult::toggleMediaLoopPlayback):
        (WebCore::HitTestResult::enterFullscreenForVideo):
        (WebCore::HitTestResult::mediaControlsEnabled):
        (WebCore::HitTestResult::mediaLoopEnabled):
        (WebCore::HitTestResult::mediaPlaying):
        (WebCore::HitTestResult::toggleMediaPlayState):
        (WebCore::HitTestResult::mediaHasAudio):
        (WebCore::HitTestResult::mediaMuted):
        (WebCore::HitTestResult::toggleMediaMuteState):
        * rendering/HitTestResult.h:

LayoutTests:

        Reviewed by Eric Carlson.

        [GTK] enhanced context menu for media elements
        https://bugs.webkit.org/show_bug.cgi?id=45021

        New test checking the actions that can be triggered by activating
        the contex-menu of the media element. Skipped on mac, qt and win
        because of lack of DRT support.

        * media/context-menu-actions-expected.txt: Added.
        * media/context-menu-actions.html: Added.
        * platform/mac/Skipped:
        * platform/qt/Skipped:
        * platform/win/Skipped:

WebKit:

        Reviewed by Eric Carlson.

        [GTK] enhanced context menu for media elements
        https://bugs.webkit.org/show_bug.cgi?id=45021

        Updated localizable strings.

        * English.lproj/Localizable.strings:

WebKit/chromium:

        Reviewed by Eric Carlson.

        [GTK] enhanced context menu for media elements
        https://bugs.webkit.org/show_bug.cgi?id=45021

        New localized strings for the media element context-menu.

        * src/LocalizedStrings.cpp:
        (WebCore::contextMenuItemTagOpenVideoInNewWindow):
        (WebCore::contextMenuItemTagOpenAudioInNewWindow):
        (WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebCore::contextMenuItemTagToggleMediaControls):
        (WebCore::contextMenuItemTagToggleMediaLoop):
        (WebCore::contextMenuItemTagEnterVideoFullscreen):
        (WebCore::contextMenuItemTagMediaPlay):
        (WebCore::contextMenuItemTagMediaPause):
        (WebCore::contextMenuItemTagMediaMute):

WebKit/mac:

        Reviewed by Eric Carlson.

        [GTK] enhanced context menu for media elements
        https://bugs.webkit.org/show_bug.cgi?id=45021

        New localized strings for the media element context-menu.

        * WebCoreSupport/WebPlatformStrategies.h:
        * WebCoreSupport/WebPlatformStrategies.mm:
        (WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow):
        (WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow):
        (WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebPlatformStrategies::contextMenuItemTagToggleMediaControls):
        (WebPlatformStrategies::contextMenuItemTagToggleMediaLoop):
        (WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen):
        (WebPlatformStrategies::contextMenuItemTagMediaPlay):
        (WebPlatformStrategies::contextMenuItemTagMediaPause):
        (WebPlatformStrategies::contextMenuItemTagMediaMute):

Webkit/qt:

        Reviewed by Eric Carlson.

        [GTK] enhanced context menu for media elements
        https://bugs.webkit.org/show_bug.cgi?id=45021

        * WebCoreSupport/WebPlatformStrategies.cpp:
        * WebCoreSupport/WebPlatformStrategies.h:
        (WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow):
        (WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow):
        (WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebPlatformStrategies::contextMenuItemTagToggleMediaControls)
        (WebPlatformStrategies::contextMenuItemTagToggleMediaLoop)
        (WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen)
        (WebPlatformStrategies::contextMenuItemTagMediaPlay)
        (WebPlatformStrategies::contextMenuItemTagMediaPause)
        (WebPlatformStrategies::contextMenuItemTagMediaMute)

WebKit/win:

        Reviewed by Eric Carlson.

        [GTK] enhanced context menu for media elements
        https://bugs.webkit.org/show_bug.cgi?id=45021

        New localized strings for the media element context-menu.

        * WebCoreSupport/WebPlatformStrategies.cpp:
        (WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow):
        (WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow):
        (WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebPlatformStrategies::contextMenuItemTagToggleMediaControls):
        (WebPlatformStrategies::contextMenuItemTagToggleMediaLoop):
        (WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen):
        (WebPlatformStrategies::contextMenuItemTagMediaPlay):
        (WebPlatformStrategies::contextMenuItemTagMediaPause):
        (WebPlatformStrategies::contextMenuItemTagMediaMute):
        * WebCoreSupport/WebPlatformStrategies.h:

WebKit2:

        Reviewed by Eric Carlson.

        [GTK] enhanced context menu for media elements
        https://bugs.webkit.org/show_bug.cgi?id=45021

        New localized strings for the media element context-menu.

        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
        (WebKit::WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow):
        (WebKit::WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow):
        (WebKit::WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard):
        (WebKit::WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard):
        (WebKit::WebPlatformStrategies::contextMenuItemTagToggleMediaControls):
        (WebKit::WebPlatformStrategies::contextMenuItemTagToggleMediaLoop):
        (WebKit::WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen):
        (WebKit::WebPlatformStrategies::contextMenuItemTagMediaPlay):
        (WebKit::WebPlatformStrategies::contextMenuItemTagMediaPause):
        (WebKit::WebPlatformStrategies::contextMenuItemTagMediaMute):
        (WebKit::WebPlatformStrategies::contextMenuItemTagMediaUnMute):
        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:

WebKitTools:

        Reviewed by Eric Carlson.

        [GTK] enhanced context menu for media elements
        https://bugs.webkit.org/show_bug.cgi?id=45021

        EventSender::contextClick() now returns an array of js
        objects. Each object has a title property and a click() method.

        * DumpRenderTree/gtk/EventSender.cpp:
        (getMenuItemTitleCallback):
        (setMenuItemTitleCallback):
        (menuItemClickCallback):
        (getMenuItemClass):
        (contextClickCallback):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67928 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2ca3f55f
2010-09-20 Philippe Normand <pnormand@igalia.com>
Reviewed by Eric Carlson.
[GTK] enhanced context menu for media elements
https://bugs.webkit.org/show_bug.cgi?id=45021
New test checking the actions that can be triggered by activating
the contex-menu of the media element. Skipped on mac, qt and win
because of lack of DRT support.
* media/context-menu-actions-expected.txt: Added.
* media/context-menu-actions.html: Added.
* platform/mac/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
2010-09-20 Mihai Parparita <mihaip@chromium.org>
Unreviewed Chromium test_expectations.txt update.
Test the various actions available in the HTML5 media element context-menu.
RUN(video.src = 'content/test.mp4')
EVENT(play)
EXPECTED (video.paused == 'false') OK
Toggling play state
EXPECTED (video.paused == 'true') OK
EXPECTED (video.muted == 'false') OK
Toggling mute state
EXPECTED (video.muted == 'true') OK
EXPECTED (video.controls == 'true') OK
Toggling media controls
EXPECTED (video.controls == 'false') OK
EXPECTED (video.loop == 'false') OK
Toggling loop state
EXPECTED (video.loop == 'true') OK
EXPECTED (video.webkitDisplayingFullscreen == 'false') OK
Toggling fullscreen state
EXPECTED (video.webkitDisplayingFullscreen == 'true') OK
END OF TEST
<html>
<head>
<script src="media-file.js"></script>
<script src=video-test.js></script>
<script>
function playing()
{
if (window.layoutTestController) {
if (!window.eventSender) {
layoutTestController.dumpAsText();
endTest();
return;
}
} else {
endTest();
return;
}
findMediaElement();
var x, y, items;
x = video.offsetParent.offsetLeft + video.offsetLeft + video.offsetWidth / 2;
y = video.offsetParent.offsetTop + video.offsetTop + video.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
items = eventSender.contextClick();
for (var i = 0; i < items.length; i++)
{
if (items[i].title.match("Controls")) {
testExpected("video.controls", true, '==');
consoleWrite("Toggling media controls");
items[i].click();
testExpected("video.controls", false, '==');
consoleWrite("");
}
if (items[i].title.match("Pause")) {
testExpected("video.paused", false, '==');
consoleWrite("Toggling play state");
items[i].click();
testExpected("video.paused", true, '==');
consoleWrite("");
}
if (items[i].title.match("Loop")) {
testExpected("video.loop", false, '==');
consoleWrite("Toggling loop state");
items[i].click();
testExpected("video.loop", true, '==');
consoleWrite("");
}
if (items[i].title.match("Mute")) {
testExpected("video.muted", false, '==');
consoleWrite("Toggling mute state");
items[i].click();
testExpected("video.muted", true, '==');
consoleWrite("");
}
if (items[i].title.match("Fullscreen") && video.webkitSupportsFullscreen) {
testExpected("video.webkitDisplayingFullscreen", false, '==');
consoleWrite("Toggling fullscreen state");
items[i].click();
testExpected("video.webkitDisplayingFullscreen", true, '==');
consoleWrite("");
}
// TODO: test copy link location and open in new window.
}
layoutTestController.dumpAsText();
endTest();
}
function start()
{
findMediaElement();
waitForEvent('play', playing);
run("video.src = '" + findMediaFile("video", "content/test") + "'");
}
</script>
</head>
<body onload="start()">
<p>Test the various actions available in the HTML5 media element context-menu.</p>
<video id="video" autoplay controls></video>
</body>
</html>
......@@ -310,3 +310,7 @@ fast/files/workers
# viewport meta tag support
fast/viewport
# needs enhanced eventSender.contextMenu() return value
# see also https://bugs.webkit.org/show_bug.cgi?id=45021
media/context-menu-actions.html
......@@ -2270,6 +2270,8 @@ editing/selection/5195166-1.html
# missing DRT feature, see also https://bugs.webkit.org/show_bug.cgi?id=39102
editing/selection/context-menu-on-text.html
# and https://bugs.webkit.org/show_bug.cgi?id=45021
media/context-menu-actions.html
# ============================================================================= #
# Failing editing/spelling tests
......
......@@ -298,6 +298,8 @@ http/tests/css/css-image-loading.html
# missing DRT feature, see also https://bugs.webkit.org/show_bug.cgi?id=39102
editing/selection/context-menu-on-text.html
# and https://bugs.webkit.org/show_bug.cgi?id=45021
media/context-menu-actions.html
################################################################################
####################### No bugs filed about the below yet#######################
......
2010-09-20 Philippe Normand <pnormand@igalia.com>
Reviewed by Eric Carlson.
[GTK] enhanced context menu for media elements
https://bugs.webkit.org/show_bug.cgi?id=45021
New items in the media Element context menu:
- play/pause
- mute/unmute
- controls display control
- switch to fullscreen (for video only)
- loop playback control
- copy media url to clipboard
- open in new window
Test: media/context-menu-actions.html
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
* platform/ContextMenu.cpp:
(WebCore::ContextMenu::populate):
(WebCore::ContextMenu::checkOrEnableIfNeeded):
* platform/ContextMenuItem.h:
* platform/LocalizationStrategy.h:
* platform/LocalizedStrings.cpp:
(WebCore::contextMenuItemTagOpenVideoInNewWindow):
(WebCore::contextMenuItemTagOpenAudioInNewWindow):
(WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
(WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
(WebCore::contextMenuItemTagToggleMediaControls):
(WebCore::contextMenuItemTagToggleMediaLoop):
(WebCore::contextMenuItemTagEnterVideoFullscreen):
(WebCore::contextMenuItemTagMediaPlay):
(WebCore::contextMenuItemTagMediaPause):
(WebCore::contextMenuItemTagMediaMute):
* platform/LocalizedStrings.h:
* platform/android/LocalizedStringsAndroid.cpp:
(WebCore::contextMenuItemTagOpenVideoInNewWindow):
(WebCore::contextMenuItemTagOpenAudioInNewWindow):
(WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
(WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
(WebCore::contextMenuItemTagToggleMediaControls):
(WebCore::contextMenuItemTagToggleMediaLoop):
(WebCore::contextMenuItemTagEnterVideoFullscreen):
(WebCore::contextMenuItemTagMediaPlay):
(WebCore::contextMenuItemTagMediaPause):
(WebCore::contextMenuItemTagMediaMute):
* platform/brew/LocalizedStringsBrew.cpp:
(WebCore::contextMenuItemTagOpenVideoInNewWindow):
(WebCore::contextMenuItemTagOpenAudioInNewWindow):
(WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
(WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
(WebCore::contextMenuItemTagToggleMediaControls):
(WebCore::contextMenuItemTagToggleMediaLoop):
(WebCore::contextMenuItemTagEnterVideoFullscreen):
(WebCore::contextMenuItemTagMediaPlay):
(WebCore::contextMenuItemTagMediaPause):
(WebCore::contextMenuItemTagMediaMute):
* platform/efl/LocalizedStringsEfl.cpp:
(WebCore::contextMenuItemTagOpenVideoInNewWindow):
(WebCore::contextMenuItemTagOpenAudioInNewWindow):
(WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
(WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
(WebCore::contextMenuItemTagToggleMediaControls):
(WebCore::contextMenuItemTagToggleMediaLoop):
(WebCore::contextMenuItemTagEnterVideoFullscreen):
(WebCore::contextMenuItemTagMediaPlay):
(WebCore::contextMenuItemTagMediaPause):
(WebCore::contextMenuItemTagMediaMute):
* platform/gtk/ContextMenuItemGtk.cpp:
(WebCore::gtkStockIDFromContextMenuAction):
* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::contextMenuItemTagOpenVideoInNewWindow):
(WebCore::contextMenuItemTagOpenAudioInNewWindow):
(WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
(WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
(WebCore::contextMenuItemTagToggleMediaControls):
(WebCore::contextMenuItemTagToggleMediaLoop):
(WebCore::contextMenuItemTagEnterVideoFullscreen):
(WebCore::contextMenuItemTagMediaPlay):
(WebCore::contextMenuItemTagMediaPause):
(WebCore::contextMenuItemTagMediaMute):
* platform/haiku/LocalizedStringsHaiku.cpp:
(WebCore::contextMenuItemTagOpenVideoInNewWindow):
(WebCore::contextMenuItemTagOpenAudioInNewWindow):
(WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
(WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
(WebCore::contextMenuItemTagToggleMediaControls):
(WebCore::contextMenuItemTagToggleMediaLoop):
(WebCore::contextMenuItemTagEnterVideoFullscreen):
(WebCore::contextMenuItemTagMediaPlay):
(WebCore::contextMenuItemTagMediaPause):
(WebCore::contextMenuItemTagMediaMute):
* platform/wx/LocalizedStringsWx.cpp:
(WebCore::contextMenuItemTagOpenVideoInNewWindow):
(WebCore::contextMenuItemTagOpenAudioInNewWindow):
(WebCore::contextMenuItemTagCopyVideoLinkToClipboard):
(WebCore::contextMenuItemTagCopyAudioLinkToClipboard):
(WebCore::contextMenuItemTagToggleMediaControls):
(WebCore::contextMenuItemTagToggleMediaLoop):
(WebCore::contextMenuItemTagEnterVideoFullscreen):
(WebCore::contextMenuItemTagMediaPlay):
(WebCore::contextMenuItemTagMediaPause):
(WebCore::contextMenuItemTagMediaMute):
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::absoluteMediaURL):
(WebCore::HitTestResult::mediaSupportsFullscreen):
(WebCore::HitTestResult::mediaElement):
(WebCore::HitTestResult::toggleMediaControlsDisplay):
(WebCore::HitTestResult::toggleMediaLoopPlayback):
(WebCore::HitTestResult::enterFullscreenForVideo):
(WebCore::HitTestResult::mediaControlsEnabled):
(WebCore::HitTestResult::mediaLoopEnabled):
(WebCore::HitTestResult::mediaPlaying):
(WebCore::HitTestResult::toggleMediaPlayState):
(WebCore::HitTestResult::mediaHasAudio):
(WebCore::HitTestResult::mediaMuted):
(WebCore::HitTestResult::toggleMediaMuteState):
* rendering/HitTestResult.h:
2010-09-20 Kwang Yul Seo <skyul@company100.net>
Reviewed by Daniel Bates.
/*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2010 Igalia S.L
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -186,6 +187,27 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
// For now, call into the client. This is temporary!
frame->editor()->copyImage(result);
break;
case ContextMenuItemTagOpenMediaInNewWindow:
openNewWindow(result.absoluteMediaURL(), frame);
break;
case ContextMenuItemTagCopyMediaLinkToClipboard:
frame->editor()->copyURL(result.absoluteMediaURL(), result.textContent());
break;
case ContextMenuItemTagToggleMediaControls:
result.toggleMediaControlsDisplay();
break;
case ContextMenuItemTagToggleMediaLoop:
result.toggleMediaLoopPlayback();
break;
case ContextMenuItemTagEnterVideoFullscreen:
result.enterFullscreenForVideo();
break;
case ContextMenuItemTagMediaPlayPause:
result.toggleMediaPlayState();
break;
case ContextMenuItemTagMediaMute:
result.toggleMediaMuteState();
break;
case ContextMenuItemTagOpenFrameInNewWindow: {
DocumentLoader* loader = frame->loader()->documentLoader();
if (!loader->unreachableURL().isEmpty())
......
/*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2008 Christian Dywan <christian@imendio.com>
* Copyright (C) 2010 Igalia S.L
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -282,6 +283,19 @@ void ContextMenu::populate()
contextMenuItemTagDownloadImageToDisk());
ContextMenuItem CopyImageItem(ActionType, ContextMenuItemTagCopyImageToClipboard,
contextMenuItemTagCopyImageToClipboard());
ContextMenuItem OpenMediaInNewWindowItem(ActionType, ContextMenuItemTagOpenMediaInNewWindow, String());
ContextMenuItem CopyMediaLinkItem(ActionType, ContextMenuItemTagCopyMediaLinkToClipboard,
String());
ContextMenuItem MediaPlayPause(ActionType, ContextMenuItemTagMediaPlayPause,
contextMenuItemTagMediaPlay());
ContextMenuItem MediaMute(ActionType, ContextMenuItemTagMediaMute,
contextMenuItemTagMediaMute());
ContextMenuItem ToggleMediaControls(CheckableActionType, ContextMenuItemTagToggleMediaControls,
contextMenuItemTagToggleMediaControls());
ContextMenuItem ToggleMediaLoop(CheckableActionType, ContextMenuItemTagToggleMediaLoop,
contextMenuItemTagToggleMediaLoop());
ContextMenuItem EnterVideoFullscreen(ActionType, ContextMenuItemTagEnterVideoFullscreen,
contextMenuItemTagEnterVideoFullscreen());
#if PLATFORM(MAC)
ContextMenuItem SearchSpotlightItem(ActionType, ContextMenuItemTagSearchInSpotlight,
contextMenuItemTagSearchInSpotlight());
......@@ -349,7 +363,23 @@ void ContextMenu::populate()
appendItem(CopyImageItem);
}
if (imageURL.isEmpty() && linkURL.isEmpty()) {
KURL mediaURL = result.absoluteMediaURL();
if (!mediaURL.isEmpty()) {
if (!linkURL.isEmpty() || !imageURL.isEmpty())
appendItem(*separatorItem());
appendItem(MediaPlayPause);
appendItem(MediaMute);
appendItem(ToggleMediaControls);
appendItem(ToggleMediaLoop);
appendItem(EnterVideoFullscreen);
appendItem(*separatorItem());
appendItem(CopyMediaLinkItem);
appendItem(OpenMediaInNewWindowItem);
}
if (imageURL.isEmpty() && linkURL.isEmpty() && mediaURL.isEmpty()) {
if (result.isSelected()) {
if (selectionContainsPossibleWord(frame)) {
#if PLATFORM(MAC)
......@@ -375,12 +405,6 @@ void ContextMenu::populate()
#if ENABLE(INSPECTOR)
if (!(frame->page() && frame->page()->inspectorController()->hasInspectorFrontendClient())) {
#endif
#if PLATFORM(GTK)
appendItem(BackItem);
appendItem(ForwardItem);
appendItem(StopItem);
appendItem(ReloadItem);
#else
if (frame->page() && frame->page()->canGoBackOrForward(-1))
appendItem(BackItem);
......@@ -393,7 +417,6 @@ void ContextMenu::populate()
appendItem(StopItem);
else
appendItem(ReloadItem);
#endif
#if ENABLE(INSPECTOR)
}
#endif
......@@ -788,6 +811,28 @@ void ContextMenu::checkOrEnableIfNeeded(ContextMenuItem& item) const
case ContextMenuItemTagOpenImageInNewWindow:
case ContextMenuItemTagDownloadImageToDisk:
case ContextMenuItemTagCopyImageToClipboard:
break;
case ContextMenuItemTagOpenMediaInNewWindow:
if (m_hitTestResult.mediaIsVideo())
item.setTitle(contextMenuItemTagOpenVideoInNewWindow());
else
item.setTitle(contextMenuItemTagOpenAudioInNewWindow());
break;
case ContextMenuItemTagCopyMediaLinkToClipboard:
if (m_hitTestResult.mediaIsVideo())
item.setTitle(contextMenuItemTagCopyVideoLinkToClipboard());
else
item.setTitle(contextMenuItemTagCopyAudioLinkToClipboard());
break;
case ContextMenuItemTagToggleMediaControls:
shouldCheck = m_hitTestResult.mediaControlsEnabled();
break;
case ContextMenuItemTagToggleMediaLoop:
shouldCheck = m_hitTestResult.mediaLoopEnabled();
break;
case ContextMenuItemTagEnterVideoFullscreen:
shouldEnable = m_hitTestResult.mediaSupportsFullscreen();
break;
case ContextMenuItemTagOpenFrameInNewWindow:
case ContextMenuItemTagSpellingGuess:
case ContextMenuItemTagOther:
......@@ -823,6 +868,16 @@ void ContextMenu::checkOrEnableIfNeeded(ContextMenuItem& item) const
case ContextMenuItemLastCustomTag:
case ContextMenuItemBaseApplicationTag:
break;
case ContextMenuItemTagMediaPlayPause:
if (m_hitTestResult.mediaPlaying())
item.setTitle(contextMenuItemTagMediaPause());
else
item.setTitle(contextMenuItemTagMediaPlay());
break;
case ContextMenuItemTagMediaMute:
shouldEnable = m_hitTestResult.mediaHasAudio();
shouldCheck = shouldEnable && m_hitTestResult.mediaMuted();
break;
}
item.setChecked(shouldCheck);
......
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2010 Igalia S.L
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -143,6 +144,13 @@ namespace WebCore {
ContextMenuItemTagCapitalize,
ContextMenuItemTagChangeBack,
#endif
ContextMenuItemTagOpenMediaInNewWindow,
ContextMenuItemTagCopyMediaLinkToClipboard,
ContextMenuItemTagToggleMediaControls,
ContextMenuItemTagToggleMediaLoop,
ContextMenuItemTagEnterVideoFullscreen,
ContextMenuItemTagMediaPlayPause,
ContextMenuItemTagMediaMute,
ContextMenuItemBaseCustomTag = 5000,
ContextMenuItemCustomTagNoAction = 5998,
ContextMenuItemLastCustomTag = 5999,
......
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
* Copyright (C) 2010 Igalia S.L
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -112,6 +113,16 @@ public:
virtual String contextMenuItemTagCapitalize() = 0;
virtual String contextMenuItemTagChangeBack(const String& replacedString) = 0;
#endif
virtual String contextMenuItemTagOpenVideoInNewWindow() = 0;
virtual String contextMenuItemTagOpenAudioInNewWindow() = 0;
virtual String contextMenuItemTagCopyVideoLinkToClipboard() = 0;
virtual String contextMenuItemTagCopyAudioLinkToClipboard() = 0;
virtual String contextMenuItemTagToggleMediaControls() = 0;
virtual String contextMenuItemTagToggleMediaLoop() = 0;
virtual String contextMenuItemTagEnterVideoFullscreen() = 0;
virtual String contextMenuItemTagMediaPlay() = 0;
virtual String contextMenuItemTagMediaPause() = 0;
virtual String contextMenuItemTagMediaMute() = 0;
virtual String contextMenuItemTagInspectElement() = 0;
#endif // ENABLE(CONTEXT_MENUS)
......
/*
* Copyright (C) 2003, 2006, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2010 Igalia S.L
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -362,6 +363,56 @@ String contextMenuItemTagChangeBack(const String& replacedString)
}
#endif // PLATFORM(MAC)
String contextMenuItemTagOpenVideoInNewWindow()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagOpenVideoInNewWindow();
}
String contextMenuItemTagOpenAudioInNewWindow()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagOpenAudioInNewWindow();
}
String contextMenuItemTagCopyVideoLinkToClipboard()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagCopyVideoLinkToClipboard();
}
String contextMenuItemTagCopyAudioLinkToClipboard()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagCopyAudioLinkToClipboard();
}
String contextMenuItemTagToggleMediaControls()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagToggleMediaControls();
}
String contextMenuItemTagToggleMediaLoop()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagToggleMediaLoop();
}
String contextMenuItemTagEnterVideoFullscreen()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagEnterVideoFullscreen();
}
String contextMenuItemTagMediaPlay()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagMediaPlay();
}
String contextMenuItemTagMediaPause()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagMediaPause();
}
String contextMenuItemTagMediaMute()
{
return platformStrategies()->localizationStrategy()->contextMenuItemTagMediaMute();
}
String contextMenuItemTagInspectElement()
{
......
/*
* Copyright (C) 2003, 2006, 2009 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2010 Igalia S.L
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -108,6 +109,16 @@ namespace WebCore {
String contextMenuItemTagCapitalize();
String contextMenuItemTagChangeBack(const String& replacedString);
#endif
String contextMenuItemTagOpenVideoInNewWindow();
String contextMenuItemTagOpenAudioInNewWindow();
String contextMenuItemTagCopyVideoLinkToClipboard();
String contextMenuItemTagCopyAudioLinkToClipboard();
String contextMenuItemTagToggleMediaControls();
String contextMenuItemTagToggleMediaLoop();
String contextMenuItemTagEnterVideoFullscreen();
String contextMenuItemTagMediaPlay();
String contextMenuItemTagMediaPause();
String contextMenuItemTagMediaMute();
String contextMenuItemTagInspectElement();
#endif // ENABLE(CONTEXT_MENUS)
......
......@@ -81,6 +81,66 @@ String contextMenuItemTagCopyImageToClipboard()
return String();
}
String contextMenuItemTagOpenVideoInNewWindow()
{
notImplemented();
return String();
}
String contextMenuItemTagOpenAudioInNewWindow()
{
notImplemented();
return String();
}
String contextMenuItemTagCopyVideoLinkToClipboard()
{
notImplemented();
return String();
}
String contextMenuItemTagCopyAudioLinkToClipboard()
{
notImplemented();
return String();
}
String contextMenuItemTagToggleMediaControls()
{
notImplemented();
return String();
}
String contextMenuItemTagToggleMediaLoop()
{
notImplemented();
return String();
}
String contextMenuItemTagEnterVideoFullscreen()
{
notImplemented();
return String();
}
String contextMenuItemTagMediaPlay()
{
notImplemented();
return String();
}
String contextMenuItemTagMediaPause()
{
notImplemented();
return String();
}
String contextMenuItemTagMediaMute()
{
notImplemented();
return String();
}
String contextMenuItemTagOpenFrameInNewWindow()
{
notImplemented();
......
......@@ -96,6 +96,56 @@ String contextMenuItemTagCopyImageToClipboard()
return "Copy image to clipboard";
}
String contextMenuItemTagOpenVideoInNewWindow()
{
return "Open video in new window";
}
String contextMenuItemTagOpenAudioInNewWindow()
{
return "Open audio in new window";
}
String contextMenuItemTagCopyVideoLinkToClipboard()
{
return "Copy Video link location";
}
String contextMenuItemTagCopyAudioLinkToClipboard()
{