summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2009-10-19 19:02:43 -0400
committerLeon Scroggins <scroggo@google.com>2009-10-21 10:01:34 -0400
commit2e6cbc526015b55b3dc853cf15445a8537b70869 (patch)
treee8ca34160378fd6bd049e7f423f91b7ed07f237d /WebKit
parent5c9d7370ae13ad2e17aaa70bce7ef5494371fd52 (diff)
downloadexternal_webkit-2e6cbc526015b55b3dc853cf15445a8537b70869.zip
external_webkit-2e6cbc526015b55b3dc853cf15445a8537b70869.tar.gz
external_webkit-2e6cbc526015b55b3dc853cf15445a8537b70869.tar.bz2
Do not show radio/checkboxes for <optgroup> labels.
Fix for http://b/issue?id=2186188. Keep track of <optgroup> labels separately from disabled <option> labels. Requires a change to frameworks/base.
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 5ad8a9e..5b30d0a 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -239,9 +239,9 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
m_javaGlue->m_scrollTo = GetJMethod(env, clazz, "contentScrollTo", "(II)V");
m_javaGlue->m_scrollBy = GetJMethod(env, clazz, "contentScrollBy", "(IIZ)V");
m_javaGlue->m_contentDraw = GetJMethod(env, clazz, "contentDraw", "()V");
- m_javaGlue->m_requestListBox = GetJMethod(env, clazz, "requestListBox", "([Ljava/lang/String;[Z[I)V");
+ m_javaGlue->m_requestListBox = GetJMethod(env, clazz, "requestListBox", "([Ljava/lang/String;[I[I)V");
m_javaGlue->m_openFileChooser = GetJMethod(env, clazz, "openFileChooser", "()Ljava/lang/String;");
- m_javaGlue->m_requestSingleListBox = GetJMethod(env, clazz, "requestListBox", "([Ljava/lang/String;[ZI)V");
+ m_javaGlue->m_requestSingleListBox = GetJMethod(env, clazz, "requestListBox", "([Ljava/lang/String;[II)V");
m_javaGlue->m_jsAlert = GetJMethod(env, clazz, "jsAlert", "(Ljava/lang/String;Ljava/lang/String;)V");
m_javaGlue->m_jsConfirm = GetJMethod(env, clazz, "jsConfirm", "(Ljava/lang/String;Ljava/lang/String;)Z");
m_javaGlue->m_jsPrompt = GetJMethod(env, clazz, "jsPrompt", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;");
@@ -1908,14 +1908,14 @@ void WebViewCore::listBoxRequest(WebCoreReply* reply, const uint16_t** labels, s
jobjectArray labelArray = makeLabelArray(env, labels, count);
// Create an array determining whether each item is enabled.
- jbooleanArray enabledArray = env->NewBooleanArray(enabledCount);
+ jintArray enabledArray = env->NewIntArray(enabledCount);
checkException(env);
- jboolean* ptrArray = env->GetBooleanArrayElements(enabledArray, 0);
+ jint* ptrArray = env->GetIntArrayElements(enabledArray, 0);
checkException(env);
for (size_t i = 0; i < enabledCount; i++) {
ptrArray[i] = enabled[i];
}
- env->ReleaseBooleanArrayElements(enabledArray, ptrArray, 0);
+ env->ReleaseIntArrayElements(enabledArray, ptrArray, 0);
checkException(env);
if (multiple) {
@@ -2066,6 +2066,13 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
WebCore::HTMLSelectElement* select = static_cast<WebCore::HTMLSelectElement*>(nodePtr);
const WTF::Vector<WebCore::Element*>& listItems = select->listItems();
SkTDArray<const uint16_t*> names;
+ // Possible values for enabledArray. Keep in Sync with values in
+ // InvokeListBox.Container in WebView.java
+ enum OptionStatus {
+ OPTGROUP = -1,
+ OPTION_DISABLED = 0,
+ OPTION_ENABLED = 1,
+ };
SkTDArray<int> enabledArray;
SkTDArray<int> selectedArray;
int size = listItems.size();
@@ -2074,13 +2081,13 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
if (listItems[i]->hasTagName(WebCore::HTMLNames::optionTag)) {
WebCore::HTMLOptionElement* option = static_cast<WebCore::HTMLOptionElement*>(listItems[i]);
*names.append() = stringConverter(option->textIndentedToRespectGroupLabel());
- *enabledArray.append() = option->disabled() ? 0 : 1;
+ *enabledArray.append() = option->disabled() ? OPTION_DISABLED : OPTION_ENABLED;
if (multiple && option->selected())
*selectedArray.append() = i;
} else if (listItems[i]->hasTagName(WebCore::HTMLNames::optgroupTag)) {
WebCore::HTMLOptGroupElement* optGroup = static_cast<WebCore::HTMLOptGroupElement*>(listItems[i]);
*names.append() = stringConverter(optGroup->groupLabelText());
- *enabledArray.append() = 0;
+ *enabledArray.append() = OPTGROUP;
}
}
WebCoreReply* reply = new ListBoxReply(select, select->document()->frame(), this);