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

jcivelli at chromium.org jcivelli at chromium.org
Wed Dec 22 14:49:25 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ee1ce9b4f4739aa6edc5575aa5e0174a5fd8e22c
Author: jcivelli at chromium.org <jcivelli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 21 10:11:24 2010 +0000

    2010-10-21  Jay Civelli  <jcivelli at chromium.org>
    
            Reviewed by Darin Fisher.
    
            [Chromium] Adding an API that allows external
            popup menus, without the use of WebCore::PopupMenuChromium.
            Once this is hooked up in Chromium, the plan is to remove
            entirely the external case from PopupMenuChromium.
            https://bugs.webkit.org/show_bug.cgi?id=46016
    
            * WebKit.gyp:
            * public/WebExternalPopupMenu.h: Added.
            * public/WebExternalPopupMenuClient.h: Added.
            * public/WebMenuItemInfo.h:
            (WebKit::WebMenuItemInfo::WebMenuItemInfo):
            * public/WebView.h:
            * public/WebViewClient.h:
            (WebKit::WebViewClient::createExternalPopupMenu):
            * src/ChromeClientImpl.cpp:
            (WebKit::ChromeClientImpl::createPopupMenu):
            * src/ExternalPopupMenu.cpp: Added.
            * src/ExternalPopupMenu.h: Added.
            * src/WebViewImpl.cpp:
            (WebKit::WebView::setUseExternalPopupMenus):
            (WebKit::WebViewImpl::useExternalPopupMenus):
            * src/WebViewImpl.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70222 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index bd2faa8..d3f2242 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,30 @@
+2010-10-21  Jay Civelli  <jcivelli at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        [Chromium] Adding an API that allows external
+        popup menus, without the use of WebCore::PopupMenuChromium.
+        Once this is hooked up in Chromium, the plan is to remove
+        entirely the external case from PopupMenuChromium.
+        https://bugs.webkit.org/show_bug.cgi?id=46016
+
+        * WebKit.gyp:
+        * public/WebExternalPopupMenu.h: Added.
+        * public/WebExternalPopupMenuClient.h: Added.
+        * public/WebMenuItemInfo.h:
+        (WebKit::WebMenuItemInfo::WebMenuItemInfo):
+        * public/WebView.h:
+        * public/WebViewClient.h:
+        (WebKit::WebViewClient::createExternalPopupMenu):
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::createPopupMenu):
+        * src/ExternalPopupMenu.cpp: Added.
+        * src/ExternalPopupMenu.h: Added.
+        * src/WebViewImpl.cpp:
+        (WebKit::WebView::setUseExternalPopupMenus):
+        (WebKit::WebViewImpl::useExternalPopupMenus):
+        * src/WebViewImpl.h:
+
 2010-10-20  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r70165.
diff --git a/WebKit/chromium/WebKit.gyp b/WebKit/chromium/WebKit.gyp
index e1e1a5f..af32250 100644
--- a/WebKit/chromium/WebKit.gyp
+++ b/WebKit/chromium/WebKit.gyp
@@ -150,6 +150,8 @@
                 'public/WebEditingAction.h',
                 'public/WebElement.h',
                 'public/WebExceptionCode.h',
+                'public/WebExternalPopupMenu.h',
+                'public/WebExternalPopupMenuClient.h',
                 'public/WebFileChooserCompletion.h',
                 'public/WebFileChooserParams.h',
                 'public/WebFileError.h',
@@ -325,6 +327,8 @@
                 'src/EditorClientImpl.h',
                 'src/EventListenerWrapper.cpp',
                 'src/EventListenerWrapper.h',
+                'src/ExternalPopupMenu.cpp',
+                'src/ExternalPopupMenu.h',
                 'src/FrameLoaderClientImpl.cpp',
                 'src/FrameLoaderClientImpl.h',
                 'src/FrameNetworkingContextImpl.h',
