OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "core/events/Event.h" | 35 #include "core/events/Event.h" |
36 #include "core/html/FormDataList.h" | 36 #include "core/html/FormDataList.h" |
37 #include "core/html/HTMLFormElement.h" | 37 #include "core/html/HTMLFormElement.h" |
38 #include "core/html/HTMLInputElement.h" | 38 #include "core/html/HTMLInputElement.h" |
39 #include "core/html/forms/InputTypeNames.h" | 39 #include "core/html/forms/InputTypeNames.h" |
40 #include "platform/text/PlatformLocale.h" | 40 #include "platform/text/PlatformLocale.h" |
41 #include "wtf/PassOwnPtr.h" | 41 #include "wtf/PassOwnPtr.h" |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 PassRefPtr<InputType> SubmitInputType::create(HTMLInputElement* element) | 45 PassRefPtr<InputType> SubmitInputType::create(HTMLInputElement& element) |
46 { | 46 { |
47 return adoptRef(new SubmitInputType(element)); | 47 return adoptRef(new SubmitInputType(element)); |
48 } | 48 } |
49 | 49 |
50 const AtomicString& SubmitInputType::formControlType() const | 50 const AtomicString& SubmitInputType::formControlType() const |
51 { | 51 { |
52 return InputTypeNames::submit(); | 52 return InputTypeNames::submit(); |
53 } | 53 } |
54 | 54 |
55 bool SubmitInputType::appendFormData(FormDataList& encoding, bool) const | 55 bool SubmitInputType::appendFormData(FormDataList& encoding, bool) const |
56 { | 56 { |
57 if (!element()->isActivatedSubmit()) | 57 if (!element().isActivatedSubmit()) |
58 return false; | 58 return false; |
59 encoding.appendData(element()->name(), element()->valueWithDefault()); | 59 encoding.appendData(element().name(), element().valueWithDefault()); |
60 return true; | 60 return true; |
61 } | 61 } |
62 | 62 |
63 bool SubmitInputType::supportsRequired() const | 63 bool SubmitInputType::supportsRequired() const |
64 { | 64 { |
65 return false; | 65 return false; |
66 } | 66 } |
67 | 67 |
68 void SubmitInputType::handleDOMActivateEvent(Event* event) | 68 void SubmitInputType::handleDOMActivateEvent(Event* event) |
69 { | 69 { |
70 RefPtr<HTMLInputElement> element = this->element(); | 70 RefPtr<HTMLInputElement> element(this->element()); |
71 if (element->isDisabledFormControl() || !element->form()) | 71 if (element->isDisabledFormControl() || !element->form()) |
72 return; | 72 return; |
73 element->setActivatedSubmit(true); | 73 element->setActivatedSubmit(true); |
74 element->form()->prepareForSubmission(event); // Event handlers can run. | 74 element->form()->prepareForSubmission(event); // Event handlers can run. |
75 element->setActivatedSubmit(false); | 75 element->setActivatedSubmit(false); |
76 event->setDefaultHandled(); | 76 event->setDefaultHandled(); |
77 } | 77 } |
78 | 78 |
79 bool SubmitInputType::canBeSuccessfulSubmitButton() | 79 bool SubmitInputType::canBeSuccessfulSubmitButton() |
80 { | 80 { |
81 return true; | 81 return true; |
82 } | 82 } |
83 | 83 |
84 String SubmitInputType::defaultValue() const | 84 String SubmitInputType::defaultValue() const |
85 { | 85 { |
86 return locale().queryString(WebKit::WebLocalizedString::SubmitButtonDefaultL
abel); | 86 return locale().queryString(WebKit::WebLocalizedString::SubmitButtonDefaultL
abel); |
87 } | 87 } |
88 | 88 |
89 bool SubmitInputType::isSubmitButton() const | 89 bool SubmitInputType::isSubmitButton() const |
90 { | 90 { |
91 return true; | 91 return true; |
92 } | 92 } |
93 | 93 |
94 bool SubmitInputType::isTextButton() const | 94 bool SubmitInputType::isTextButton() const |
95 { | 95 { |
96 return true; | 96 return true; |
97 } | 97 } |
98 | 98 |
99 } // namespace WebCore | 99 } // namespace WebCore |
OLD | NEW |