summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-12-06 16:24:29 -0500
committerLeon Scroggins <scroggo@google.com>2010-12-07 10:53:11 -0500
commit1caed8e3c0af63e20009e74642e2574e1185c38e (patch)
tree57534ec0e97923a48a510be3fe25a505f8acd00a /WebKit
parentc65c296d5bbf1608aedeceac90179a261deb0368 (diff)
downloadexternal_webkit-1caed8e3c0af63e20009e74642e2574e1185c38e.zip
external_webkit-1caed8e3c0af63e20009e74642e2574e1185c38e.tar.gz
external_webkit-1caed8e3c0af63e20009e74642e2574e1185c38e.tar.bz2
Fix for <select> elements.
Bug:3230016 Allow webkit to handle the click on a <select> element if it is a RenderMenuList. Implement PopupMenu class, using PopupMenuClient to interact with the <select> element. Change-Id: I9611c23304fc2fc3eb01ecbd7a46fa02cd52df9a
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp4
-rw-r--r--WebKit/android/jni/WebViewCore.cpp28
-rw-r--r--WebKit/android/jni/WebViewCore.h8
3 files changed, 11 insertions, 29 deletions
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
index 80a90fe..20ad5b9 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
@@ -531,9 +531,9 @@ bool ChromeClientAndroid::selectItemWritingDirectionIsNatural()
return false;
}
-PassRefPtr<PopupMenu> ChromeClientAndroid::createPopupMenu(PopupMenuClient*) const
+PassRefPtr<PopupMenu> ChromeClientAndroid::createPopupMenu(PopupMenuClient* client) const
{
- return adoptRef(new PopupMenuAndroid);
+ return adoptRef(new PopupMenuAndroid(client));
}
PassRefPtr<SearchPopupMenu> ChromeClientAndroid::createSearchPopupMenu(PopupMenuClient*) const
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 6b1ca44..228c16b 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -2490,26 +2490,11 @@ public:
, m_viewImpl(view)
{}
- // Response used if the listbox only allows single selection.
- // index is listIndex of the selected item, or -1 if nothing is selected.
+ // Response used for a multiple selection listbox if the user did not change
+ // anything, in which case -2 is used.
virtual void replyInt(int index)
{
- if (-2 == index) {
- // Special value for cancel. Do nothing.
- return;
- }
- // If the select element no longer exists, due to a page change, etc,
- // silently return.
- if (!m_select || !CacheBuilder::validNode(m_viewImpl->m_mainFrame,
- m_frame, m_select))
- return;
- // Use a pointer to HTMLSelectElement's superclass, where
- // listToOptionIndex is public.
- SelectElement* selectElement = m_select;
- int optionIndex = selectElement->listToOptionIndex(index);
- m_select->setSelectedIndex(optionIndex, true);
- m_select->dispatchFormControlChangeEvent();
- m_viewImpl->contentInvalidate(m_select->getRect());
+ LOG_ASSERT(-2 == index, "ListBoxReply::replyInt should only be called with -2");
}
// Response if the listbox allows multiple selection. array stores the listIndices
@@ -2522,9 +2507,6 @@ public:
m_frame, m_select))
return;
- // If count is 1 or 0, use replyInt.
- SkASSERT(count > 1);
-
const WTF::Vector<Element*>& items = m_select->listItems();
int totalItems = static_cast<int>(items.size());
// Keep track of the position of the value we are comparing against.
@@ -2872,7 +2854,7 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
}
WebCore::RenderObject* renderer = nodePtr->renderer();
- if (renderer && (renderer->isMenuList() || renderer->isListBox())) {
+ if (renderer && renderer->isListBox()) {
WebCore::HTMLSelectElement* select = static_cast<WebCore::HTMLSelectElement*>(nodePtr);
const WTF::Vector<WebCore::Element*>& listItems = select->listItems();
SkTDArray<const uint16_t*> names;
@@ -2907,7 +2889,7 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
listBoxRequest(reply, names.begin(), size, enabledArray.begin(), enabledArray.count(),
multiple, selectedArray.begin(), multiple ? selectedArray.count() :
selectElement->optionToListIndex(select->selectedIndex()));
- DBG_NAV_LOG("menu list");
+ DBG_NAV_LOG("list box");
return true;
}
}
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 4278261..41dc2e0f 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -514,6 +514,10 @@ namespace android {
DeviceMotionAndOrientationManager* deviceMotionAndOrientationManager() { return &m_deviceMotionAndOrientationManager; }
+ void listBoxRequest(WebCoreReply* reply, const uint16_t** labels,
+ size_t count, const int enabled[], size_t enabledCount,
+ bool multiple, const int selected[], size_t selectedCountOrSelection);
+
// these members are shared with webview.cpp
static Mutex gFrameCacheMutex;
CachedRoot* m_frameCacheKit; // nav data being built by webcore
@@ -552,10 +556,6 @@ namespace android {
void updateButtonList(WTF::Vector<Container>* buttons);
void reset(bool fromConstructor);
- void listBoxRequest(WebCoreReply* reply, const uint16_t** labels,
- size_t count, const int enabled[], size_t enabledCount,
- bool multiple, const int selected[], size_t selectedCountOrSelection);
-
friend class ListBoxReply;
struct JavaGlue;
struct JavaGlue* m_javaGlue;