diff --git a/WebKit/chromium/public/WebExternalPopupMenu.h b/WebKit/chromium/public/WebExternalPopupMenu.h
new file mode 100644
index 0000000..95bae95
--- /dev/null
+++ b/WebKit/chromium/public/WebExternalPopupMenu.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebExternalPopupMenu_h
+#define WebExternalPopupMenu_h
+
+namespace WebKit {
+
+class WebRect;
+
+class WebExternalPopupMenu {
+public:
+    virtual void show(const WebRect& bounds) = 0;
+    virtual void close() = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebExternalPopupMenu_h
diff --git a/WebKit/chromium/public/WebExternalPopupMenuClient.h b/WebKit/chromium/public/WebExternalPopupMenuClient.h
new file mode 100644
index 0000000..e01bc2d
--- /dev/null
+++ b/WebKit/chromium/public/WebExternalPopupMenuClient.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebExternalPopupMenuClient_h
+#define WebExternalPopupMenuClient_h
+
+namespace WebKit {
+
+class WebExternalPopupMenuClient {
+public:
+    // Should be called when the currently selected item in the popup menu
+    // changed. Can be -1 if there is no selection.
+    virtual void didChangeSelection(int index) = 0;
+
+    // Should be called when an index has been accepted.
+    // Note that it is not safe to access this WebExternalPopupClientMenu after
+    // this has been called as it might not be valid anymore.
+    virtual void didAcceptIndex(int index) = 0;
+
+    // Should be called when the popup menu was discarded (closed without a
+    // selection.
+    // Note that it is not safe to access this WebExternalPopupClientMenu after
+    // this has been called as it might not be valid anymore.
+    virtual void didCancel() = 0;
+};
+
+} // namespace WebKit
+
+#endif // WebExternalPopupMenuClient_h
diff --git a/WebKit/chromium/public/WebMenuItemInfo.h b/WebKit/chromium/public/WebMenuItemInfo.h
index d513e66..445dfb4 100644
--- a/WebKit/chromium/public/WebMenuItemInfo.h
+++ b/WebKit/chromium/public/WebMenuItemInfo.h
@@ -44,6 +44,15 @@ struct WebMenuItemInfo {
         Group,
         Separator,
     };
+
+    WebMenuItemInfo() 
+        : type(Option)
+        , action(0)
+        , enabled(false)
+        , checked(false)
+    {
+    }
+
     WebString label;
     Type type;
     unsigned action;
diff --git a/WebKit/chromium/public/WebView.h b/WebKit/chromium/public/WebView.h
index e504bd7..ce8e512 100644
--- a/WebKit/chromium/public/WebView.h
+++ b/WebKit/chromium/public/WebView.h
@@ -69,13 +69,13 @@ public:
         UserContentInjectInAllFrames,
         UserContentInjectInTopFrameOnly
     };
-    
+
     // Controls which documents user styles are injected into.
     enum UserStyleInjectionTime {
         UserStyleInjectInExistingDocuments,
         UserStyleInjectInSubsequentDocuments
     };
-    
+
 
     // Initialization ------------------------------------------------------
 
@@ -315,6 +315,12 @@ public:
     virtual void performCustomContextMenuAction(unsigned action) = 0;
 
 
+    // Popup menu ----------------------------------------------------------
+
+    // Sets whether select popup menus should be rendered by the browser.
+    WEBKIT_API static void setUseExternalPopupMenus(bool);
+
+
     // Visited link state --------------------------------------------------
 
     // Tells all WebView instances to update the visited link state for the
diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h
index 858cb2a..edd9579 100644
--- a/WebKit/chromium/public/WebViewClient.h
+++ b/WebKit/chromium/public/WebViewClient.h
@@ -48,6 +48,8 @@ class WebAccessibilityObject;
 class WebDeviceOrientationClient;
 class WebDragData;
 class WebElement;
+class WebExternalPopupMenu;
+class WebExternalPopupMenuClient;
 class WebFileChooserCompletion;
 class WebFrame;
 class WebGeolocationService;
@@ -87,6 +89,8 @@ public:
     // responsible for rendering the contents of the popup menu.
     virtual WebWidget* createPopupMenu(WebPopupType) { return 0; }
     virtual WebWidget* createPopupMenu(const WebPopupMenuInfo&) { return 0; }
+    virtual WebExternalPopupMenu* createExternalPopupMenu(
+        const WebPopupMenuInfo&, WebExternalPopupMenuClient*) { return 0; }
 
     // Create a session storage namespace object associated with this WebView.
     virtual WebStorageNamespace* createSessionStorageNamespace(unsigned quota) { return 0; }
diff --git a/WebKit/chromium/src/ChromeClientImpl.cpp b/WebKit/chromium/src/ChromeClientImpl.cpp
index 4f1705f..bb54b57 100644
--- a/WebKit/chromium/src/ChromeClientImpl.cpp
+++ b/WebKit/chromium/src/ChromeClientImpl.cpp
@@ -40,6 +40,7 @@
 #include "DatabaseTracker.h"
 #include "Document.h"
 #include "DocumentLoader.h"
+#include "ExternalPopupMenu.h"
 #include "FileChooser.h"
 #include "FloatRect.h"
 #include "FrameLoadRequest.h"
@@ -833,6 +834,9 @@ bool ChromeClientImpl::selectItemWritingDirectionIsNatural()
 
 PassRefPtr<PopupMenu> ChromeClientImpl::createPopupMenu(PopupMenuClient* client) const
 {
+    if (WebViewImpl::useExternalPopupMenus())
+        return adoptRef(new ExternalPopupMenu(client, m_webView->client()));
+    
     return adoptRef(new PopupMenuChromium(client));
 }
 
diff --git a/WebKit/chromium/src/ExternalPopupMenu.cpp b/WebKit/chromium/src/ExternalPopupMenu.cpp
new file mode 100644
index 0000000..a0243eb
--- /dev/null
+++ b/WebKit/chromium/src/ExternalPopupMenu.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ExternalPopupMenu.h"
+
+#include "FrameView.h"
+#include "IntPoint.h"
+#include "PopupMenuClient.h"
+#include "TextDirection.h"
+#include "WebExternalPopupMenu.h"
+#include "WebMenuItemInfo.h"
+#include "WebPopupMenuInfo.h"
+#include "WebVector.h"
+#include "WebViewClient.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+ExternalPopupMenu::ExternalPopupMenu(PopupMenuClient* popupMenuClient,
+                                     WebViewClient* webViewClient)
+    : m_popupMenuClient(popupMenuClient)
+    , m_webViewClient(webViewClient)
+    , m_webExternalPopupMenu(0)
+{
+}
+
+ExternalPopupMenu::~ExternalPopupMenu()
+{
+}
+
+void ExternalPopupMenu::show(const IntRect& rect, FrameView* v, int index)
+{
+    // WebCore reuses the PopupMenu of a page.
+    // For simplicity, we do recreate the actual external popup everytime.
+    hide();
+
+    WebPopupMenuInfo info;
+    getPopupMenuInfo(&info);
+    m_webExternalPopupMenu =
+        m_webViewClient->createExternalPopupMenu(info, this);
+    m_webExternalPopupMenu->show(v->contentsToWindow(rect));
+}
+
+void ExternalPopupMenu::hide()
+{
+    if (m_popupMenuClient)
+        m_popupMenuClient->popupDidHide();
+    if (!m_webExternalPopupMenu)
+        return;
+    m_webExternalPopupMenu->close();
+    m_webExternalPopupMenu = 0;
+}
+
+void ExternalPopupMenu::updateFromElement()
+{
+}
+
+void ExternalPopupMenu::disconnectClient()
+{
+    hide();
+    m_popupMenuClient = 0;
+}
+
+void ExternalPopupMenu::didChangeSelection(int index)
+{
+    if (m_popupMenuClient)
+        m_popupMenuClient->selectionChanged(index);
+}
+
+void ExternalPopupMenu::didAcceptIndex(int index)
+{
+    if (m_popupMenuClient) {
+        m_popupMenuClient->valueChanged(index);
+        m_popupMenuClient->popupDidHide();
+    }
+    m_webExternalPopupMenu = 0;
+}
+
+void ExternalPopupMenu::didCancel()
+{
+    if (m_popupMenuClient)
+        m_popupMenuClient->popupDidHide();
+    m_webExternalPopupMenu = 0;
+}
+
+void ExternalPopupMenu::getPopupMenuInfo(WebPopupMenuInfo* info)
+{
+    int itemCount = m_popupMenuClient->listSize();
+    WebVector<WebPopupMenuInfo::Item> items(
+        static_cast<size_t>(itemCount));
+    for (int i = 0; i < itemCount; ++i) {
+        WebPopupMenuInfo::Item& popupItem = items[i];
+        popupItem.label = m_popupMenuClient->itemText(i);
+        if (m_popupMenuClient->itemIsSeparator(i))
+            popupItem.type = WebMenuItemInfo::Separator;
+        else if (m_popupMenuClient->itemIsLabel(i))
+            popupItem.type = WebMenuItemInfo::Group;
+        else
+            popupItem.type = WebMenuItemInfo::Option;
+        popupItem.enabled = m_popupMenuClient->itemIsEnabled(i);
+    }
+
+    info->itemHeight = m_popupMenuClient->menuStyle().font().height();
+    info->itemFontSize =
+        static_cast<int>(m_popupMenuClient->menuStyle().font().size());
+    info->selectedIndex = m_popupMenuClient->selectedIndex();
+    info->rightAligned =
+        m_popupMenuClient->menuStyle().textDirection() == WebCore::RTL;
+    info->items.swap(items);
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/ExternalPopupMenu.h b/WebKit/chromium/src/ExternalPopupMenu.h
new file mode 100644
index 0000000..6963e8d
--- /dev/null
+++ b/WebKit/chromium/src/ExternalPopupMenu.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ExternalPopupMenu_h
+#define ExternalPopupMenu_h
+
+#include "PopupMenu.h"
+#include "WebExternalPopupMenuClient.h"
+
+namespace WebCore {
+class FrameView;
+class IntRect;
+class PopupMenuClient;
+}
+
+namespace WebKit {
+
+class WebExternalPopupMenu;
+class WebViewClient;
+struct WebPopupMenuInfo;
+
+// The ExternalPopupMenu connects the actual implementation of the popup menu
+// to the WebCore popup menu.
+class ExternalPopupMenu : public WebCore::PopupMenu,
+                          public WebExternalPopupMenuClient {
+public:
+    ExternalPopupMenu(WebCore::PopupMenuClient*, WebViewClient*);
+    virtual ~ExternalPopupMenu();
+
+private:
+    // WebCore::PopupMenu methods:
+    virtual void show(const WebCore::IntRect&, WebCore::FrameView*, int index);
+    virtual void hide();
+    virtual void updateFromElement();
+    virtual void disconnectClient();
+
+    // WebExternalPopupClient methods:
+    virtual void didChangeSelection(int index);
+    virtual void didAcceptIndex(int index);
+    virtual void didCancel();
+
+    // Fills |info| with the popup menu information contained in the
+    // WebCore::PopupMenuClient associated with this ExternalPopupMenu.
+    void getPopupMenuInfo(WebPopupMenuInfo* info);
+
+    WebCore::PopupMenuClient* m_popupMenuClient;
+    WebViewClient* m_webViewClient;
+
+    // The actual implementor of the show menu.
+    WebExternalPopupMenu* m_webExternalPopupMenu;
+}; 
+
+} // namespace WebKit
+
+#endif // ExternalPopupMenu_h
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index aeab400..929f91a 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -182,6 +182,8 @@ static const PopupContainerSettings autoFillPopupSettings = {
     PopupContainerSettings::DOMElementDirection,
 };
 
+static bool shouldUseExternalPopupMenus = false;
+
 // WebView ----------------------------------------------------------------
 
 WebView* WebView::create(WebViewClient* client, WebDevToolsAgentClient* devToolsClient)
@@ -193,6 +195,11 @@ WebView* WebView::create(WebViewClient* client, WebDevToolsAgentClient* devTools
     return adoptRef(new WebViewImpl(client, devToolsClient)).leakRef();
 }
 
+void WebView::setUseExternalPopupMenus(bool useExternalPopupMenus)
+{
+    shouldUseExternalPopupMenus = useExternalPopupMenus;
+}
+
 void WebView::updateVisitedLinkState(unsigned long long linkHash)
 {
     Page::visitedStateChanged(PageGroup::pageGroup(pageGroupName), linkHash);
@@ -2107,6 +2114,11 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation)
     m_observedNewNavigation = false;
 }
 
+bool WebViewImpl::useExternalPopupMenus()
+{
+    return shouldUseExternalPopupMenus;
+}
+
 bool WebViewImpl::navigationPolicyFromMouseEvent(unsigned short button,
                                                  bool ctrl, bool shift,
                                                  bool alt, bool meta,
diff --git a/WebKit/chromium/src/WebViewImpl.h b/WebKit/chromium/src/WebViewImpl.h
index 050b5e1..8410ebd 100644
--- a/WebKit/chromium/src/WebViewImpl.h
+++ b/WebKit/chromium/src/WebViewImpl.h
@@ -273,6 +273,10 @@ public:
     // load.
     void didCommitLoad(bool* isNewNavigation);
 
+    // Returns true if popup menus should be rendered by the browser, false if
+    // they should be rendered by WebKit (which is the default).
+    static bool useExternalPopupMenus();
+
     bool contextMenuAllowed() const
     {
         return m_contextMenuAllowed;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list