diff options
-rw-r--r-- | chrome/renderer/form_manager.cc | 42 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 8 | ||||
-rw-r--r-- | webkit/glue/dom_operations.cc | 14 | ||||
-rw-r--r-- | webkit/glue/form_field.cc | 5 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_impl.cc | 2 | ||||
-rw-r--r-- | webkit/glue/webkitclient_impl.cc | 4 | ||||
-rw-r--r-- | webkit/glue/webkitclient_impl.h | 1 | ||||
-rw-r--r-- | webkit/glue/webpasswordautocompletelistener_impl.cc | 3 |
8 files changed, 38 insertions, 41 deletions
diff --git a/chrome/renderer/form_manager.cc b/chrome/renderer/form_manager.cc index 59704d1..ab9e9e7 100644 --- a/chrome/renderer/form_manager.cc +++ b/chrome/renderer/form_manager.cc @@ -89,13 +89,13 @@ void FormManager::WebFormControlElementToFormField( string16 value; if (element.formControlType() == WebString::fromUTF8("text")) { const WebInputElement& input_element = - element.toConstElement<WebInputElement>(); + element.toConst<WebInputElement>(); value = input_element.value(); } else if (element.formControlType() == WebString::fromUTF8("select-one")) { // TODO(jhawkins): This is ugly. WebSelectElement::value() is a non-const // method. Look into fixing this on the WebKit side. WebFormControlElement& e = const_cast<WebFormControlElement&>(element); - WebSelectElement select_element = e.toElement<WebSelectElement>(); + WebSelectElement select_element = e.to<WebSelectElement>(); value = select_element.value(); } field->set_value(value); @@ -105,9 +105,9 @@ void FormManager::WebFormControlElementToFormField( string16 FormManager::LabelForElement(const WebFormControlElement& element) { WebNodeList labels = element.document().getElementsByTagName("label"); for (unsigned i = 0; i < labels.length(); ++i) { - WebElement e = labels.item(i).toElement<WebElement>(); + WebElement e = labels.item(i).to<WebElement>(); if (e.hasTagName("label")) { - WebLabelElement label = e.toElement<WebLabelElement>(); + WebLabelElement label = e.to<WebLabelElement>(); if (label.correspondingControl() == element) return GetChildText(label); } @@ -124,7 +124,7 @@ bool FormManager::WebFormElementToFormData(const WebFormElement& element, FormData* form) { DCHECK(form); - const WebFrame* frame = element.frame(); + const WebFrame* frame = element.document().frame(); if (!frame) return false; @@ -134,7 +134,7 @@ bool FormManager::WebFormElementToFormData(const WebFormElement& element, form->name = element.name(); form->method = element.method(); form->origin = frame->url(); - form->action = frame->completeURL(element.action()); + form->action = frame->document().completeURL(element.action()); // If the completed URL is not valid, just use the action we get from // WebKit. @@ -161,7 +161,7 @@ bool FormManager::WebFormElementToFormData(const WebFormElement& element, if (requirements & REQUIRE_AUTOCOMPLETE && control_element.formControlType() == WebString::fromUTF8("text")) { const WebInputElement& input_element = - control_element.toConstElement<WebInputElement>(); + control_element.toConst<WebInputElement>(); if (!input_element.autoComplete()) continue; } @@ -191,9 +191,9 @@ bool FormManager::WebFormElementToFormData(const WebFormElement& element, // label.firstChild().nodeValue() of the label element. WebNodeList labels = element.getElementsByTagName("label"); for (unsigned i = 0; i < labels.length(); ++i) { - WebLabelElement label = labels.item(i).toElement<WebLabelElement>(); + WebLabelElement label = labels.item(i).to<WebLabelElement>(); WebFormControlElement field_element = - label.correspondingControl().toElement<WebFormControlElement>(); + label.correspondingControl().to<WebFormControlElement>(); if (field_element.isNull() || !field_element.isFormControlElement()) continue; @@ -311,7 +311,7 @@ bool FormManager::FindForm(const WebFormElement& element, FormData* form) { DCHECK(form); - const WebFrame* frame = element.frame(); + const WebFrame* frame = element.document().frame(); if (!frame) return false; @@ -338,7 +338,7 @@ bool FormManager::FindFormWithFormControlElement( FormData* form) { DCHECK(form); - const WebFrame* frame = element.frame(); + const WebFrame* frame = element.document().frame(); if (!frame) return false; @@ -381,7 +381,8 @@ bool FormManager::FillForm(const FormData& form) { // Also note that WebString() == WebString(string16()) does not seem to // evaluate to |true| for some reason TBD, so forcing to string16. string16 element_name((*form_iter)->form_element.name()); - GURL action(frame->completeURL((*form_iter)->form_element.action())); + GURL action( + frame->document().completeURL((*form_iter)->form_element.action())); if (element_name == form.name && action == form.action) { form_element = *form_iter; break; @@ -436,7 +437,7 @@ bool FormManager::FillForm(const FormData& form) { if (!form.fields[j].value().empty() && element->formControlType() != WebString::fromUTF8("submit")) { if (element->formControlType() == WebString::fromUTF8("text")) { - WebInputElement input_element = element->toElement<WebInputElement>(); + WebInputElement input_element = element->to<WebInputElement>(); // If the maxlength attribute contains a negative value, maxLength() // returns the default maxlength value. input_element.setValue( @@ -445,7 +446,7 @@ bool FormManager::FillForm(const FormData& form) { } else if (element->formControlType() == WebString::fromUTF8("select-one")) { WebSelectElement select_element = - element->toElement<WebSelectElement>(); + element->to<WebSelectElement>(); select_element.setValue(form.fields[j].value()); } } @@ -481,7 +482,8 @@ bool FormManager::FormElementToFormData(const WebFrame* frame, form->name = form_element->form_element.name(); form->method = form_element->form_element.method(); form->origin = frame->url(); - form->action = frame->completeURL(form_element->form_element.action()); + form->action = + frame->document().completeURL(form_element->form_element.action()); // If the completed URL is not valid, just use the action we get from // WebKit. @@ -497,7 +499,7 @@ bool FormManager::FormElementToFormData(const WebFrame* frame, if (requirements & REQUIRE_AUTOCOMPLETE && control_element.formControlType() == WebString::fromUTF8("text")) { const WebInputElement& input_element = - control_element.toConstElement<WebInputElement>(); + control_element.toConst<WebInputElement>(); if (!input_element.autoComplete()) continue; } @@ -537,7 +539,7 @@ string16 FormManager::InferLabelForElement( // Note the lack of whitespace between <p> and <input> elements. if (inferred_label.empty()) { if (previous.isElementNode()) { - WebElement element = previous.toElement<WebElement>(); + WebElement element = previous.to<WebElement>(); if (element.hasTagName("p")) { inferred_label = GetChildText(element); TrimWhitespace(inferred_label, TRIM_ALL, &inferred_label); @@ -551,7 +553,7 @@ string16 FormManager::InferLabelForElement( if (inferred_label.empty()) { previous = previous.previousSibling(); if (!previous.isNull() && previous.isElementNode()) { - WebElement element = previous.toElement<WebElement>(); + WebElement element = previous.to<WebElement>(); if (element.hasTagName("p")) { inferred_label = GetChildText(element); TrimWhitespace(inferred_label, TRIM_ALL, &inferred_label); @@ -565,7 +567,7 @@ string16 FormManager::InferLabelForElement( if (inferred_label.empty()) { WebNode parent = element.parentNode(); if (!parent.isNull() && parent.isElementNode()) { - WebElement element = parent.toElement<WebElement>(); + WebElement element = parent.to<WebElement>(); if (element.hasTagName("td")) { previous = parent.previousSibling(); @@ -574,7 +576,7 @@ string16 FormManager::InferLabelForElement( previous = previous.previousSibling(); if (!previous.isNull() && previous.isElementNode()) { - element = previous.toElement<WebElement>(); + element = previous.to<WebElement>(); if (element.hasTagName("td")) { inferred_label = GetChildText(element); TrimWhitespace(inferred_label, TRIM_ALL, &inferred_label); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 33238d6..da1bea90 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -2000,7 +2000,7 @@ void RenderView::queryAutofillSuggestions(const WebNode& node, autofill_query_node_ = node; const WebFormControlElement& element = - node.toConstElement<WebFormControlElement>(); + node.toConst<WebFormControlElement>(); webkit_glue::FormField field; FormManager::WebFormControlElementToFormField(element, true, &field); @@ -2028,7 +2028,7 @@ void RenderView::didAcceptAutoFillSuggestion( autofill_query_id_ = query_counter++; webkit_glue::FormData form; - const WebInputElement element = node.toConstElement<WebInputElement>(); + const WebInputElement element = node.toConst<WebInputElement>(); if (!form_manager_.FindFormWithFormControlElement( element, FormManager::REQUIRE_NONE, &form)) return; @@ -3307,8 +3307,8 @@ GURL RenderView::GetAlternateErrorPageURL(const GURL& failed_url, } webkit_glue::WebPluginDelegate* RenderView::GetDelegateForPluginDocument() { - WebPlugin* plugin = webview()->mainFrame()->document(). - toElement<WebPluginDocument>().plugin(); + WebPlugin* plugin = + webview()->mainFrame()->document().to<WebPluginDocument>().plugin(); return static_cast<webkit_glue::WebPluginImpl*>(plugin)->delegate(); } diff --git a/webkit/glue/dom_operations.cc b/webkit/glue/dom_operations.cc index 982bbba..d5058ea 100644 --- a/webkit/glue/dom_operations.cc +++ b/webkit/glue/dom_operations.cc @@ -138,7 +138,7 @@ void GetAllSavableResourceLinksForFrame(WebFrame* current_frame, // We only save HTML resources. if (!node.isElementNode()) continue; - WebElement element = node.toElement<WebElement>(); + WebElement element = node.to<WebElement>(); GetSavableResourceLinkForElement(element, current_doc, unique_check, @@ -221,7 +221,7 @@ static bool FindFormInputElements(WebFormElement* fe, // matching elements it can get at them through the FormElement*. // Note: This assignment adds a reference to the InputElement. result->input_elements[data.fields[j].name()] = - temp_elements[0].toElement<WebInputElement>(); + temp_elements[0].to<WebInputElement>(); } return true; } @@ -256,7 +256,7 @@ static void FindFormElements(WebView* view, for (size_t i = 0; i < forms.size(); ++i) { WebFormElement fe = forms[i]; // Action URL must match. - GURL full_action(f->completeURL(fe.action())); + GURL full_action(f->document().completeURL(fe.action())); if (data.action != full_action.ReplaceComponents(rep)) continue; @@ -298,7 +298,7 @@ void FillPasswordForm(WebView* view, WebInputElement password_element = form_elements->input_elements[data.basic_data.fields[1].name()]; - username_element.frame()->registerPasswordListener( + username_element.document().frame()->registerPasswordListener( username_element, new WebPasswordAutocompleteListenerImpl( new WebInputElementDelegate(username_element), @@ -313,7 +313,7 @@ WebString GetSubResourceLinkFromElement(const WebElement& element) { element.hasTagName("script")) { attribute_name = "src"; } else if (element.hasTagName("input")) { - const WebInputElement input = element.toConstElement<WebInputElement>(); + const WebInputElement input = element.toConst<WebInputElement>(); if (input.inputType() == WebInputElement::Image) { attribute_name = "src"; } @@ -494,7 +494,7 @@ void GetApplicationInfo(WebView* view, WebApplicationInfo* app_info) { WebNode child = children.item(i); if (!child.isElementNode()) continue; - WebElement elem = child.toElement<WebElement>(); + WebElement elem = child.to<WebElement>(); if (elem.hasTagName("link")) { std::string rel = elem.getAttribute("rel").utf8(); @@ -577,7 +577,7 @@ bool ElementDoesAutoCompleteForElementWithId(WebView* view, if (element.isNull() || !element.hasTagName("input")) return false; - WebInputElement input_element = element.toElement<WebInputElement>(); + WebInputElement input_element = element.to<WebInputElement>(); return input_element.autoComplete(); } diff --git a/webkit/glue/form_field.cc b/webkit/glue/form_field.cc index a82283a..069c6c3 100644 --- a/webkit/glue/form_field.cc +++ b/webkit/glue/form_field.cc @@ -29,11 +29,10 @@ FormField::FormField(WebFormControlElement element) { form_control_type_ = element.formControlType(); if (form_control_type_ == ASCIIToUTF16("text")) { - const WebInputElement& input_element = - element.toConstElement<WebInputElement>(); + const WebInputElement& input_element = element.toConst<WebInputElement>(); value_ = input_element.value(); } else if (form_control_type_ == ASCIIToUTF16("select-one")) { - WebSelectElement select_element = element.toElement<WebSelectElement>(); + WebSelectElement select_element = element.to<WebSelectElement>(); value_ = select_element.value(); } diff --git a/webkit/glue/plugins/webplugin_impl.cc b/webkit/glue/plugins/webplugin_impl.cc index 20d1907..30c2fa3 100644 --- a/webkit/glue/plugins/webplugin_impl.cc +++ b/webkit/glue/plugins/webplugin_impl.cc @@ -484,7 +484,7 @@ GURL WebPluginImpl::CompleteURL(const char* url) { return GURL(); } // TODO(darin): Is conversion from UTF8 correct here? - return webframe_->completeURL(WebString::fromUTF8(url)); + return webframe_->document().completeURL(WebString::fromUTF8(url)); } void WebPluginImpl::CancelResource(unsigned long id) { diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc index 781eafc..bedae2d 100644 --- a/webkit/glue/webkitclient_impl.cc +++ b/webkit/glue/webkitclient_impl.cc @@ -332,10 +332,6 @@ void WebKitClientImpl::stopSharedTimer() { shared_timer_.Stop(); } -void WebKitClientImpl::callOnMainThread(void (*func)()) { - main_loop_->PostTask(FROM_HERE, NewRunnableFunction(func)); -} - void WebKitClientImpl::callOnMainThread(void (*func)(void*), void* context) { main_loop_->PostTask(FROM_HERE, NewRunnableFunction(func, context)); } diff --git a/webkit/glue/webkitclient_impl.h b/webkit/glue/webkitclient_impl.h index 0f3ee75..a6bdad5 100644 --- a/webkit/glue/webkitclient_impl.h +++ b/webkit/glue/webkitclient_impl.h @@ -68,7 +68,6 @@ class WebKitClientImpl : public WebKit::WebKitClient { virtual void setSharedTimerFiredFunction(void (*func)()); virtual void setSharedTimerFireTime(double fireTime); virtual void stopSharedTimer(); - virtual void callOnMainThread(void (*func)()); virtual void callOnMainThread(void (*func)(void*), void* context); void SuspendSharedTimer(); diff --git a/webkit/glue/webpasswordautocompletelistener_impl.cc b/webkit/glue/webpasswordautocompletelistener_impl.cc index 60d46ee5..d6ba4ab 100644 --- a/webkit/glue/webpasswordautocompletelistener_impl.cc +++ b/webkit/glue/webpasswordautocompletelistener_impl.cc @@ -10,6 +10,7 @@ #include <vector> #include "base/string_util.h" +#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h" @@ -51,7 +52,7 @@ void WebInputElementDelegate::OnFinishedAutocompleting() { void WebInputElementDelegate::RefreshAutofillPopup( const std::vector<string16>& suggestions, int default_suggestion_index) { - WebView* webview = element_.frame()->view(); + WebView* webview = element_.document().frame()->view(); if (webview) webview->applyAutocompleteSuggestions(element_, suggestions, default_suggestion_index); |