| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 if (!firstSubmitButton && control->isSuccessfulSubmitButton()) | 95 if (!firstSubmitButton && control->isSuccessfulSubmitButton()) |
| 96 firstSubmitButton = control; | 96 firstSubmitButton = control; |
| 97 } | 97 } |
| 98 return firstSubmitButton; | 98 return firstSubmitButton; |
| 99 } | 99 } |
| 100 | 100 |
| 101 // Returns true if the selected state of all the options matches the default | 101 // Returns true if the selected state of all the options matches the default |
| 102 // selected state. | 102 // selected state. |
| 103 bool isSelectInDefaultState(const HTMLSelectElement& select) | 103 bool isSelectInDefaultState(const HTMLSelectElement& select) |
| 104 { | 104 { |
| 105 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& listItems = select.
listItems(); | 105 const HeapVector<Member<HTMLElement>>& listItems = select.listItems(); |
| 106 if (select.multiple() || select.size() > 1) { | 106 if (select.multiple() || select.size() > 1) { |
| 107 for (const auto& item : listItems) { | 107 for (const auto& item : listItems) { |
| 108 if (!isHTMLOptionElement(*item)) | 108 if (!isHTMLOptionElement(*item)) |
| 109 continue; | 109 continue; |
| 110 HTMLOptionElement* optionElement = toHTMLOptionElement(item); | 110 HTMLOptionElement* optionElement = toHTMLOptionElement(item); |
| 111 if (optionElement->selected() != optionElement->fastHasAttribute(sel
ectedAttr)) | 111 if (optionElement->selected() != optionElement->fastHasAttribute(sel
ectedAttr)) |
| 112 return false; | 112 return false; |
| 113 } | 113 } |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 return isElementFound; | 228 return isElementFound; |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace | 231 } // namespace |
| 232 | 232 |
| 233 WebSearchableFormData::WebSearchableFormData(const WebFormElement& form, const W
ebInputElement& selectedInputElement) | 233 WebSearchableFormData::WebSearchableFormData(const WebFormElement& form, const W
ebInputElement& selectedInputElement) |
| 234 { | 234 { |
| 235 RefPtrWillBeRawPtr<HTMLFormElement> formElement = static_cast<PassRefPtrWill
BeRawPtr<HTMLFormElement>>(form); | 235 RawPtr<HTMLFormElement> formElement = static_cast<RawPtr<HTMLFormElement>>(f
orm); |
| 236 HTMLInputElement* inputElement = static_cast<PassRefPtrWillBeRawPtr<HTMLInpu
tElement>>(selectedInputElement).get(); | 236 HTMLInputElement* inputElement = static_cast<RawPtr<HTMLInputElement>>(selec
tedInputElement).get(); |
| 237 | 237 |
| 238 // Only consider forms that GET data. | 238 // Only consider forms that GET data. |
| 239 // Allow HTTPS only when an input element is provided. | 239 // Allow HTTPS only when an input element is provided. |
| 240 if (equalIgnoringCase(formElement->getAttribute(methodAttr), "post") | 240 if (equalIgnoringCase(formElement->getAttribute(methodAttr), "post") |
| 241 || (!isHTTPFormSubmit(*formElement) && !inputElement)) | 241 || (!isHTTPFormSubmit(*formElement) && !inputElement)) |
| 242 return; | 242 return; |
| 243 | 243 |
| 244 WTF::TextEncoding encoding; | 244 WTF::TextEncoding encoding; |
| 245 getFormEncoding(*formElement, &encoding); | 245 getFormEncoding(*formElement, &encoding); |
| 246 if (!encoding.isValid()) { | 246 if (!encoding.isValid()) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 280 |
| 281 String action(formElement->action()); | 281 String action(formElement->action()); |
| 282 KURL url(formElement->document().completeURL(action.isNull() ? "" : action))
; | 282 KURL url(formElement->document().completeURL(action.isNull() ? "" : action))
; |
| 283 RefPtr<EncodedFormData> formData = EncodedFormData::create(encodedString); | 283 RefPtr<EncodedFormData> formData = EncodedFormData::create(encodedString); |
| 284 url.setQuery(formData->flattenToString()); | 284 url.setQuery(formData->flattenToString()); |
| 285 m_url = url; | 285 m_url = url; |
| 286 m_encoding = String(encoding.name()); | 286 m_encoding = String(encoding.name()); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace blink | 289 } // namespace blink |
| OLD | NEW |