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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // Returns true if the form element is in its default state, false otherwise. | 136 // Returns true if the form element is in its default state, false otherwise. |
137 // The default state is the state of the form element on initial load of the | 137 // The default state is the state of the form element on initial load of the |
138 // page, and varies depending upon the form element. For example, a checkbox is | 138 // page, and varies depending upon the form element. For example, a checkbox is |
139 // in its default state if the checked state matches the state of the checked at
tribute. | 139 // in its default state if the checked state matches the state of the checked at
tribute. |
140 bool IsInDefaultState(HTMLFormControlElement* formElement) | 140 bool IsInDefaultState(HTMLFormControlElement* formElement) |
141 { | 141 { |
142 if (formElement->hasTagName(HTMLNames::inputTag)) { | 142 if (formElement->hasTagName(HTMLNames::inputTag)) { |
143 const HTMLInputElement* inputElement = toHTMLInputElement(formElement); | 143 const HTMLInputElement* inputElement = toHTMLInputElement(formElement); |
144 if (inputElement->isCheckbox() || inputElement->isRadioButton()) | 144 if (inputElement->isCheckbox() || inputElement->isRadioButton()) |
145 return inputElement->checked() == inputElement->hasAttribute(checked
Attr); | 145 return inputElement->checked() == inputElement->hasAttribute(checked
Attr); |
146 } else if (formElement->hasTagName(HTMLNames::selectTag)) | 146 } else if (formElement->hasTagName(HTMLNames::selectTag)) { |
147 return IsSelectInDefaultState(static_cast<HTMLSelectElement*>(formElemen
t)); | 147 return IsSelectInDefaultState(toHTMLSelectElement(formElement)); |
| 148 } |
148 return true; | 149 return true; |
149 } | 150 } |
150 | 151 |
151 // Look for a suitable search text field in a given HTMLFormElement | 152 // Look for a suitable search text field in a given HTMLFormElement |
152 // Return nothing if one of those items are found: | 153 // Return nothing if one of those items are found: |
153 // - A text area field | 154 // - A text area field |
154 // - A file upload field | 155 // - A file upload field |
155 // - A Password field | 156 // - A Password field |
156 // - More than one text field | 157 // - More than one text field |
157 HTMLInputElement* findSuitableSearchInputElement(const HTMLFormElement* form) | 158 HTMLInputElement* findSuitableSearchInputElement(const HTMLFormElement* form) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 291 |
291 String action(formElement->action()); | 292 String action(formElement->action()); |
292 KURL url(formElement->document()->completeURL(action.isNull() ? "" : action)
); | 293 KURL url(formElement->document()->completeURL(action.isNull() ? "" : action)
); |
293 RefPtr<FormData> formData = FormData::create(encodedString); | 294 RefPtr<FormData> formData = FormData::create(encodedString); |
294 url.setQuery(formData->flattenToString()); | 295 url.setQuery(formData->flattenToString()); |
295 m_url = url; | 296 m_url = url; |
296 m_encoding = String(encoding.name()); | 297 m_encoding = String(encoding.name()); |
297 } | 298 } |
298 | 299 |
299 } // namespace WebKit | 300 } // namespace WebKit |
OLD | NEW |