2011-02-07 Qi Zhang <qi.2.zhang@nokia.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Feb 2011 05:37:00 +0000 (05:37 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Feb 2011 05:37:00 +0000 (05:37 +0000)
        Reviewed by Andreas Kling.

        [Qt] enum QWebPage::WebAction doesn't have value QWebPage::CopyImageUrl
        https://bugs.webkit.org/show_bug.cgi?id=52974

        Add ContextMenuItemTagCopyImageUrlToClipboard into standard action but Qt platform specific.

        * page/ContextMenuController.cpp:
        (WebCore::ContextMenuController::contextMenuItemSelected):
        (WebCore::ContextMenuController::populate):
        (WebCore::ContextMenuController::checkOrEnableIfNeeded):
        * platform/ContextMenuItem.h:
        * platform/LocalizationStrategy.h:
        * platform/LocalizedStrings.cpp:
        (WebCore::contextMenuItemTagCopyImageUrlToClipboard):
        * platform/LocalizedStrings.h:
2011-02-07  Qi Zhang  <qi.2.zhang@nokia.com>

        Reviewed by Andreas Kling.

        [Qt] enum QWebPage::WebAction doesn't have value QWebPage::CopyImageUrl
        https://bugs.webkit.org/show_bug.cgi?id=52974

        Add QWebPage::CopyImageUrlToClipboard into QWebPage::WebAction.

        * Api/qwebpage.cpp:
        (webActionForContextMenuAction):
        (QWebPage::triggerAction):
        (QWebPage::action):
        * Api/qwebpage.h:
        * WebCoreSupport/WebPlatformStrategies.cpp:
        (WebPlatformStrategies::contextMenuItemTagCopyImageUrlToClipboard):
        * WebCoreSupport/WebPlatformStrategies.h:
2011-02-07  Qi Zhang  <qi.2.zhang@nokia.com>

        Reviewed by Andreas Kling.

        [Qt] enum QWebPage::WebAction doesn't have value QWebPage::CopyImageUrl
        https://bugs.webkit.org/show_bug.cgi?id=52974

        Add ContextMenuItemTagCopyImageUrlToClipboard into standard action but Qt platform specific.

        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
        (WebKit::WebPlatformStrategies::contextMenuItemTagCopyImageUrlToClipboard):
        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77892 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/ContextMenuController.cpp
Source/WebCore/platform/ContextMenuItem.h
Source/WebCore/platform/LocalizationStrategy.h
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/LocalizedStrings.h
Source/WebKit/qt/Api/qwebpage.cpp
Source/WebKit/qt/Api/qwebpage.h
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h

index 0eb814a..4e43410 100644 (file)
@@ -1,3 +1,22 @@
+2011-02-07  Qi Zhang  <qi.2.zhang@nokia.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] enum QWebPage::WebAction doesn't have value QWebPage::CopyImageUrl
+        https://bugs.webkit.org/show_bug.cgi?id=52974
+
+        Add ContextMenuItemTagCopyImageUrlToClipboard into standard action but Qt platform specific.
+
+        * page/ContextMenuController.cpp:
+        (WebCore::ContextMenuController::contextMenuItemSelected):
+        (WebCore::ContextMenuController::populate):
+        (WebCore::ContextMenuController::checkOrEnableIfNeeded):
+        * platform/ContextMenuItem.h:
+        * platform/LocalizationStrategy.h:
+        * platform/LocalizedStrings.cpp:
+        (WebCore::contextMenuItemTagCopyImageUrlToClipboard):
+        * platform/LocalizedStrings.h:
+
 2011-02-07  Kenichi Ishibashi  <bashi@chromium.org>
 
         Reviewed by Kent Tamura.
index 0909f70..9f05583 100644 (file)
@@ -207,6 +207,11 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
         // For now, call into the client. This is temporary!
         frame->editor()->copyImage(m_hitTestResult);
         break;
+#if PLATFORM(QT)
+    case ContextMenuItemTagCopyImageUrlToClipboard:
+        frame->editor()->copyURL(m_hitTestResult.absoluteImageURL(), m_hitTestResult.textContent());
+        break;
+#endif
     case ContextMenuItemTagOpenMediaInNewWindow:
         openNewWindow(m_hitTestResult.absoluteMediaURL(), frame);
         break;
@@ -642,6 +647,10 @@ void ContextMenuController::populate()
         contextMenuItemTagDownloadImageToDisk());
     ContextMenuItem CopyImageItem(ActionType, ContextMenuItemTagCopyImageToClipboard, 
         contextMenuItemTagCopyImageToClipboard());
+#if PLATFORM(QT)
+    ContextMenuItem CopyImageUrlItem(ActionType, ContextMenuItemTagCopyImageUrlToClipboard, 
+        contextMenuItemTagCopyImageUrlToClipboard());
+#endif
     ContextMenuItem OpenMediaInNewWindowItem(ActionType, ContextMenuItemTagOpenMediaInNewWindow, String());
     ContextMenuItem CopyMediaLinkItem(ActionType, ContextMenuItemTagCopyMediaLinkToClipboard, 
         String());
