summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 16:32:59 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 16:32:59 +0000
commit88efb7ec99239eeecaa17d21f8635be1bce29cca (patch)
treeb1a988fbca10748e584f78abb755036e63ff335f /webkit
parentc9d6a1df8ef5fd2c3f134dcb544663ce8bd21c7b (diff)
downloadchromium_src-88efb7ec99239eeecaa17d21f8635be1bce29cca.zip
chromium_src-88efb7ec99239eeecaa17d21f8635be1bce29cca.tar.gz
chromium_src-88efb7ec99239eeecaa17d21f8635be1bce29cca.tar.bz2
Replace ShowAsPopupWithItems to CreatePopupWidgetWithInfo. Also,
make use of WebPopupMenuInfo from the WebKit API. WebMenuItem remains in webkit/glue for convenience with IPC marshalling and related usage in Chrome. This work is precursor to switching over to using WebWidget from the WebKit API. BUG=16234 TEST=html select drop downs should still work on the mac. try switching languages on news.google.com. R=paul Review URL: http://codereview.chromium.org/155378 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20624 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/api/public/WebPopupMenuInfo.h12
-rw-r--r--webkit/glue/chrome_client_impl.cc101
-rw-r--r--webkit/glue/chrome_client_impl.h9
-rw-r--r--webkit/glue/webmenuitem.h33
-rw-r--r--webkit/glue/webmenurunner_mac.h2
-rw-r--r--webkit/glue/webmenurunner_mac.mm2
-rw-r--r--webkit/glue/webview_delegate.h9
-rw-r--r--webkit/glue/webwidget_delegate.h31
-rw-r--r--webkit/glue/webwidget_impl.cc14
-rw-r--r--webkit/glue/webwidget_impl.h5
-rw-r--r--webkit/glue/webworker_impl.cc5
-rw-r--r--webkit/tools/test_shell/mac/test_webview_delegate.mm38
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h32
-rw-r--r--webkit/tools/test_shell/test_webview_delegate_gtk.cc9
-rw-r--r--webkit/tools/test_shell/test_webview_delegate_win.cc9
-rw-r--r--webkit/webkit.gyp2
16 files changed, 154 insertions, 159 deletions
diff --git a/webkit/api/public/WebPopupMenuInfo.h b/webkit/api/public/WebPopupMenuInfo.h
index 5ce741b..b976dd0 100644
--- a/webkit/api/public/WebPopupMenuInfo.h
+++ b/webkit/api/public/WebPopupMenuInfo.h
@@ -1,10 +1,10 @@
/*
* Copyright (C) 2009 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
@@ -14,7 +14,7 @@
* * 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
@@ -31,10 +31,9 @@
#ifndef WebPopupMenuInfo_h
#define WebPopupMenuInfo_h
-#error "This header file is still a work in progress; do not include!"
-
#include "WebCommon.h"
#include "WebRect.h"
+#include "WebString.h"
#include "WebVector.h"
namespace WebKit {
@@ -52,10 +51,11 @@ namespace WebKit {
bool enabled;
};
- WebRect bounds;
int itemHeight;
int selectedIndex;
WebVector<Item> items;
};
} // namespace WebKit
+
+#endif
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index d868767..4c233f2 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -39,6 +39,7 @@ MSVC_POP_WARNING();
#include "webkit/api/public/WebCursorInfo.h"
#include "webkit/api/public/WebInputEvent.h"
#include "webkit/api/public/WebKit.h"
+#include "webkit/api/public/WebPopupMenuInfo.h"
#include "webkit/api/public/WebRect.h"
#include "webkit/api/public/WebURLRequest.h"
#include "webkit/api/src/WrappedResourceRequest.h"
@@ -49,11 +50,16 @@ MSVC_POP_WARNING();
#include "webkit/glue/webview_impl.h"
#include "webkit/glue/webwidget_impl.h"
+using WebCore::PopupContainer;
+using WebCore::PopupItem;
+
using WebKit::WebCursorInfo;
using WebKit::WebInputEvent;
using WebKit::WebMouseEvent;
+using WebKit::WebPopupMenuInfo;
using WebKit::WebRect;
using WebKit::WebURLRequest;
+using WebKit::WebVector;
using WebKit::WrappedResourceRequest;
// Callback class that's given to the WebViewDelegate during a file choose
@@ -544,65 +550,25 @@ void ChromeClientImpl::runOpenPanel(WebCore::Frame* frame,
delegate->RunFileChooser(multiple_files, string16(), suggestion, chooser);
}
-void ChromeClientImpl::popupOpened(WebCore::PopupContainer* popup_container,
+void ChromeClientImpl::popupOpened(PopupContainer* popup_container,
const WebCore::IntRect& bounds,
bool activatable,
- bool handle_external) {
- if (handle_external) {
- // We're going to handle the popup with native controls by the external
- // embedder.
- popupOpenedInternal(popup_container, bounds, activatable);
- return;
- }
-
- WebViewDelegate* delegate = webview_->delegate();
- if (delegate) {
- WebWidgetImpl* webwidget =
- static_cast<WebWidgetImpl*>(delegate->CreatePopupWidget(webview_,
- activatable));
- webwidget->Init(popup_container, webkit_glue::IntRectToWebRect(bounds));
- }
-}
-
-void ChromeClientImpl::popupOpenedInternal(
- WebCore::PopupContainer* popup_container,
- const WebCore::IntRect& bounds,
- bool activatable) {
+ bool handle_externally) {
WebViewDelegate* delegate = webview_->delegate();
if (!delegate)
return;
- WebWidgetImpl* webwidget =
- static_cast<WebWidgetImpl*>(delegate->CreatePopupWidget(webview_,
- activatable));
- // Convert WebKit types for Chromium.
- std::vector<WebMenuItem> popup_items;
- const WTF::Vector<WebCore::PopupItem*>& items = popup_container->popupData();
- for (int i = 0; i < static_cast<int>(items.size()); ++i) {
- WebMenuItem menu_item;
- menu_item.label = webkit_glue::StringToString16(items[i]->label);
- menu_item.enabled = items[i]->enabled;
- switch (items[i]->type) {
- case WebCore::PopupItem::TypeOption:
- menu_item.type = WebMenuItem::OPTION;
- break;
- case WebCore::PopupItem::TypeGroup:
- menu_item.type = WebMenuItem::GROUP;
- break;
- case WebCore::PopupItem::TypeSeparator:
- menu_item.type = WebMenuItem::SEPARATOR;
- break;
- default:
- NOTIMPLEMENTED();
- }
- popup_items.push_back(menu_item);
+ WebWidget* webwidget;
+ if (handle_externally) {
+ WebPopupMenuInfo popup_info;
+ GetPopupMenuInfo(popup_container, &popup_info);
+ webwidget = delegate->CreatePopupWidgetWithInfo(webview_, popup_info);
+ } else {
+ webwidget = delegate->CreatePopupWidget(webview_, activatable);
}
- webwidget->InitWithItems(popup_container,
- webkit_glue::IntRectToWebRect(bounds),
- popup_container->menuItemHeight(),
- popup_container->selectedIndex(),
- popup_items);
+ static_cast<WebWidgetImpl*>(webwidget)->Init(
+ popup_container, webkit_glue::IntRectToWebRect(bounds));
}
void ChromeClientImpl::SetCursor(const WebCursorInfo& cursor) {
@@ -629,3 +595,36 @@ void ChromeClientImpl::formStateDidChange(const WebCore::Node*) {
if (delegate)
delegate->OnNavStateChanged(webview_);
}
+
+void ChromeClientImpl::GetPopupMenuInfo(PopupContainer* popup_container,
+ WebPopupMenuInfo* info) {
+ const Vector<PopupItem*>& input_items = popup_container->popupData();
+
+ WebVector<WebPopupMenuInfo::Item> output_items(input_items.size());
+
+ for (size_t i = 0; i < input_items.size(); ++i) {
+ const PopupItem& input_item = *input_items[i];
+ WebPopupMenuInfo::Item& output_item = output_items[i];
+
+ output_item.label = webkit_glue::StringToWebString(input_item.label);
+ output_item.enabled = input_item.enabled;
+
+ switch (input_item.type) {
+ case PopupItem::TypeOption:
+ output_item.type = WebPopupMenuInfo::Item::Option;
+ break;
+ case PopupItem::TypeGroup:
+ output_item.type = WebPopupMenuInfo::Item::Group;
+ break;
+ case PopupItem::TypeSeparator:
+ output_item.type = WebPopupMenuInfo::Item::Separator;
+ break;
+ default:
+ NOTREACHED();
+ }
+ }
+
+ info->itemHeight = popup_container->menuItemHeight();
+ info->selectedIndex = popup_container->selectedIndex();
+ info->items.swap(output_items);
+}
diff --git a/webkit/glue/chrome_client_impl.h b/webkit/glue/chrome_client_impl.h
index cebffc2..2a91659 100644
--- a/webkit/glue/chrome_client_impl.h
+++ b/webkit/glue/chrome_client_impl.h
@@ -22,6 +22,7 @@ struct WindowFeatures;
namespace WebKit {
struct WebCursorInfo;
+struct WebPopupMenuInfo;
}
// Handles window-level notifications from WebCore on behalf of a WebView.
@@ -131,10 +132,7 @@ class ChromeClientImpl : public WebCore::ChromeClientChromium {
virtual void popupOpened(WebCore::PopupContainer* popup_container,
const WebCore::IntRect& bounds,
bool activatable,
- bool handle_external);
- void popupOpenedInternal(WebCore::PopupContainer* popup_container,
- const WebCore::IntRect& bounds,
- bool activatable);
+ bool handle_externally);
void SetCursor(const WebKit::WebCursorInfo& cursor);
void SetCursorForPlugin(const WebKit::WebCursorInfo& cursor);
@@ -144,6 +142,9 @@ class ChromeClientImpl : public WebCore::ChromeClientChromium {
virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
private:
+ void GetPopupMenuInfo(WebCore::PopupContainer* popup_container,
+ WebKit::WebPopupMenuInfo* info);
+
WebViewImpl* webview_; // weak pointer
bool toolbars_visible_;
bool statusbar_visible_;
diff --git a/webkit/glue/webmenuitem.h b/webkit/glue/webmenuitem.h
new file mode 100644
index 0000000..584e071
--- /dev/null
+++ b/webkit/glue/webmenuitem.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBMENUITEM_H_
+#define WEBMENUITEM_H_
+
+#include "base/string16.h"
+#include "webkit/api/public/WebPopupMenuInfo.h"
+
+// Container for information about entries in an HTML select popup menu.
+struct WebMenuItem {
+ enum Type {
+ OPTION = WebKit::WebPopupMenuInfo::Item::Option,
+ GROUP = WebKit::WebPopupMenuInfo::Item::Group,
+ SEPARATOR = WebKit::WebPopupMenuInfo::Item::Separator
+ };
+
+ string16 label;
+ Type type;
+ bool enabled;
+
+ WebMenuItem() : type(OPTION), enabled(false) {
+ }
+
+ WebMenuItem(const WebKit::WebPopupMenuInfo::Item& item)
+ : label(item.label),
+ type(static_cast<Type>(item.type)),
+ enabled(item.enabled) {
+ }
+};
+
+#endif // WEBMENUITEM_H_
diff --git a/webkit/glue/webmenurunner_mac.h b/webkit/glue/webmenurunner_mac.h
index 8d822a4..b83abeb 100644
--- a/webkit/glue/webmenurunner_mac.h
+++ b/webkit/glue/webmenurunner_mac.h
@@ -10,7 +10,7 @@
#include <vector>
#include "base/scoped_nsobject.h"
-#include "webkit/glue/webwidget_delegate.h"
+#include "webkit/glue/webmenuitem.h"
// WebMenuRunner ---------------------------------------------------------------
diff --git a/webkit/glue/webmenurunner_mac.mm b/webkit/glue/webmenurunner_mac.mm
index 8997f05..99c52bd 100644
--- a/webkit/glue/webmenurunner_mac.mm
+++ b/webkit/glue/webmenurunner_mac.mm
@@ -25,7 +25,7 @@
menu_.reset([[NSMenu alloc] initWithTitle:@""]);
[menu_ setAutoenablesItems:NO];
index_ = -1;
- for (int i = 0; i < static_cast<int>(items.size()); ++i)
+ for (size_t i = 0; i < items.size(); ++i)
[self addItem:items[i]];
}
return self;
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index 6106d1d..eafd383 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -52,6 +52,7 @@ class WebMediaPlayerClient;
class WebURLRequest;
class WebURLResponse;
struct WebPoint;
+struct WebPopupMenuInfo;
struct WebRect;
struct WebURLError;
}
@@ -119,6 +120,14 @@ class WebViewDelegate : virtual public WebWidgetDelegate {
return NULL;
}
+ // Like CreatePopupWidget, except the actual widget is rendered by the
+ // embedder using the supplied info.
+ virtual WebWidget* CreatePopupWidgetWithInfo(
+ WebView* webview,
+ const WebKit::WebPopupMenuInfo& info) {
+ return NULL;
+ }
+
// This method is called to create a WebPluginDelegate implementation when a
// new plugin is instanced. See webkit_glue::CreateWebPluginDelegateHelper
// for a default WebPluginDelegate implementation.
diff --git a/webkit/glue/webwidget_delegate.h b/webkit/glue/webwidget_delegate.h
index 17704b0d..a891cb1 100644
--- a/webkit/glue/webwidget_delegate.h
+++ b/webkit/glue/webwidget_delegate.h
@@ -19,22 +19,6 @@ struct WebScreenInfo;
class WebWidget;
struct WebPluginGeometry;
-struct WebMenuItem {
- // Container for information about entries in an HTML select popup menu.
- // Types must be kept in sync with PopupListBox::ListItemType in
- // WebCore/platform/chromium/PopupMenuChromium.h. This won't change often
- // (if ever).
- enum Type {
- OPTION = 0,
- GROUP,
- SEPARATOR
- };
-
- string16 label;
- Type type;
- bool enabled;
-};
-
class WebWidgetDelegate {
public:
// Called when a region of the WebWidget needs to be re-painted.
@@ -54,21 +38,6 @@ class WebWidgetDelegate {
virtual void Show(WebWidget* webwidget,
WindowOpenDisposition disposition) = 0;
- // Used for displaying HTML popup menus on Mac OS X (other platforms will use
- // Show() above). |bounds| represents the positioning on the screen (in WebKit
- // coordinates, origin at the top left corner) of the button that will display
- // the menu. It will be used, along with |item_height| (which refers to the
- // size of each entry in the menu), to position the menu on the screen.
- // |selected_index| indicates the menu item that should be drawn as selected
- // when the menu initially is displayed. |items| contains information about
- // each of the entries in the popup menu, such as the type (separator, option,
- // group), the text representation and the item's enabled status.
- virtual void ShowAsPopupWithItems(WebWidget* webwidget,
- const WebKit::WebRect& bounds,
- int item_height,
- int selected_index,
- const std::vector<WebMenuItem>& items) = 0;
-
// This method is called to instruct the window containing the WebWidget to
// close. Note: This method should just be the trigger that causes the
// WebWidget to eventually close. It should not actually be destroyed until
diff --git a/webkit/glue/webwidget_impl.cc b/webkit/glue/webwidget_impl.cc
index cb3a0c9..618a9bf 100644
--- a/webkit/glue/webwidget_impl.cc
+++ b/webkit/glue/webwidget_impl.cc
@@ -70,20 +70,6 @@ void WebWidgetImpl::Init(WebCore::FramelessScrollView* widget,
}
}
-void WebWidgetImpl::InitWithItems(WebCore::FramelessScrollView* widget,
- const WebRect& bounds,
- int item_height,
- int selected_index,
- const std::vector<WebMenuItem>& items) {
- widget_ = widget;
- widget_->setClient(this);
-
- if (delegate_) {
- delegate_->ShowAsPopupWithItems(this, bounds, item_height,
- selected_index, items);
- }
-}
-
void WebWidgetImpl::MouseMove(const WebMouseEvent& event) {
// don't send mouse move messages if the mouse hasn't moved.
if (event.x != last_mouse_position_.x ||
diff --git a/webkit/glue/webwidget_impl.h b/webkit/glue/webwidget_impl.h
index a0078db..a1a1b18 100644
--- a/webkit/glue/webwidget_impl.h
+++ b/webkit/glue/webwidget_impl.h
@@ -59,11 +59,6 @@ class WebWidgetImpl : public WebWidget,
// WebWidgetImpl
void Init(WebCore::FramelessScrollView* widget,
const WebKit::WebRect& bounds);
- void InitWithItems(WebCore::FramelessScrollView* widget,
- const WebKit::WebRect& bounds,
- int item_height,
- int selected_index,
- const std::vector<WebMenuItem>& items);
const WebKit::WebSize& size() const { return size_; }
diff --git a/webkit/glue/webworker_impl.cc b/webkit/glue/webworker_impl.cc
index 4016e85..c706524 100644
--- a/webkit/glue/webworker_impl.cc
+++ b/webkit/glue/webworker_impl.cc
@@ -69,11 +69,6 @@ class WorkerWebViewDelegate : public WebViewDelegate {
virtual void SetWindowRect(WebWidget *webwidget,
const WebKit::WebRect &rect) { }
virtual void Show(WebWidget *webwidget, WindowOpenDisposition disposition) { }
- virtual void ShowAsPopupWithItems(WebWidget *webwidget,
- const WebKit::WebRect &bounds,
- int item_height,
- int selected_index,
- const std::vector<WebMenuItem> &items) { }
// Tell the loader to load the data into the 'shadow page' synchronously,
// so we can grab the resulting Document right after load.
virtual void DidCreateDataSource(WebFrame* frame, WebKit::WebDataSource* ds) {
diff --git a/webkit/tools/test_shell/mac/test_webview_delegate.mm b/webkit/tools/test_shell/mac/test_webview_delegate.mm
index 93a3032..9939c68 100644
--- a/webkit/tools/test_shell/mac/test_webview_delegate.mm
+++ b/webkit/tools/test_shell/mac/test_webview_delegate.mm
@@ -8,7 +8,6 @@
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "webkit/api/public/WebCursorInfo.h"
-#include "webkit/api/public/WebRect.h"
#include "webkit/glue/webcursor.h"
#include "webkit/glue/webview.h"
#include "webkit/glue/plugins/plugin_list.h"
@@ -17,6 +16,7 @@
#include "webkit/tools/test_shell/test_shell.h"
using WebKit::WebCursorInfo;
+using WebKit::WebPopupMenuInfo;
using WebKit::WebRect;
// WebViewDelegate -----------------------------------------------------------
@@ -24,6 +24,14 @@ using WebKit::WebRect;
TestWebViewDelegate::~TestWebViewDelegate() {
}
+WebWidget* TestWebViewDelegate::CreatePopupWidgetWithInfo(
+ WebView* webview,
+ const WebPopupMenuInfo& info) {
+ WebWidget* webwidget = shell_->CreatePopupWidget(webview);
+ popup_menu_info_.reset(new WebPopupMenuInfo(info));
+ return webwidget;
+}
+
WebPluginDelegate* TestWebViewDelegate::CreatePluginDelegate(
WebView* webview,
const GURL& url,
@@ -62,17 +70,24 @@ void TestWebViewDelegate::ShowJavaScriptAlert(const std::wstring& message) {
// WebWidgetDelegate ---------------------------------------------------------
-void TestWebViewDelegate::Show(WebWidget* webview,
+void TestWebViewDelegate::Show(WebWidget* webwidget,
WindowOpenDisposition disposition) {
-}
+ if (!popup_menu_info_.get())
+ return;
+ if (webwidget != shell_->popup())
+ return;
+ // Display a HTML select menu.
+
+ std::vector<WebMenuItem> items;
+ for (size_t i = 0; i < popup_menu_info_->items.size(); ++i)
+ items.push_back(popup_menu_info_->items[i]);
+
+ int item_height = popup_menu_info_->itemHeight;
+ int selected_index = popup_menu_info_->selectedIndex;
+ popup_menu_info_.reset(); // No longer needed.
+
+ const WebRect& bounds = popup_bounds_;
-// Display a HTML select menu.
-void TestWebViewDelegate::ShowAsPopupWithItems(
- WebWidget* webview,
- const WebRect& bounds,
- int item_height,
- int selected_index,
- const std::vector<WebMenuItem>& items) {
// Set up the menu position.
NSView* web_view = shell_->webViewWnd();
NSRect view_rect = [web_view bounds];
@@ -146,8 +161,7 @@ void TestWebViewDelegate::SetWindowRect(WebWidget* webwidget,
if (webwidget == shell_->webView()) {
// ignored
} else if (webwidget == shell_->popup()) {
- // MoveWindow(shell_->popupWnd(),
- // rect.x(), rect.y(), rect.width(), rect.height(), FALSE);
+ popup_bounds_ = rect; // The initial position of the popup.
}
}
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index 1ce235e..208c8e6a 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -23,6 +23,10 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
+#if defined(OS_MACOSX)
+#include "webkit/api/public/WebRect.h"
+#include "webkit/api/public/WebPopupMenuInfo.h"
+#endif
#include "webkit/glue/webcursor.h"
#include "webkit/glue/webview_delegate.h"
#include "webkit/glue/webwidget_delegate.h"
@@ -82,12 +86,17 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
bool user_gesture,
const GURL& creator_url);
virtual WebWidget* CreatePopupWidget(WebView* webview, bool activatable);
+#if defined(OS_MACOSX)
+ virtual WebWidget* CreatePopupWidgetWithInfo(
+ WebView* webview,
+ const WebKit::WebPopupMenuInfo& info);
+#endif
virtual WebPluginDelegate* CreatePluginDelegate(
- WebView* webview,
- const GURL& url,
- const std::string& mime_type,
- const std::string& clsid,
- std::string* actual_mime_type);
+ WebView* webview,
+ const GURL& url,
+ const std::string& mime_type,
+ const std::string& clsid,
+ std::string* actual_mime_type);
#if defined(OS_LINUX)
virtual gfx::PluginWindowHandle CreatePluginContainer();
virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle);
@@ -227,11 +236,6 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy,
const WebKit::WebRect& clip_rect);
virtual void Show(WebWidget* webview, WindowOpenDisposition disposition);
- virtual void ShowAsPopupWithItems(WebWidget* webwidget,
- const WebKit::WebRect& bounds,
- int item_height,
- int selected_index,
- const std::vector<WebMenuItem>& items);
virtual void CloseWidgetSoon(WebWidget* webwidget);
virtual void Focus(WebWidget* webwidget);
virtual void Blur(WebWidget* webwidget);
@@ -347,7 +351,10 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
// true if we want to enable selection of trailing whitespaces
bool select_trailing_whitespace_enabled_;
+ CapturedContextMenuEvents captured_context_menu_events_;
+
WebCursor current_cursor_;
+
#if defined(OS_WIN)
// Classes needed by drag and drop.
scoped_refptr<TestDragDelegate> drag_delegate_;
@@ -361,7 +368,10 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
GdkCursorType cursor_type_;
#endif
- CapturedContextMenuEvents captured_context_menu_events_;
+#if defined(OS_MACOSX)
+ scoped_ptr<WebKit::WebPopupMenuInfo> popup_menu_info_;
+ WebKit::WebRect popup_bounds_;
+#endif
DISALLOW_COPY_AND_ASSIGN(TestWebViewDelegate);
};
diff --git a/webkit/tools/test_shell/test_webview_delegate_gtk.cc b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
index 46ecc9d..1257145 100644
--- a/webkit/tools/test_shell/test_webview_delegate_gtk.cc
+++ b/webkit/tools/test_shell/test_webview_delegate_gtk.cc
@@ -128,15 +128,6 @@ void TestWebViewDelegate::Show(WebWidget* webwidget,
gtk_widget_show_all(window);
}
-void TestWebViewDelegate::ShowAsPopupWithItems(
- WebWidget* webwidget,
- const WebRect& bounds,
- int item_height,
- int selected_index,
- const std::vector<WebMenuItem>& items) {
- NOTREACHED();
-}
-
void TestWebViewDelegate::CloseWidgetSoon(WebWidget* webwidget) {
if (webwidget == shell_->webView()) {
MessageLoop::current()->PostTask(FROM_HERE, NewRunnableFunction(
diff --git a/webkit/tools/test_shell/test_webview_delegate_win.cc b/webkit/tools/test_shell/test_webview_delegate_win.cc
index dc16544..f33c95f 100644
--- a/webkit/tools/test_shell/test_webview_delegate_win.cc
+++ b/webkit/tools/test_shell/test_webview_delegate_win.cc
@@ -81,15 +81,6 @@ void TestWebViewDelegate::Show(WebWidget* webwidget, WindowOpenDisposition) {
}
}
-void TestWebViewDelegate::ShowAsPopupWithItems(
- WebWidget* webwidget,
- const WebRect& bounds,
- int item_height,
- int selected_index,
- const std::vector<WebMenuItem>& items) {
- NOTREACHED();
-}
-
void TestWebViewDelegate::CloseWidgetSoon(WebWidget* webwidget) {
if (webwidget == shell_->webView()) {
PostMessage(shell_->mainWnd(), WM_CLOSE, 0, 0);
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index 308fb5f..4c79563 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -4243,6 +4243,7 @@
'api/public/WebNonCopyable.h',
'api/public/WebPluginListBuilder.h',
'api/public/WebPoint.h',
+ 'api/public/WebPopupMenuInfo.h',
'api/public/WebRect.h',
'api/public/WebScreenInfo.h',
'api/public/WebScriptSource.h',
@@ -4616,6 +4617,7 @@
'glue/webkitclient_impl.h',
'glue/webmediaplayer_impl.h',
'glue/webmediaplayer_impl.cc',
+ 'glue/webmenuitem.h',
'glue/webmenurunner_mac.h',
'glue/webmenurunner_mac.mm',
'glue/webplugin.h',