| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 { | 57 { |
| 58 String str(form->getAttribute(HTMLNames::accept_charsetAttr)); | 58 String str(form->getAttribute(HTMLNames::accept_charsetAttr)); |
| 59 str.replace(',', ' '); | 59 str.replace(',', ' '); |
| 60 Vector<String> charsets; | 60 Vector<String> charsets; |
| 61 str.split(' ', charsets); | 61 str.split(' ', charsets); |
| 62 for (Vector<String>::const_iterator i(charsets.begin()); i != charsets.end()
; ++i) { | 62 for (Vector<String>::const_iterator i(charsets.begin()); i != charsets.end()
; ++i) { |
| 63 *encoding = TextEncoding(*i); | 63 *encoding = TextEncoding(*i); |
| 64 if (encoding->isValid()) | 64 if (encoding->isValid()) |
| 65 return; | 65 return; |
| 66 } | 66 } |
| 67 if (!form->document()->loader()) |
| 68 return; |
| 67 *encoding = TextEncoding(form->document()->loader()->writer()->encoding()); | 69 *encoding = TextEncoding(form->document()->loader()->writer()->encoding()); |
| 68 } | 70 } |
| 69 | 71 |
| 70 // Returns true if the submit request results in an HTTP URL. | 72 // Returns true if the submit request results in an HTTP URL. |
| 71 bool IsHTTPFormSubmit(const HTMLFormElement* form) | 73 bool IsHTTPFormSubmit(const HTMLFormElement* form) |
| 72 { | 74 { |
| 73 // FIXME: This function is insane. This is an overly complicated way to get
this information. | 75 // FIXME: This function is insane. This is an overly complicated way to get
this information. |
| 74 String action(form->action()); | 76 String action(form->action()); |
| 75 // The isNull() check is trying to avoid completeURL returning KURL() when p
assed a null string. | 77 // The isNull() check is trying to avoid completeURL returning KURL() when p
assed a null string. |
| 76 return form->document()->completeURL(action.isNull() ? "" : action).protocol
Is("http"); | 78 return form->document()->completeURL(action.isNull() ? "" : action).protocol
Is("http"); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 288 |
| 287 String action(formElement->action()); | 289 String action(formElement->action()); |
| 288 KURL url(formElement->document()->completeURL(action.isNull() ? "" : action)
); | 290 KURL url(formElement->document()->completeURL(action.isNull() ? "" : action)
); |
| 289 RefPtr<FormData> formData = FormData::create(encodedString); | 291 RefPtr<FormData> formData = FormData::create(encodedString); |
| 290 url.setQuery(formData->flattenToString()); | 292 url.setQuery(formData->flattenToString()); |
| 291 m_url = url; | 293 m_url = url; |
| 292 m_encoding = String(encoding.name()); | 294 m_encoding = String(encoding.name()); |
| 293 } | 295 } |
| 294 | 296 |
| 295 } // namespace WebKit | 297 } // namespace WebKit |
| OLD | NEW |