@@ -720,6 +729,9 @@ void ContextMenuController::populate()
             appendItem(DownloadImageItem, m_contextMenu.get());
             if (imageURL.isLocalFile() || m_hitTestResult.image())
                 appendItem(CopyImageItem, m_contextMenu.get());
+#if PLATFORM(QT)
+            appendItem(CopyImageUrlItem, m_contextMenu.get());
+#endif
         }
 
         KURL mediaURL = m_hitTestResult.absoluteMediaURL();
@@ -1172,6 +1184,9 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const
         case ContextMenuItemTagOpenImageInNewWindow:
         case ContextMenuItemTagDownloadImageToDisk:
         case ContextMenuItemTagCopyImageToClipboard:
+#if PLATFORM(QT)
+        case ContextMenuItemTagCopyImageUrlToClipboard:
+#endif
             break;
         case ContextMenuItemTagOpenMediaInNewWindow:
             if (m_hitTestResult.mediaIsVideo())
index 6e84131..6595711 100644 (file)
@@ -65,6 +65,9 @@ namespace WebCore {
         ContextMenuItemTagOpenImageInNewWindow,
         ContextMenuItemTagDownloadImageToDisk,
         ContextMenuItemTagCopyImageToClipboard,
+#if PLATFORM(QT)
+        ContextMenuItemTagCopyImageUrlToClipboard,
+#endif
         ContextMenuItemTagOpenFrameInNewWindow,
         ContextMenuItemTagCopy,
         ContextMenuItemTagGoBack,
index 5596c81..3ed84d9 100644 (file)
@@ -55,6 +55,9 @@ public:
     virtual String contextMenuItemTagOpenImageInNewWindow() = 0;
     virtual String contextMenuItemTagDownloadImageToDisk() = 0;
     virtual String contextMenuItemTagCopyImageToClipboard() = 0;
+#if PLATFORM(QT)
+    virtual String contextMenuItemTagCopyImageUrlToClipboard() = 0;
+#endif
     virtual String contextMenuItemTagOpenFrameInNewWindow() = 0;
     virtual String contextMenuItemTagCopy() = 0;
     virtual String contextMenuItemTagGoBack() = 0;
index f342c6d..77144a9 100644 (file)
@@ -104,6 +104,13 @@ String contextMenuItemTagCopyImageToClipboard()
     return platformStrategies()->localizationStrategy()->contextMenuItemTagCopyImageToClipboard();
 }
 
