Chromium Code Reviews| Index: Source/WebKit/chromium/src/WebSearchableFormData.cpp |
| diff --git a/Source/WebKit/chromium/src/WebSearchableFormData.cpp b/Source/WebKit/chromium/src/WebSearchableFormData.cpp |
| index 0a916cada66ed9388cbc33c26276e831d1a5a269..ce0f4fae36596123a80fd1e89324c89068d8f0a6 100644 |
| --- a/Source/WebKit/chromium/src/WebSearchableFormData.cpp |
| +++ b/Source/WebKit/chromium/src/WebSearchableFormData.cpp |
| @@ -99,7 +99,7 @@ HTMLFormControlElement* GetButtonToActivate(HTMLFormElement* form) |
| // Returns true if the selected state of all the options matches the default |
| // selected state. |
| -bool IsSelectInDefaultState(HTMLSelectElement* select) |
| +bool IsSelectInDefaultState(Handle<HTMLSelectElement> select) |
| { |
| const Vector<HTMLElement*>& listItems = select->listItems(); |
| if (select->multiple() || select->size() > 1) { |
| @@ -135,14 +135,14 @@ bool IsSelectInDefaultState(HTMLSelectElement* select) |
| // The default state is the state of the form element on initial load of the |
| // page, and varies depending upon the form element. For example, a checkbox is |
| // in its default state if the checked state matches the state of the checked attribute. |
| -bool IsInDefaultState(HTMLFormControlElement* formElement) |
| +bool IsInDefaultState(Handle<HTMLFormControlElement> formElement) |
| { |
| if (formElement->hasTagName(HTMLNames::inputTag)) { |
| - const HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(formElement); |
| + Handle<const HTMLInputElement> inputElement = Handle<HTMLInputElement>::cast(formElement); |
| if (inputElement->isCheckbox() || inputElement->isRadioButton()) |
| return inputElement->checked() == inputElement->hasAttribute(checkedAttr); |
| } else if (formElement->hasTagName(HTMLNames::selectTag)) |
| - return IsSelectInDefaultState(static_cast<HTMLSelectElement*>(formElement)); |
| + return IsSelectInDefaultState(Handle<HTMLSelectElement>::cast(formElement)); |
| return true; |
| } |
| @@ -152,36 +152,36 @@ bool IsInDefaultState(HTMLFormControlElement* formElement) |
| // - A file upload field |
| // - A Password field |
| // - More than one text field |
| -HTMLInputElement* findSuitableSearchInputElement(const HTMLFormElement* form) |
| +Result<HTMLInputElement> findSuitableSearchInputElement(const HTMLFormElement* form) |
| { |
| - HTMLInputElement* textElement = 0; |
| + Handle<HTMLInputElement> textElement; |
| // FIXME: Consider refactoring this code so that we don't call form->associatedElements() twice. |
| for (Vector<FormAssociatedElement*>::const_iterator i(form->associatedElements().begin()); i != form->associatedElements().end(); ++i) { |
| if (!(*i)->isFormControlElement()) |
| continue; |
| - HTMLFormControlElement* formElement = static_cast<HTMLFormControlElement*>(*i); |
| + Handle<HTMLFormControlElement> formElement(static_cast<HTMLFormControlElement*>(*i)); |
| if (formElement->isDisabledFormControl() || formElement->name().isNull()) |
| continue; |
| if (!IsInDefaultState(formElement) || formElement->hasTagName(HTMLNames::textareaTag)) |
| - return 0; |
| + return nullptr; |
| if (formElement->hasTagName(HTMLNames::inputTag) && formElement->willValidate()) { |
| - const HTMLInputElement* input = static_cast<const HTMLInputElement*>(formElement); |
| + Handle<const HTMLInputElement> input = Handle<const HTMLInputElement>::cast(formElement); |
| // Return nothing if a file upload field or a password field are found. |
| if (input->isFileUpload() || input->isPasswordField()) |
| - return 0; |
| + return nullptr; |
| if (input->isTextField()) { |
| if (textElement) { |
| // The auto-complete bar only knows how to fill in one value. |
| // This form has multiple fields; don't treat it as searchable. |
| - return 0; |
| + return nullptr; |
| } |
| - textElement = static_cast<HTMLInputElement*>(formElement); |
| + textElement = Handle<HTMLInputElement>::cast(formElement); |
| } |
| } |
| } |
| @@ -194,7 +194,7 @@ HTMLInputElement* findSuitableSearchInputElement(const HTMLFormElement* form) |
| // "hl=en&source=hp&biw=1085&bih=854&q={searchTerms}&btnG=Google+Search&aq=f&aqi=&aql=&oq=" |
| // |
| // Return false if the provided HTMLInputElement is not found in the form |
| -bool buildSearchString(const HTMLFormElement* form, Vector<char>* encodedString, TextEncoding* encoding, const HTMLInputElement* textElement) |
| +bool buildSearchString(const HTMLFormElement* form, Vector<char>* encodedString, TextEncoding* encoding, Handle<const HTMLInputElement> textElement) |
| { |
| bool isElementFound = false; |
| @@ -240,7 +240,7 @@ namespace WebKit { |
| WebSearchableFormData::WebSearchableFormData(const WebFormElement& form, const WebInputElement& selectedInputElement) |
| { |
| RefPtr<HTMLFormElement> formElement = form.operator PassRefPtr<HTMLFormElement>(); |
| - HTMLInputElement* inputElement = selectedInputElement.operator PassRefPtr<HTMLInputElement>().get(); |
|
Vyacheslav Egorov (Google)
2013/07/18 16:50:08
Why there is an operator to begin with if we are u
haraken
2013/07/19 02:57:09
Done.
|
| + Handle<HTMLInputElement> inputElement = selectedInputElement.operator Handle<HTMLInputElement>(); |
| // Only consider forms that GET data. |
| // Allow HTTPS only when an input element is provided. |