[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

philn at webkit.org philn at webkit.org
Wed Dec 22 13:36:10 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit fd50428dcbf3beb3abc002aeae8c13a983c339c4
Author: philn at webkit.org <philn at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 21 06:54:09 2010 +0000

    2010-09-20  Philippe Normand  <pnormand at 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

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index f3eb032..3eb8c59 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-20  Philippe Normand  <pnormand at 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 at chromium.org>
 
         Unreviewed Chromium test_expectations.txt update.
diff --git a/LayoutTests/media/context-menu-actions-expected.txt b/LayoutTests/media/context-menu-actions-expected.txt
new file mode 100644
index 0000000..6918f3d
--- /dev/null
+++ b/LayoutTests/media/context-menu-actions-expected.txt
@@ -0,0 +1,26 @@
+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
+
diff --git a/LayoutTests/media/context-menu-actions.html b/LayoutTests/media/context-menu-actions.html
new file mode 100644
index 0000000..ae80f14
--- /dev/null
+++ b/LayoutTests/media/context-menu-actions.html
@@ -0,0 +1,91 @@
+<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>
+
diff --git a/LayoutTests/platform/mac/Skipped b/LayoutTests/platform/mac/Skipped
index b8ca528..b4111ae 100644
--- a/LayoutTests/platform/mac/Skipped
+++ b/LayoutTests/platform/mac/Skipped
@@ -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
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 429f15e..1fd47a0 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -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
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index ef4d6be..10a8f36 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -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#######################
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index af731b2..2904549 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,124 @@
+2010-09-20  Philippe Normand  <pnormand at 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 at company100.net>
 
         Reviewed by Daniel Bates.
diff --git a/WebCore/page/ContextMenuController.cpp b/WebCore/page/ContextMenuController.cpp
index d2317d2..de64988 100644
--- a/WebCore/page/ContextMenuController.cpp
+++ b/WebCore/page/ContextMenuController.cpp
@@ -1,5 +1,6 @@
 /*
  * 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())
diff --git a/WebCore/platform/ContextMenu.cpp b/WebCore/platform/ContextMenu.cpp
index 37d4c2b..ca1f719 100644
--- a/WebCore/platform/ContextMenu.cpp
+++ b/WebCore/platform/ContextMenu.cpp
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Christian Dywan <christian at 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);
diff --git a/WebCore/platform/ContextMenuItem.h b/WebCore/platform/ContextMenuItem.h
index 058f644..f7fa5e6 100644
--- a/WebCore/platform/ContextMenuItem.h
+++ b/WebCore/platform/ContextMenuItem.h
@@ -1,5 +1,6 @@
 /*
  * 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,
diff --git a/WebCore/platform/LocalizationStrategy.h b/WebCore/platform/LocalizationStrategy.h
index 178cfa2..1fe138a 100644
--- a/WebCore/platform/LocalizationStrategy.h
+++ b/WebCore/platform/LocalizationStrategy.h
@@ -1,5 +1,6 @@
 /*
  * 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)
 
diff --git a/WebCore/platform/LocalizedStrings.cpp b/WebCore/platform/LocalizedStrings.cpp
index a69e0fb..012d90e 100644
--- a/WebCore/platform/LocalizedStrings.cpp
+++ b/WebCore/platform/LocalizedStrings.cpp
@@ -1,5 +1,6 @@
 /*
  * 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()
 {
diff --git a/WebCore/platform/LocalizedStrings.h b/WebCore/platform/LocalizedStrings.h
index 04042b6..a72eb8a 100644
--- a/WebCore/platform/LocalizedStrings.h
+++ b/WebCore/platform/LocalizedStrings.h
@@ -1,5 +1,6 @@
 /*
  * 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)
 
diff --git a/WebCore/platform/android/LocalizedStringsAndroid.cpp b/WebCore/platform/android/LocalizedStringsAndroid.cpp
index 2fc880b..fa4f86a 100644
--- a/WebCore/platform/android/LocalizedStringsAndroid.cpp
+++ b/WebCore/platform/android/LocalizedStringsAndroid.cpp
@@ -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();
diff --git a/WebCore/platform/brew/LocalizedStringsBrew.cpp b/WebCore/platform/brew/LocalizedStringsBrew.cpp
index 1bc5985..2dfd12b 100644
--- a/WebCore/platform/brew/LocalizedStringsBrew.cpp
+++ b/WebCore/platform/brew/LocalizedStringsBrew.cpp
@@ -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()
+{
+    return "Copy audio link location";
+}
+
+String contextMenuItemTagToggleMediaControls()
+{
+    return "Toggle media controls";
+}
+
+String contextMenuItemTagToggleMediaLoop()
+{
+    return "Toggle media loop playback";
+}
+
+String contextMenuItemTagEnterVideoFullscreen()
+{
+    return "Switch video to fullscreen";
+}
+
+String contextMenuItemTagMediaPlay()
+{
+    return "Play";
+}
+
+String contextMenuItemTagMediaPause()
+{
+    return "Pause";
+}
+
+String contextMenuItemTagMediaMute()
+{
+    return "Mute";
+}
+
 String contextMenuItemTagOpenFrameInNewWindow()
 {
     return "Open frame in new window";
diff --git a/WebCore/platform/efl/LocalizedStringsEfl.cpp b/WebCore/platform/efl/LocalizedStringsEfl.cpp
index 6023205..a81434f 100644
--- a/WebCore/platform/efl/LocalizedStringsEfl.cpp
+++ b/WebCore/platform/efl/LocalizedStringsEfl.cpp
@@ -98,6 +98,56 @@ String contextMenuItemTagCopyImageToClipboard()
     return String::fromUTF8("Copy Image");
 }
 
+String contextMenuItemTagOpenVideoInNewWindow()
+{
+    return String::fromUTF8("Open Video in New Window");
+}
+
+String contextMenuItemTagOpenAudioInNewWindow()
+{
+    return String::fromUTF8("Open Audio in New Window");
+}
+
+String contextMenuItemTagCopyVideoLinkToClipboard()
+{
+    return String::fromUTF8("Copy Video Link Location");
+}
+
+String contextMenuItemTagCopyAudioLinkToClipboard()
+{
+    return String::fromUTF8("Copy Audio Link Location");
+}
+
+String contextMenuItemTagToggleMediaControls()
+{
+    return String::fromUTF8("Toggle Media Controls");
+}
+
+String contextMenuItemTagToggleMediaLoop()
+{
+    return String::fromUTF8("Toggle Media Loop Playback");
+}
+
+String contextMenuItemTagEnterVideoFullscreen()
+{
+    return String::fromUTF8("Switch Video to Fullscreen");
+}
+
+String contextMenuItemTagMediaPlay()
+{
+    return String::fromUTF8("Play");
+}
+
+String contextMenuItemTagMediaPause()
+{
+    return String::fromUTF8("Pause");
+}
+
+String contextMenuItemTagMediaMute()
+{
+    return String::fromUTF8("Mute");
+}
+
 String contextMenuItemTagOpenFrameInNewWindow()
 {
     return String::fromUTF8("Open Frame in New Window");
diff --git a/WebCore/platform/gtk/ContextMenuItemGtk.cpp b/WebCore/platform/gtk/ContextMenuItemGtk.cpp
index e2c5b84..68d0a9a 100644
--- a/WebCore/platform/gtk/ContextMenuItemGtk.cpp
+++ b/WebCore/platform/gtk/ContextMenuItemGtk.cpp
@@ -1,5 +1,6 @@
 /*
  *  Copyright (C) 2007 Holger Hans Peter Freyther
+ *  Copyright (C) 2010 Igalia S.L
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -33,11 +34,13 @@ static const char* gtkStockIDFromContextMenuAction(const ContextMenuAction& acti
     switch (action) {
     case ContextMenuItemTagCopyLinkToClipboard:
     case ContextMenuItemTagCopyImageToClipboard:
+    case ContextMenuItemTagCopyMediaLinkToClipboard:
     case ContextMenuItemTagCopy:
         return GTK_STOCK_COPY;
     case ContextMenuItemTagOpenLinkInNewWindow:
     case ContextMenuItemTagOpenImageInNewWindow:
     case ContextMenuItemTagOpenFrameInNewWindow:
+    case ContextMenuItemTagOpenMediaInNewWindow:
         return GTK_STOCK_OPEN;
     case ContextMenuItemTagDownloadLinkToDisk:
     case ContextMenuItemTagDownloadImageToDisk:
@@ -59,7 +62,7 @@ static const char* gtkStockIDFromContextMenuAction(const ContextMenuAction& acti
     case ContextMenuItemTagSelectAll:
         return GTK_STOCK_SELECT_ALL;
     case ContextMenuItemTagSpellingGuess:
-        return NULL;
+        return 0;
     case ContextMenuItemTagIgnoreSpelling:
         return GTK_STOCK_NO;
     case ContextMenuItemTagLearnSpelling:
@@ -99,8 +102,14 @@ static const char* gtkStockIDFromContextMenuAction(const ContextMenuAction& acti
         return GTK_STOCK_UNDERLINE;
     case ContextMenuItemTagShowColors:
         return GTK_STOCK_SELECT_COLOR;
+    case ContextMenuItemTagToggleMediaControls:
+    case ContextMenuItemTagToggleMediaLoop:
+        // No icon for this.
+        return 0;
+    case ContextMenuItemTagEnterVideoFullscreen:
+        return GTK_STOCK_FULLSCREEN;
     default:
-        return NULL;
+        return 0;
     }
 }
 
diff --git a/WebCore/platform/gtk/LocalizedStringsGtk.cpp b/WebCore/platform/gtk/LocalizedStringsGtk.cpp
index 432c92f..7851326 100644
--- a/WebCore/platform/gtk/LocalizedStringsGtk.cpp
+++ b/WebCore/platform/gtk/LocalizedStringsGtk.cpp
@@ -4,6 +4,7 @@
  * Copyright (C) 2007 Holger Hans Peter Freyther
  * Copyright (C) 2008 Christian Dywan <christian at imendio.com>
  * Copyright (C) 2008 Nuanti Ltd.
+ * 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
@@ -110,6 +111,56 @@ String contextMenuItemTagCopyImageToClipboard()
     return String::fromUTF8(_("Cop_y Image"));
 }
 
+String contextMenuItemTagOpenVideoInNewWindow()
+{
+    return String::fromUTF8(_("Open _Video in New Window"));
+}
+
+String contextMenuItemTagOpenAudioInNewWindow()
+{
+    return String::fromUTF8(_("Open _Audio in New Window"));
+}
+
+String contextMenuItemTagCopyVideoLinkToClipboard()
+{
+    return String::fromUTF8(_("Cop_y Video Link Location"));
+}
+
+String contextMenuItemTagCopyAudioLinkToClipboard()
+{
+    return String::fromUTF8(_("Cop_y Audio Link Location"));
+}
+
+String contextMenuItemTagToggleMediaControls()
+{
+    return String::fromUTF8(_("_Toggle Media Controls"));
+}
+
+String contextMenuItemTagToggleMediaLoop()
+{
+    return String::fromUTF8(_("Toggle Media _Loop Playback"));
+}
+
+String contextMenuItemTagEnterVideoFullscreen()
+{
+    return String::fromUTF8(_("Switch Video to _Fullscreen"));
+}
+
+String contextMenuItemTagMediaPlay()
+{
+    return String::fromUTF8(_("_Play"));
+}
+
+String contextMenuItemTagMediaPause()
+{
+    return String::fromUTF8(_("_Pause"));
+}
+
+String contextMenuItemTagMediaMute()
+{
+    return String::fromUTF8(_("_Mute"));
+}
+
 String contextMenuItemTagOpenFrameInNewWindow()
 {
     return String::fromUTF8(_("Open _Frame in New Window"));
diff --git a/WebCore/platform/haiku/LocalizedStringsHaiku.cpp b/WebCore/platform/haiku/LocalizedStringsHaiku.cpp
index 5321792..4c12cf3 100644
--- a/WebCore/platform/haiku/LocalizedStringsHaiku.cpp
+++ b/WebCore/platform/haiku/LocalizedStringsHaiku.cpp
@@ -98,6 +98,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()
+{
+    return "Copy audio link location";
+}
+
+String contextMenuItemTagToggleMediaControls()
+{
+    return "Toggle media controls";
+}
+
+String contextMenuItemTagToggleMediaLoop()
+{
+    return "Toggle media loop playback";
+}
+
+String contextMenuItemTagEnterVideoFullscreen()
+{
+    return "Switch video to fullscreen";
+}
+
+String contextMenuItemTagMediaPlay()
+{
+    return "Play";
+}
+
+String contextMenuItemTagMediaPause()
+{
+    return "Pause";
+}
+
+String contextMenuItemTagMediaMute()
+{
+    return "Mute";
+}
+
 String contextMenuItemTagOpenFrameInNewWindow()
 {
     return "Open frame in new window";
diff --git a/WebCore/platform/wx/LocalizedStringsWx.cpp b/WebCore/platform/wx/LocalizedStringsWx.cpp
index 4112f64..10ea435 100644
--- a/WebCore/platform/wx/LocalizedStringsWx.cpp
+++ b/WebCore/platform/wx/LocalizedStringsWx.cpp
@@ -97,6 +97,56 @@ String contextMenuItemTagCopyImageToClipboard()
     return String("Copy Image to Clipboard"); 
 }
 
+String contextMenuItemTagOpenVideoInNewWindow()
+{
+    return String("Open Video in New Window");
+}
+
+String contextMenuItemTagOpenAudioInNewWindow()
+{
+    return String("Open Audio in New Window");
+}
+
+String contextMenuItemTagCopyVideoLinkToClipboard()
+{
+    return String("Copy Video Link Location");
+}
+
+String contextMenuItemTagCopyAudioLinkToClipboard()
+{
+    return String("Copy Audio Link Location");
+}
+
+String contextMenuItemTagToggleMediaControls()
+{
+    return String("Toggle Media Controls");
+}
+
+String contextMenuItemTagToggleMediaLoop()
+{
+    return String("Toggle Media Loop Playback");
+}
+
+String contextMenuItemTagEnterVideoFullscreen()
+{
+    return String("Switch Video to Fullscreen");
+}
+
+String contextMenuItemTagMediaPlay()
+{
+    return String("Play");
+}
+
+String contextMenuItemTagMediaPause()
+{
+    return String("Pause");
+}
+
+String contextMenuItemTagMediaMute()
+{
+    return String("Mute");
+}
+
 String contextMenuItemTagOpenFrameInNewWindow() 
 { 
     return String("Open Frame in New Window"); 
diff --git a/WebCore/rendering/HitTestResult.cpp b/WebCore/rendering/HitTestResult.cpp
index 496c4ba..f28692e 100644
--- a/WebCore/rendering/HitTestResult.cpp
+++ b/WebCore/rendering/HitTestResult.cpp
@@ -24,6 +24,7 @@
 #include "Frame.h"
 #include "FrameTree.h"
 #include "HTMLAnchorElement.h"
+#include "HTMLVideoElement.h"
 #include "HTMLImageElement.h"
 #include "HTMLInputElement.h"
 #include "HTMLMediaElement.h"
@@ -292,22 +293,134 @@ KURL HitTestResult::absoluteImageURL() const
 KURL HitTestResult::absoluteMediaURL() const
 {
 #if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        return m_innerNonSharedNode->document()->completeURL(deprecatedParseURL(mediaElt->currentSrc()));
+    return KURL();
+#else
+    return KURL();
+#endif
+}
+
+bool HitTestResult::mediaSupportsFullscreen() const
+{
+#if ENABLE(VIDEO)
+    HTMLMediaElement* mediaElt(mediaElement());
+    return (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag) && mediaElt->supportsFullscreen());
+#else
+    return false;
+#endif
+}
+
+#if ENABLE(VIDEO)
+HTMLMediaElement* HitTestResult::mediaElement() const
+{
     if (!(m_innerNonSharedNode && m_innerNonSharedNode->document()))
-        return KURL();
+        return 0;
 
     if (!(m_innerNonSharedNode->renderer() && m_innerNonSharedNode->renderer()->isMedia()))
-        return KURL();
+        return 0;
 
-    AtomicString urlString;
-    if (m_innerNonSharedNode->hasTagName(HTMLNames::videoTag) || m_innerNonSharedNode->hasTagName(HTMLNames::audioTag)) {
-        HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(m_innerNonSharedNode.get());
-        urlString = mediaElement->currentSrc();
-    } else
-        return KURL();
+    if (m_innerNonSharedNode->hasTagName(HTMLNames::videoTag) || m_innerNonSharedNode->hasTagName(HTMLNames::audioTag))
+        return static_cast<HTMLMediaElement*>(m_innerNonSharedNode.get());
+    return 0;
+}
+#endif
 
-    return m_innerNonSharedNode->document()->completeURL(deprecatedParseURL(urlString));
-#else
-    return KURL();
+void HitTestResult::toggleMediaControlsDisplay() const
+{
+#if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        mediaElt->setControls(!mediaElt->controls());
+#endif
+}
+
+void HitTestResult::toggleMediaLoopPlayback() const
+{
+#if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        mediaElt->setLoop(!mediaElt->loop());
+#endif
+}
+
+void HitTestResult::enterFullscreenForVideo() const
+{
+#if ENABLE(VIDEO)
+    HTMLMediaElement* mediaElt(mediaElement());
+    if (mediaElt && mediaElt->hasTagName(HTMLNames::videoTag)) {
+        HTMLVideoElement* videoElt = static_cast<HTMLVideoElement*>(mediaElt);
+        if (!videoElt->isFullscreen() && mediaElt->supportsFullscreen())
+            videoElt->enterFullscreen();
+    }
+#endif
+}
+
+bool HitTestResult::mediaControlsEnabled() const
+{
+#if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        return mediaElt->controls();
+#endif
+    return false;
+}
+
+bool HitTestResult::mediaLoopEnabled() const
+{
+#if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        return mediaElt->loop();
+#endif
+    return false;
+}
+
+bool HitTestResult::mediaPlaying() const
+{
+#if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        return !mediaElt->paused();
+#endif
+    return false;
+}
+
+void HitTestResult::toggleMediaPlayState() const
+{
+#if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        mediaElt->togglePlayState();
+#endif
+}
+
+bool HitTestResult::mediaHasAudio() const
+{
+#if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        return mediaElt->hasAudio();
+#endif
+    return false;
+}
+
+bool HitTestResult::mediaIsVideo() const
+{
+#if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        return mediaElt->hasTagName(HTMLNames::videoTag);
+#endif
+    return false;
+}
+
+bool HitTestResult::mediaMuted() const
+{
+#if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        return mediaElt->muted();
+#endif
+    return false;
+}
+
+void HitTestResult::toggleMediaMuteState() const
+{
+#if ENABLE(VIDEO)
+    if (HTMLMediaElement* mediaElt = mediaElement())
+        mediaElt->setMuted(!mediaElt->muted());
 #endif
 }
 
diff --git a/WebCore/rendering/HitTestResult.h b/WebCore/rendering/HitTestResult.h
index 3a42719..31e88f1 100644
--- a/WebCore/rendering/HitTestResult.h
+++ b/WebCore/rendering/HitTestResult.h
@@ -32,6 +32,9 @@ namespace WebCore {
 
 class Element;
 class Frame;
+#if ENABLE(VIDEO)
+class HTMLMediaElement;
+#endif
 class Image;
 class IntRect;
 class KURL;
@@ -80,6 +83,18 @@ public:
     String textContent() const;
     bool isLiveLink() const;
     bool isContentEditable() const;
+    void toggleMediaControlsDisplay() const;
+    void toggleMediaLoopPlayback() const;
+    void enterFullscreenForVideo() const;
+    bool mediaControlsEnabled() const;
+    bool mediaLoopEnabled() const;
+    bool mediaPlaying() const;
+    bool mediaSupportsFullscreen() const;
+    void toggleMediaPlayState() const;
+    bool mediaHasAudio() const;
+    bool mediaIsVideo() const;
+    bool mediaMuted() const;
+    void toggleMediaMuteState() const;
 
     // Rect-based hit test related methods.
     bool isRectBasedTest() const { return m_isRectBased; }
@@ -96,6 +111,10 @@ public:
 
 private:
 
+#if ENABLE(VIDEO)
+    HTMLMediaElement* mediaElement() const;
+#endif
+
     RefPtr<Node> m_innerNode;
     RefPtr<Node> m_innerNonSharedNode;
     IntPoint m_point;
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index c6da648..19ddf85 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-20  Philippe Normand  <pnormand at igalia.com>
+
+        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:
+
 2010-09-17  David Kilzer  <ddkilzer at apple.com>
 
         <http://webkit.org/b/45989> Add WebArchiveInternal.h to Xcode project
diff --git a/WebKit/English.lproj/Localizable.strings b/WebKit/English.lproj/Localizable.strings
index 615dc9a..3d09f86 100644
Binary files a/WebKit/English.lproj/Localizable.strings and b/WebKit/English.lproj/Localizable.strings differ
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 066c989..56f2c5a 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,24 @@
+2010-09-20  Philippe Normand  <pnormand at igalia.com>
+
+        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):
+
 2010-09-20  Nico Weber  <thakis at chromium.org>
 
         Reviewed by James Robinson.
diff --git a/WebKit/chromium/src/LocalizedStrings.cpp b/WebKit/chromium/src/LocalizedStrings.cpp
index 74ff699..3354c30 100644
--- a/WebKit/chromium/src/LocalizedStrings.cpp
+++ b/WebKit/chromium/src/LocalizedStrings.cpp
@@ -265,6 +265,16 @@ String contextMenuItemTagInspectElement() { return String(); }
 String contextMenuItemTagShowSpellingPanel(bool show) { return String(); }
 String mediaElementLiveBroadcastStateText() { return String(); }
 String mediaElementLoadingStateText() { return String(); }
+String contextMenuItemTagOpenVideoInNewWindow() { return String(); }
+String contextMenuItemTagOpenAudioInNewWindow() { return String(); }
+String contextMenuItemTagCopyVideoLinkToClipboard() { return String(); }
+String contextMenuItemTagCopyAudioLinkToClipboard() { return String(); }
+String contextMenuItemTagToggleMediaControls() { return String(); }
+String contextMenuItemTagToggleMediaLoop() { return String(); }
+String contextMenuItemTagEnterVideoFullscreen() { return String(); }
+String contextMenuItemTagMediaPlay() { return String(); }
+String contextMenuItemTagMediaPause() { return String(); }
+String contextMenuItemTagMediaMute() { return String(); }
 
 String localizedMediaControlElementString(const String& /*name*/)
 {
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index a43b4c5..c3b9f55 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,25 @@
+2010-09-20  Philippe Normand  <pnormand at igalia.com>
+
+        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):
+
 2010-09-20  Andy Estes  <aestes at apple.com>
 
         Reviewed by Adam Barth.