+#if PLATFORM(QT)
+String contextMenuItemTagCopyImageUrlToClipboard()
+{
+    return platformStrategies()->localizationStrategy()->contextMenuItemTagCopyImageUrlToClipboard();
+}
+#endif
+
 String contextMenuItemTagOpenFrameInNewWindow()
 {
     return platformStrategies()->localizationStrategy()->contextMenuItemTagOpenFrameInNewWindow();
index da0fe86..812300f 100644 (file)
@@ -51,6 +51,9 @@ namespace WebCore {
     String contextMenuItemTagOpenImageInNewWindow();
     String contextMenuItemTagDownloadImageToDisk();
     String contextMenuItemTagCopyImageToClipboard();
+#if PLATFORM(QT)
+    String contextMenuItemTagCopyImageUrlToClipboard();
+#endif
     String contextMenuItemTagOpenFrameInNewWindow();
     String contextMenuItemTagCopy();
     String contextMenuItemTagGoBack();
index e80aac5..44740a0 100644 (file)
@@ -162,6 +162,7 @@ static const char* editorCommandWebActions[] =
     0, // OpenImageInNewWindow,
     0, // DownloadImageToDisk,
     0, // CopyImageToClipboard,
+    0, // CopyImageUrlToClipboard,
 
     0, // Back,
     0, // Forward,
@@ -404,6 +405,7 @@ static QWebPage::WebAction webActionForContextMenuAction(WebCore::ContextMenuAct
         case WebCore::ContextMenuItemTagOpenImageInNewWindow: return QWebPage::OpenImageInNewWindow;
         case WebCore::ContextMenuItemTagDownloadImageToDisk: return QWebPage::DownloadImageToDisk;
         case WebCore::ContextMenuItemTagCopyImageToClipboard: return QWebPage::CopyImageToClipboard;
+        case WebCore::ContextMenuItemTagCopyImageUrlToClipboard: return QWebPage::CopyImageUrlToClipboard;
         case WebCore::ContextMenuItemTagOpenFrameInNewWindow: return QWebPage::OpenFrameInNewWindow;
         case WebCore::ContextMenuItemTagCopy: return QWebPage::Copy;
         case WebCore::ContextMenuItemTagGoBack: return QWebPage::Back;
@@ -1680,6 +1682,7 @@ IntPoint QWebPagePrivate::TouchAdjuster::findCandidatePointForTouch(const IntPoi
     \value OpenImageInNewWindow Open the highlighted image in a new window.
     \value DownloadImageToDisk Download the highlighted image to the disk.
     \value CopyImageToClipboard Copy the highlighted image to the clipboard.
+    \value CopyImageUrlToClipboard Copy the highlighted image's URL to the clipboard.
     \value Back Navigate back in the history of navigated links.
     \value Forward Navigate forward in the history of navigated links.
     \value Stop Stop loading the current page.
@@ -2342,6 +2345,9 @@ void QWebPage::triggerAction(WebAction action, bool)
         case CopyImageToClipboard:
             QApplication::clipboard()->setPixmap(d->hitTestResult.pixmap());
             break;
+        case CopyImageUrlToClipboard:
+            QApplication::clipboard()->setText(d->hitTestResult.imageUrl().toString());
+            break;
 #endif
         case Back:
             d->page->goBack();
@@ -2730,6 +2736,9 @@ QAction *QWebPage::action(WebAction action) const
         case CopyImageToClipboard:
             text = contextMenuItemTagCopyImageToClipboard();
             break;
+        case CopyImageUrlToClipboard:
+            text = contextMenuItemTagCopyImageUrlToClipboard();
+            break;
 
         case Back:
             text = contextMenuItemTagGoBack();
index b66adb2..e12b460 100644 (file)
@@ -105,6 +105,7 @@ public:
         OpenImageInNewWindow,
         DownloadImageToDisk,
         CopyImageToClipboard,
+        CopyImageUrlToClipboard,
 
         Back,
         Forward,
index 7fd9a33..e17af34 100644 (file)
@@ -1,3 +1,21 @@
+2011-02-07  Qi Zhang  <qi.2.zhang@nokia.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] enum QWebPage::WebAction doesn't have value QWebPage::CopyImageUrl
+        https://bugs.webkit.org/show_bug.cgi?id=52974
+
+        Add QWebPage::CopyImageUrlToClipboard into QWebPage::WebAction.
+
+        * Api/qwebpage.cpp:
+        (webActionForContextMenuAction):
+        (QWebPage::triggerAction):
+        (QWebPage::action):
+        * Api/qwebpage.h:
+        * WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebPlatformStrategies::contextMenuItemTagCopyImageUrlToClipboard):
+        * WebCoreSupport/WebPlatformStrategies.h:
+
 2011-02-07  Enrica Casucci  <enrica@apple.com>
 
         Reviewed Adam Roben and Darin Adler.
index c67ec2f..de4de3e 100644 (file)
@@ -200,6 +200,11 @@ String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard()
     return QCoreApplication::translate("QWebPage", "Copy Image", "Copy Link context menu item");
 }
 
+String WebPlatformStrategies::contextMenuItemTagCopyImageUrlToClipboard()
+{
+    return QCoreApplication::translate("QWebPage", "Copy Image Address", "Copy Image Address menu item");
+}
+
 String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow()
 {
     return QCoreApplication::translate("QWebPage", "Open Video", "Open Video in New Window");
index 5f72f46..b760045 100644 (file)
@@ -66,6 +66,7 @@ private:
     virtual WTF::String contextMenuItemTagOpenImageInNewWindow();
     virtual WTF::String contextMenuItemTagDownloadImageToDisk();
     virtual WTF::String contextMenuItemTagCopyImageToClipboard();
+    virtual WTF::String contextMenuItemTagCopyImageUrlToClipboard();
     virtual WTF::String contextMenuItemTagOpenFrameInNewWindow();
     virtual WTF::String contextMenuItemTagCopy();
     virtual WTF::String contextMenuItemTagGoBack();
index 6b0be39..171bf46 100644 (file)
@@ -1,3 +1,16 @@
+2011-02-07  Qi Zhang  <qi.2.zhang@nokia.com>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] enum QWebPage::WebAction doesn't have value QWebPage::CopyImageUrl
+        https://bugs.webkit.org/show_bug.cgi?id=52974
+
+        Add ContextMenuItemTagCopyImageUrlToClipboard into standard action but Qt platform specific.
+
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::contextMenuItemTagCopyImageUrlToClipboard):
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
 2011-02-07  Enrica Casucci  <enrica@apple.com>
 
         Reviewed by Sam Weinig.
index 2615852..479252a 100644 (file)
@@ -214,6 +214,13 @@ String WebPlatformStrategies::contextMenuItemTagCopyImageToClipboard()
     return UI_STRING("Copy Image", "Copy Image context menu item");
 }
 
+#if PLATFORM(QT)
+String WebPlatformStrategies::contextMenuItemTagCopyImageUrlToClipboard()
+{
+    return UI_STRING("Copy Image Address", "Copy Image Address menu item");
+}
+#endif
+
 String WebPlatformStrategies::contextMenuItemTagOpenVideoInNewWindow()
 {
     return UI_STRING("Open Video in New Window", "Open Video in New Window context menu item");
index b584f8d..a763475 100644 (file)
@@ -68,6 +68,9 @@ private:
     virtual String contextMenuItemTagOpenImageInNewWindow();
     virtual String contextMenuItemTagDownloadImageToDisk();
     virtual String contextMenuItemTagCopyImageToClipboard();
+#if PLATFORM(QT)
+    virtual String contextMenuItemTagCopyImageUrlToClipboard();
+#endif
     virtual String contextMenuItemTagOpenFrameInNewWindow();
     virtual String contextMenuItemTagCopy();
     virtual String contextMenuItemTagGoBack();