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 return firstSubmitButton; | 95 return firstSubmitButton; |
96 } | 96 } |
97 | 97 |
98 // Returns true if the selected state of all the options matches the default | 98 // Returns true if the selected state of all the options matches the default |
99 // selected state. | 99 // selected state. |
100 bool IsSelectInDefaultState(HTMLSelectElement* select) | 100 bool IsSelectInDefaultState(HTMLSelectElement* select) |
101 { | 101 { |
102 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& listItems = select
->listItems(); | 102 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& listItems = select
->listItems(); |
103 if (select->multiple() || select->size() > 1) { | 103 if (select->multiple() || select->size() > 1) { |
104 for (WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >::const_iterator
i(listItems.begin()); i != listItems.end(); ++i) { | 104 for (WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >::const_iterator
i(listItems.begin()); i != listItems.end(); ++i) { |
105 if (!(*i)->hasLocalName(HTMLNames::optionTag)) | 105 if (!isHTMLOptionElement(*i)) |
106 continue; | 106 continue; |
107 HTMLOptionElement* optionElement = toHTMLOptionElement(*i); | 107 HTMLOptionElement* optionElement = toHTMLOptionElement(*i); |
108 if (optionElement->selected() != optionElement->hasAttribute(selecte
dAttr)) | 108 if (optionElement->selected() != optionElement->hasAttribute(selecte
dAttr)) |
109 return false; | 109 return false; |
110 } | 110 } |
111 return true; | 111 return true; |
112 } | 112 } |
113 | 113 |
114 // The select is rendered as a combobox (called menulist in WebKit). At | 114 // The select is rendered as a combobox (called menulist in WebKit). At |
115 // least one item is selected, determine which one. | 115 // least one item is selected, determine which one. |
116 HTMLOptionElement* initialSelected = 0; | 116 HTMLOptionElement* initialSelected = 0; |
117 for (WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >::const_iterator i(li
stItems.begin()); i != listItems.end(); ++i) { | 117 for (WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >::const_iterator i(li
stItems.begin()); i != listItems.end(); ++i) { |
118 if (!(*i)->hasLocalName(HTMLNames::optionTag)) | 118 if (!isHTMLOptionElement(*i)) |
119 continue; | 119 continue; |
120 HTMLOptionElement* optionElement = toHTMLOptionElement(*i); | 120 HTMLOptionElement* optionElement = toHTMLOptionElement(*i); |
121 if (optionElement->hasAttribute(selectedAttr)) { | 121 if (optionElement->hasAttribute(selectedAttr)) { |
122 // The page specified the option to select. | 122 // The page specified the option to select. |
123 initialSelected = optionElement; | 123 initialSelected = optionElement; |
124 break; | 124 break; |
125 } | 125 } |
126 if (!initialSelected) | 126 if (!initialSelected) |
127 initialSelected = optionElement; | 127 initialSelected = optionElement; |
128 } | 128 } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 String action(formElement->action()); | 285 String action(formElement->action()); |
286 KURL url(formElement->document().completeURL(action.isNull() ? "" : action))
; | 286 KURL url(formElement->document().completeURL(action.isNull() ? "" : action))
; |
287 RefPtr<FormData> formData = FormData::create(encodedString); | 287 RefPtr<FormData> formData = FormData::create(encodedString); |
288 url.setQuery(formData->flattenToString()); | 288 url.setQuery(formData->flattenToString()); |
289 m_url = url; | 289 m_url = url; |
290 m_encoding = String(encoding.name()); | 290 m_encoding = String(encoding.name()); |
291 } | 291 } |
292 | 292 |
293 } // namespace blink | 293 } // namespace blink |
OLD | NEW |