diff --git a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
index 53f39f8..a1e0317 100644
--- a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
+++ b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
@@ -113,6 +113,16 @@ private:
     virtual WTF::String contextMenuItemTagCapitalize();
     virtual WTF::String contextMenuItemTagChangeBack(const WTF::String& replacedString);
     virtual WTF::String contextMenuItemTagInspectElement();
+    virtual WTF::String contextMenuItemTagOpenVideoInNewWindow();
+    virtual WTF::String contextMenuItemTagOpenAudioInNewWindow();
+    virtual WTF::String contextMenuItemTagCopyVideoLinkToClipboard();
+    virtual WTF::String contextMenuItemTagCopyAudioLinkToClipboard();
+    virtual WTF::String contextMenuItemTagToggleMediaControls();
+    virtual WTF::String contextMenuItemTagToggleMediaLoop();
+    virtual WTF::String contextMenuItemTagEnterVideoFullscreen();
+    virtual WTF::String contextMenuItemTagMediaPlay();
+    virtual WTF::String contextMenuItemTagMediaPause();
+    virtual WTF::String contextMenuItemTagMediaMute();
 #endif // ENABLE(CONTEXT_MENUS)
     virtual WTF::String searchMenuNoRecentSearchesText();
     virtual WTF::String searchMenuRecentSearchesText();
