summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebKit/android/WebCoreSupport/autofill/AutoFillHostAndroid.cpp4
-rw-r--r--WebKit/android/WebCoreSupport/autofill/AutoFillHostAndroid.h2
-rw-r--r--WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp28
-rw-r--r--WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.h7
-rw-r--r--WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp8
-rw-r--r--WebKit/android/WebCoreSupport/autofill/WebAutoFill.h2
-rw-r--r--WebKit/android/nav/CachedRoot.cpp7
7 files changed, 38 insertions, 20 deletions
diff --git a/WebKit/android/WebCoreSupport/autofill/AutoFillHostAndroid.cpp b/WebKit/android/WebCoreSupport/autofill/AutoFillHostAndroid.cpp
index 62963f2..5bc4c92 100644
--- a/WebKit/android/WebCoreSupport/autofill/AutoFillHostAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/autofill/AutoFillHostAndroid.cpp
@@ -35,11 +35,11 @@ AutoFillHostAndroid::AutoFillHostAndroid(WebAutoFill* autoFill)
{
}
-void AutoFillHostAndroid::AutoFillSuggestionsReturned(int queryId, const std::vector<string16>& names, const std::vector<string16>& labels, const std::vector<string16>& icons, const std::vector<int>& uniqueIds)
+void AutoFillHostAndroid::AutoFillSuggestionsReturned(const std::vector<string16>& names, const std::vector<string16>& labels, const std::vector<string16>& icons, const std::vector<int>& uniqueIds)
{
// TODO: what do we do with icons?
if (mAutoFill)
- mAutoFill->querySuccessful(queryId, names[0], labels[0], uniqueIds[0]);
+ mAutoFill->querySuccessful(names[0], labels[0], uniqueIds[0]);
}
void AutoFillHostAndroid::AutoFillFormDataFilled(int queryId, const webkit_glue::FormData& form)
diff --git a/WebKit/android/WebCoreSupport/autofill/AutoFillHostAndroid.h b/WebKit/android/WebCoreSupport/autofill/AutoFillHostAndroid.h
index c863e62..9677b46 100644
--- a/WebKit/android/WebCoreSupport/autofill/AutoFillHostAndroid.h
+++ b/WebKit/android/WebCoreSupport/autofill/AutoFillHostAndroid.h
@@ -43,7 +43,7 @@ public:
AutoFillHostAndroid(WebAutoFill* autoFill);
virtual ~AutoFillHostAndroid() { }
- virtual void AutoFillSuggestionsReturned(int queryId, const std::vector<string16>& names, const std::vector<string16>& labels, const std::vector<string16>& icons, const std::vector<int>& uniqueIds);
+ virtual void AutoFillSuggestionsReturned(const std::vector<string16>& names, const std::vector<string16>& labels, const std::vector<string16>& icons, const std::vector<int>& uniqueIds);
virtual void AutoFillFormDataFilled(int queryId, const webkit_glue::FormData&);
private:
diff --git a/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp b/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
index 9942bec..5a5ff9a 100644
--- a/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.cpp
@@ -334,6 +334,18 @@ void FormManager::HTMLFormControlElementToFormField(HTMLFormControlElement* elem
} else if (formControlType(*element) == kSelectOne) {
HTMLSelectElement* select_element = static_cast<HTMLSelectElement*>(element);
value = WTFStringToString16(select_element->value());
+
+ // Convert the |select_element| value to text if requested.
+ if (extract_mask & EXTRACT_OPTION_TEXT) {
+ Vector<Element*> list_items = select_element->listItems();
+ for (size_t i = 0; i < list_items.size(); ++i) {
+ if (list_items[i]->hasTagName(optionTag) &&
+ WTFStringToString16(static_cast<HTMLOptionElement*>(list_items[i])->value()) == value) {
+ value = WTFStringToString16(static_cast<HTMLOptionElement*>(list_items[i])->text());
+ break;
+ }
+ }
+ }
}
// TODO: This is a temporary stop-gap measure designed to prevent
@@ -480,26 +492,26 @@ void FormManager::ExtractForms(Frame* frame) {
WTF::PassRefPtr<HTMLCollection> web_forms = frame->document()->forms();
for (size_t i = 0; i < web_forms->length(); ++i) {
- FormElement* form_elements = new FormElement;
- HTMLFormElement* form_element = static_cast<HTMLFormElement*>(web_forms->item(i));
- form_elements->form_element = form_element;
+ FormElement* form_element = new FormElement;
+ HTMLFormElement* html_form_element = static_cast<HTMLFormElement*>(web_forms->item(i));
+ form_element->form_element = html_form_element;
- WTF::Vector<HTMLFormControlElement*> control_elements = form_element->associatedElements();
+ WTF::Vector<HTMLFormControlElement*> control_elements = html_form_element->associatedElements();
for (size_t j = 0; j < control_elements.size(); ++j) {
HTMLFormControlElement* element = control_elements[j];
- form_elements->control_elements.push_back(element);
+ form_element->control_elements.push_back(element);
// Save original values of "select-one" inputs so we can restore them
// when |ClearFormWithNode()| is invoked.
if (formControlType(*element) == kSelectOne) {
HTMLSelectElement* select_element = static_cast<HTMLSelectElement*>(element);
string16 value = WTFStringToString16(select_element->value());
- form_elements->control_values.push_back(value);
+ form_element->control_values.push_back(value);
} else
- form_elements->control_values.push_back(string16());
+ form_element->control_values.push_back(string16());
}
- form_elements_.push_back(form_elements);
+ form_elements_.push_back(form_element);
}
}
diff --git a/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.h b/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.h
index b4dac83..eed3963 100644
--- a/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.h
+++ b/WebKit/android/WebCoreSupport/autofill/FormManagerAndroid.h
@@ -68,9 +68,10 @@ public:
// A bit field mask to extract data from HTMLFormControlElement.
enum ExtractMask {
- EXTRACT_NONE = 0,
- EXTRACT_VALUE = 1 << 0, // Extract value from HTMLFormControlElement.
- EXTRACT_OPTIONS = 1 << 1, // Extract options from HTMLFormControlElement.
+ EXTRACT_NONE = 0,
+ EXTRACT_VALUE = 1 << 0, // Extract value from HTMLFormControlElement.
+ EXTRACT_OPTION_TEXT = 1 << 1, // Extract option text from HTMLFormSelectElement. Only valid when |EXTRACT_VALUE| is set. This is used for form submission where humand readable value is captured.
+ EXTRACT_OPTIONS = 1 << 2, // Extract options from HTMLFormControlElement.
};
FormManager();
diff --git a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
index 2d92b4b..4fa0e54 100644
--- a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
+++ b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
@@ -122,7 +122,7 @@ void WebAutoFill::formFieldFocused(WebCore::HTMLFormControlElement* formFieldEle
mFormManager->FindFormWithFormControlElement(formFieldElement, FormManager::REQUIRE_AUTOCOMPLETE, form);
mQueryMap[mQueryId] = form;
- bool suggestions = mAutoFillManager->GetAutoFillSuggestions(mQueryId, false, formField);
+ bool suggestions = mAutoFillManager->GetAutoFillSuggestions(false, formField);
mQueryId++;
if (!suggestions) {
ASSERT(mWebViewCore);
@@ -132,17 +132,17 @@ void WebAutoFill::formFieldFocused(WebCore::HTMLFormControlElement* formFieldEle
}
}
-void WebAutoFill::querySuccessful(int queryId, const string16& value, const string16& label, int uniqueId)
+void WebAutoFill::querySuccessful(const string16& value, const string16& label, int uniqueId)
{
if (!enabled())
return;
// Store the unique ID for the query and inform java that autofill suggestions for this form are available.
// Pass java the queryId so that it can pass it back if the user decides to use autofill.
- mUniqueIdMap[queryId] = uniqueId;
+ mUniqueIdMap[mQueryId] = uniqueId;
ASSERT(mWebViewCore);
- mWebViewCore->setWebTextViewAutoFillable(queryId, mAutoFillProfile->Label());
+ mWebViewCore->setWebTextViewAutoFillable(mQueryId, mAutoFillProfile->Label());
}
void WebAutoFill::fillFormFields(int queryId)
diff --git a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.h b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.h
index 422129f..4025b5a 100644
--- a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.h
+++ b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.h
@@ -58,7 +58,7 @@ public:
void searchDocument(WebCore::Frame*);
void formFieldFocused(WebCore::HTMLFormControlElement*);
void fillFormFields(int queryId);
- void querySuccessful(int queryId, const string16& value, const string16& label, int uniqueId);
+ void querySuccessful(const string16& value, const string16& label, int uniqueId);
void fillFormInPage(int queryId, const webkit_glue::FormData& form);
void setWebViewCore(WebViewCore* webViewCore) { mWebViewCore = webViewCore; }
bool enabled() const;
diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp
index 7d5f3d9..7f4f06f 100644
--- a/WebKit/android/nav/CachedRoot.cpp
+++ b/WebKit/android/nav/CachedRoot.cpp
@@ -801,6 +801,7 @@ public:
mLayerTypes.size());
mLayers.remove(remove);
mLayerTypes.remove(remove);
+ mAppendLikeTypes = false;
return;
}
}
@@ -896,12 +897,15 @@ protected:
if (mType != kDrawGlyph_Type && mType != kDrawRect_Type
&& mType != kDrawSprite_Type && mType != kDrawBitmap_Type)
return false;
- if (mLayerTypes.isEmpty() || mLayerTypes.last() != mType)
+ if (mLayerTypes.isEmpty() || mLayerTypes.last() != mType
+ || !mAppendLikeTypes) {
push(mType, mEmpty);
+ }
DBG_NAV_LOGD("RingCheck join %s (%d,%d,r=%d,b=%d) '%c'",
TypeNames[mType], rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
mCh);
mLayers.last().op(rect, SkRegion::kUnion_Op);
+ mAppendLikeTypes = true;
return false;
}
@@ -1017,6 +1021,7 @@ private:
Vector<Type> mLayerTypes;
const SkPaint* mPaint;
char mCh;
+ bool mAppendLikeTypes;
};
class RingCanvas : public BoundsCanvas {