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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "WebFormElement.h" | 32 #include "WebFormElement.h" |
33 | 33 |
| 34 #include "FormState.h" |
34 #include "HTMLFormControlElement.h" | 35 #include "HTMLFormControlElement.h" |
35 #include "HTMLFormElement.h" | 36 #include "HTMLFormElement.h" |
36 #include "HTMLInputElement.h" | 37 #include "HTMLInputElement.h" |
37 #include "HTMLNames.h" | 38 #include "HTMLNames.h" |
38 #include "WebFormControlElement.h" | 39 #include "WebFormControlElement.h" |
39 #include "WebInputElement.h" | 40 #include "WebInputElement.h" |
40 #include "WebString.h" | 41 #include "WebString.h" |
41 #include "WebURL.h" | 42 #include "WebURL.h" |
42 #include <wtf/PassRefPtr.h> | 43 #include <wtf/PassRefPtr.h> |
43 | 44 |
44 using namespace WebCore; | 45 using namespace WebCore; |
45 | 46 |
46 namespace WebKit { | 47 namespace WebKit { |
47 | 48 |
48 bool WebFormElement::autoComplete() const | 49 bool WebFormElement::autoComplete() const |
49 { | 50 { |
50 return constUnwrap<HTMLFormElement>()->autoComplete(); | 51 return constUnwrap<HTMLFormElement>()->autoComplete(); |
51 } | 52 } |
52 | 53 |
53 WebString WebFormElement::action() const | 54 WebString WebFormElement::action() const |
54 { | 55 { |
55 return constUnwrap<HTMLFormElement>()->action(); | 56 return constUnwrap<HTMLFormElement>()->action(); |
56 } | 57 } |
57 | 58 |
58 WebString WebFormElement::name() const | 59 WebString WebFormElement::name() const |
59 { | 60 { |
60 return constUnwrap<HTMLFormElement>()->name(); | 61 return constUnwrap<HTMLFormElement>()->name(); |
61 } | 62 } |
62 | 63 |
63 WebString WebFormElement::method() const | 64 WebString WebFormElement::method() const |
64 { | 65 { |
65 return constUnwrap<HTMLFormElement>()->method(); | 66 return constUnwrap<HTMLFormElement>()->method(); |
66 } | 67 } |
67 | 68 |
| 69 bool WebFormElement::wasUserSubmitted() const |
| 70 { |
| 71 return constUnwrap<HTMLFormElement>()->submissionTrigger() == NotSubmittedBy
JavaScript; |
| 72 } |
| 73 |
68 void WebFormElement::submit() | 74 void WebFormElement::submit() |
69 { | 75 { |
70 unwrap<HTMLFormElement>()->submit(); | 76 unwrap<HTMLFormElement>()->submit(); |
71 } | 77 } |
72 | 78 |
73 void WebFormElement::getNamedElements(const WebString& name, | 79 void WebFormElement::getNamedElements(const WebString& name, |
74 WebVector<WebNode>& result) | 80 WebVector<WebNode>& result) |
75 { | 81 { |
76 Vector<RefPtr<Node> > tempVector; | 82 Vector<RefPtr<Node> > tempVector; |
77 unwrap<HTMLFormElement>()->getNamedElements(name, tempVector); | 83 unwrap<HTMLFormElement>()->getNamedElements(name, tempVector); |
78 result.assign(tempVector); | 84 result.assign(tempVector); |
79 } | 85 } |
80 | 86 |
81 void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& re
sult) const | 87 void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& re
sult) const |
82 { | 88 { |
83 const HTMLFormElement* form = constUnwrap<HTMLFormElement>(); | 89 const HTMLFormElement* form = constUnwrap<HTMLFormElement>(); |
84 Vector<RefPtr<HTMLFormControlElement> > tempVector; | 90 Vector<RefPtr<HTMLFormControlElement> > tempVector; |
85 // FIXME: We should move the for-loop condition into a variable instead of | 91 // FIXME: We should move the for-loop condition into a variable instead of |
86 // re-evaluating size each time. Also, consider refactoring this code so tha
t | 92 // re-evaluating size each time. Also, consider refactoring this code so tha
t |
87 // we don't call form->associatedElements() multiple times. | 93 // we don't call form->associatedElements() multiple times. |
88 for (size_t i = 0; i < form->associatedElements().size(); i++) { | 94 for (size_t i = 0; i < form->associatedElements().size(); i++) { |
89 if (form->associatedElements()[i]->hasLocalName(HTMLNames::inputTag) | 95 if (form->associatedElements()[i]->hasLocalName(HTMLNames::inputTag) |
90 || form->associatedElements()[i]->hasLocalName(HTMLNames::selectTag)
) | 96 || form->associatedElements()[i]->hasLocalName(HTMLNames::selectTag)
) |
(...skipping 12 matching lines...) Expand all Loading... |
103 m_private = e; | 109 m_private = e; |
104 return *this; | 110 return *this; |
105 } | 111 } |
106 | 112 |
107 WebFormElement::operator PassRefPtr<HTMLFormElement>() const | 113 WebFormElement::operator PassRefPtr<HTMLFormElement>() const |
108 { | 114 { |
109 return static_cast<HTMLFormElement*>(m_private.get()); | 115 return static_cast<HTMLFormElement*>(m_private.get()); |
110 } | 116 } |
111 | 117 |
112 } // namespace WebKit | 118 } // namespace WebKit |
OLD | NEW |