diff --git a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
index 2900ccf..18e8a61 100644
--- a/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
+++ b/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
@@ -156,6 +156,56 @@ String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard()
     return UI_STRING("Copy Image", "Copy Image context menu item");
 }
 
+String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow()
+{
+    return UI_STRING("Open Video in New Window", "Open Video in New Window context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow()
+{
+    return UI_STRING("Open Audio in New Window", "Open Audio in New Window context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard()
+{
+    return UI_STRING("Copy Video Address", "Copy Video Address Location context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard()
+{
+    return UI_STRING("Copy Audio Address", "Copy Audio Address Location context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagToggleMediaControls()
+{
+    return UI_STRING("Controls", "Media Controls context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagToggleMediaLoop()
+{
+    return UI_STRING("Loop", "Media Loop context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen()
+{
+    return UI_STRING("Enter Fullscreen", "Video Enter Fullscreen context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaPlay()
+{
+    return UI_STRING("Play", "Media Play context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaPause()
+{
+    return UI_STRING("Pause", "Media Pause context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaMute()
+{
+    return UI_STRING("Mute", "Media Mute context menu item");
+}
+
 String WebPlatformStrategies::contextMenuItemTagOpenFrameInNewWindow()
 {
     return UI_STRING("Open Frame in New Window", "Open Frame in New Window context menu item");
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 34edbd7..3b28536 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,23 @@
+2010-09-20  Philippe Normand  <pnormand at igalia.com>
+
+        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)
+
 2010-09-20  Jacob Dinu  <dinu.jacob at nokia.com>
 
         Reviewed by Adam Barth.
diff --git a/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp
index 948e0cd..3750b22 100644
--- a/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp
+++ b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp
@@ -198,6 +198,56 @@ String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard()
     return QCoreApplication::translate("QWebPage", "Copy Image", "Copy Link context menu item");
 }
 
+String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow()
+{
+    return QCoreApplication::translate("QWebPage", "Open Video", "Open Video in New Window");
+}
+
+String WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow()
+{
+    return QCoreApplication::translate("QWebPage", "Open Audio", "Open Audio in New Window");
+}
+
+String WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard()
+{
+    return QCoreApplication::translate("QWebPage", "Copy Video", "Copy Video Link Location");
+}
+
+String WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard()
+{
+    return QCoreApplication::translate("QWebPage", "Copy Audio", "Copy Audio Link Location");
+}
+
+String WebPlatformStrategies::contextMenuItemTagToggleMediaControls()
+{
+    return QCoreApplication::translate("QWebPage", "Toggle Controls", "Toggle Media Controls");
+}
+
+String WebPlatformStrategies::contextMenuItemTagToggleMediaLoop()
+{
+    return QCoreApplication::translate("QWebPage", "Toggle Loop", "Toggle Media Loop Playback");
+}
+
+String WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen()
+{
+    return QCoreApplication::translate("QWebPage", "Enter Fullscreen", "Switch Video to Fullscreen");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaPlay()
+{
+    return QCoreApplication::translate("QWebPage", "Play", "Play");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaPause()
+{
+    return QCoreApplication::translate("QWebPage", "Pause", "Pause");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaMute()
+{
+    return QCoreApplication::translate("QWebPage", "Mute", "Mute");
+}
+
 String WebPlatformStrategies::contextMenuItemTagOpenFrameInNewWindow()
 {
     return QCoreApplication::translate("QWebPage", "Open Frame", "Open Frame in New Window context menu item");
diff --git a/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h
index 8ea60d9..ead813b 100644
--- a/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h
+++ b/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h
@@ -95,6 +95,16 @@ private:
     virtual WTF::String contextMenuItemTagLeftToRight();
     virtual WTF::String contextMenuItemTagRightToLeft();
     virtual WTF::String contextMenuItemTagInspectElement();
+    virtual WTF::String contextMenuItemTagOpenVideoInNewWindow();
+    virtual WTF::String contextMenuItemTagOpenAudioInNewWindow();
+    virtual WTF::String contextMenuItemTagCopyVideoLinkToClipboard();
+    virtual WTF::String contextMenuItemTagCopyAudioLinkToClipboard();
+    virtual WTF::String contextMenuItemTagToggleMediaControls();
+    virtual WTF::String contextMenuItemTagToggleMediaLoop();
+    virtual WTF::String contextMenuItemTagEnterVideoFullscreen();
+    virtual WTF::String contextMenuItemTagMediaPlay();
+    virtual WTF::String contextMenuItemTagMediaPause();
+    virtual WTF::String contextMenuItemTagMediaMute();
     virtual WTF::String searchMenuNoRecentSearchesText();
     virtual WTF::String searchMenuRecentSearchesText();
     virtual WTF::String searchMenuClearRecentSearchesText();
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 251bf91..a8aa424 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,25 @@
+2010-09-20  Philippe Normand  <pnormand at igalia.com>
+
+        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:
+
 2010-09-17  Darin Adler  <darin at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp b/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp
index 00a2eab..7d8bd0c 100644
--- a/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp
+++ b/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp
@@ -163,6 +163,56 @@ String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard()
     return UI_STRING("Copy Image", "Copy Image context menu item");
 }
 
+String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow()
+{
+    return UI_STRING("Open Video in New Window", "Open Video in New Window context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow()
+{
+    return UI_STRING("Open Audio in New Window", "Open Audio in New Window context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard()
+{
+    return UI_STRING("Copy Video Address", "Copy Video Address Location context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard()
+{
+    return UI_STRING("Copy Audio Address", "Copy Audio Address Location context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagToggleMediaControls()
+{
+    return UI_STRING("Controls", "Media Controls context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagToggleMediaLoop()
+{
+    return UI_STRING("Loop", "Media Loop context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen()
+{
+    return UI_STRING("Enter Fullscreen", "Video Enter Fullscreen context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaPlay()
+{
+    return UI_STRING("Play", "Media Play context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaPause()
+{
+    return UI_STRING("Pause", "Media Pause context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaMute()
+{
+    return UI_STRING("Mute", "Media Mute context menu item");
+}
+
 String WebPlatformStrategies::contextMenuItemTagOpenFrameInNewWindow()
 {
     return UI_STRING("Open Frame in New Window", "Open Frame in New Window context menu item");
diff --git a/WebKit/win/WebCoreSupport/WebPlatformStrategies.h b/WebKit/win/WebCoreSupport/WebPlatformStrategies.h
index c3cfbb4..3a5626d 100644
--- a/WebKit/win/WebCoreSupport/WebPlatformStrategies.h
+++ b/WebKit/win/WebCoreSupport/WebPlatformStrategies.h
@@ -92,6 +92,16 @@ private:
     virtual WTF::String contextMenuItemTagLeftToRight();
     virtual WTF::String contextMenuItemTagRightToLeft();
     virtual WTF::String contextMenuItemTagInspectElement();
+    virtual WTF::String contextMenuItemTagOpenVideoInNewWindow();
+    virtual WTF::String contextMenuItemTagOpenAudioInNewWindow();
+    virtual WTF::String contextMenuItemTagCopyVideoLinkToClipboard();
+    virtual WTF::String contextMenuItemTagCopyAudioLinkToClipboard();
+    virtual WTF::String contextMenuItemTagToggleMediaControls();
+    virtual WTF::String contextMenuItemTagToggleMediaLoop();
+    virtual WTF::String contextMenuItemTagEnterVideoFullscreen();
+    virtual WTF::String contextMenuItemTagMediaPlay();
+    virtual WTF::String contextMenuItemTagMediaPause();
+    virtual WTF::String contextMenuItemTagMediaMute();
 #endif // ENABLE(CONTEXT_MENUS)
     virtual WTF::String searchMenuNoRecentSearchesText();
     virtual WTF::String searchMenuRecentSearchesText();
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index c7bade3..faf5dbd 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,26 @@
+2010-09-20  Philippe Normand  <pnormand at igalia.com>
+
+        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:
+
 2010-09-20  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
index a1986af..b9d2cf8 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
@@ -180,6 +180,56 @@ String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard()
     return UI_STRING("Copy Image", "Copy Image context menu item");
 }
 
+String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow()
+{
+    return UI_STRING("Open Video in New Window", "Open Video in New Window context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagOpenAudioInNewWindow()
+{
+    return UI_STRING("Open Audio in New Window", "Open Audio in New Window context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagCopyVideoLinkToClipboard()
+{
+    return UI_STRING("Copy Video Address", "Copy Video Address Location context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagCopyAudioLinkToClipboard()
+{
+    return UI_STRING("Copy Audio Address", "Copy Audio Address Location context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagToggleMediaControls()
+{
+    return UI_STRING("Controls", "Media Controls context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagToggleMediaLoop()
+{
+    return UI_STRING("Loop", "Media Loop context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagEnterVideoFullscreen()
+{
+    return UI_STRING("Enter Fullscreen", "Video Enter Fullscreen context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaPlay()
+{
+    return UI_STRING("Play", "Media Play context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaPause()
+{
+    return UI_STRING("Pause", "Media Pause context menu item");
+}
+
+String WebPlatformStrategies::contextMenuItemTagMediaMute()
+{
+    return UI_STRING("Mute", "Media Mute context menu item");
+}
+
 String WebPlatformStrategies::contextMenuItemTagOpenFrameInNewWindow()
 {
     return UI_STRING("Open Frame in New Window", "Open Frame in New Window context menu item");
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h b/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
index c166756..d22dcbf 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
+++ b/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
@@ -127,6 +127,16 @@ private:
     virtual String contextMenuItemTagChangeBack(const String& replacedString);
 #endif
     virtual String contextMenuItemTagInspectElement();
+    virtual String contextMenuItemTagOpenVideoInNewWindow();
+    virtual String contextMenuItemTagOpenAudioInNewWindow();
+    virtual String contextMenuItemTagCopyVideoLinkToClipboard();
+    virtual String contextMenuItemTagCopyAudioLinkToClipboard();
+    virtual String contextMenuItemTagToggleMediaControls();
+    virtual String contextMenuItemTagToggleMediaLoop();
+    virtual String contextMenuItemTagEnterVideoFullscreen();
+    virtual String contextMenuItemTagMediaPlay();
+    virtual String contextMenuItemTagMediaPause();
+    virtual String contextMenuItemTagMediaMute();
 #endif // ENABLE(CONTEXT_MENUS)
     virtual String searchMenuNoRecentSearchesText();
     virtual String searchMenuRecentSearchesText();
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index f25c4bd..59f156e 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-20  Philippe Normand  <pnormand at igalia.com>
+
+        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):
+
 2010-09-20  Hayato Ito  <hayato at chromium.org>
 
         Unreviewed.
diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
index d1529db..6e5fa5f 100644
--- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
@@ -147,6 +147,58 @@ bool prepareMouseButtonEvent(GdkEvent* event, int eventSenderButtonNumber, guint
     return true;
 }
 
+static JSValueRef getMenuItemTitleCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
+{
+    GtkWidget* widget = GTK_WIDGET(JSObjectGetPrivate(object));
+    CString label;
+    if (GTK_IS_SEPARATOR_MENU_ITEM(widget))
+        label = "<separator>";
+    else
+        label = gtk_menu_item_get_label(GTK_MENU_ITEM(widget));
+
+    return JSValueMakeString(context, JSStringCreateWithUTF8CString(label.data()));
+}
+
+static bool setMenuItemTitleCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception)
+{
+    return true;
+}
+
+static JSValueRef menuItemClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    GtkMenuItem* item = GTK_MENU_ITEM(JSObjectGetPrivate(thisObject));
+    gtk_menu_item_activate(item);
+    return JSValueMakeUndefined(context);
+}
+
+static JSStaticFunction staticMenuItemFunctions[] = {
+    { "click", menuItemClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+    { 0, 0, 0 }
+};
+
+static JSStaticValue staticMenuItemValues[] = {
+    { "title", getMenuItemTitleCallback, setMenuItemTitleCallback, kJSPropertyAttributeNone },
+    { 0, 0, 0, 0 }
+};
+
+static JSClassRef getMenuItemClass()
+{
+    static JSClassRef menuItemClass = 0;
+
+    if (!menuItemClass) {
+        JSClassDefinition classDefinition = {
+                0, 0, 0, 0, 0, 0,
+                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        classDefinition.staticFunctions = staticMenuItemFunctions;
+        classDefinition.staticValues = staticMenuItemValues;
+
+        menuItemClass = JSClassCreate(&classDefinition);
+    }
+
+    return menuItemClass;
+}
+
+
 static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     GdkEvent* pressEvent = gdk_event_new(GDK_BUTTON_PRESS);
@@ -165,13 +217,7 @@ static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef functio
         JSValueRef arrayValues[g_list_length(items)];
         int index = 0;
         for (GList* item = g_list_first(items); item; item = g_list_next(item)) {
-            CString label;
-            if (GTK_IS_SEPARATOR_MENU_ITEM(item->data))
-                label = "<separator>";
-            else
-                label = gtk_menu_item_get_label(GTK_MENU_ITEM(item->data));
-
-            arrayValues[index] = JSValueMakeString(context, JSStringCreateWithUTF8CString(label.data()));
+            arrayValues[index] = JSObjectMake(context, getMenuItemClass(), item->data);
             index++;
         }
         if (index)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list