| 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" | |
| 35 #include "HTMLFormControlElement.h" | 34 #include "HTMLFormControlElement.h" |
| 36 #include "HTMLFormElement.h" | 35 #include "HTMLFormElement.h" |
| 37 #include "HTMLInputElement.h" | 36 #include "HTMLInputElement.h" |
| 38 #include "HTMLNames.h" | 37 #include "HTMLNames.h" |
| 39 #include "WebFormControlElement.h" | 38 #include "WebFormControlElement.h" |
| 40 #include "WebInputElement.h" | 39 #include "WebInputElement.h" |
| 41 #include "WebString.h" | 40 #include "WebString.h" |
| 42 #include "WebURL.h" | 41 #include "WebURL.h" |
| 43 #include <wtf/PassRefPtr.h> | 42 #include <wtf/PassRefPtr.h> |
| 44 | 43 |
| 45 using namespace WebCore; | 44 using namespace WebCore; |
| 46 | 45 |
| 47 namespace WebKit { | 46 namespace WebKit { |
| 48 | 47 |
| 49 bool WebFormElement::autoComplete() const | 48 bool WebFormElement::autoComplete() const |
| 50 { | 49 { |
| 51 return constUnwrap<HTMLFormElement>()->autoComplete(); | 50 return constUnwrap<HTMLFormElement>()->autoComplete(); |
| 52 } | 51 } |
| 53 | 52 |
| 54 WebString WebFormElement::action() const | 53 WebString WebFormElement::action() const |
| 55 { | 54 { |
| 56 return constUnwrap<HTMLFormElement>()->action(); | 55 return constUnwrap<HTMLFormElement>()->action(); |
| 57 } | 56 } |
| 58 | 57 |
| 59 WebString WebFormElement::name() const | 58 WebString WebFormElement::name() const |
| 60 { | 59 { |
| 61 return constUnwrap<HTMLFormElement>()->name(); | 60 return constUnwrap<HTMLFormElement>()->name(); |
| 62 } | 61 } |
| 63 | 62 |
| 64 WebString WebFormElement::method() const | 63 WebString WebFormElement::method() const |
| 65 { | 64 { |
| 66 return constUnwrap<HTMLFormElement>()->method(); | 65 return constUnwrap<HTMLFormElement>()->method(); |
| 67 } | 66 } |
| 68 | 67 |
| 69 bool WebFormElement::wasUserSubmitted() const | |
| 70 { | |
| 71 return constUnwrap<HTMLFormElement>()->submissionTrigger() == NotSubmittedBy
JavaScript; | |
| 72 } | |
| 73 | |
| 74 void WebFormElement::submit() | 68 void WebFormElement::submit() |
| 75 { | 69 { |
| 76 unwrap<HTMLFormElement>()->submit(); | 70 unwrap<HTMLFormElement>()->submit(); |
| 77 } | 71 } |
| 78 | 72 |
| 79 void WebFormElement::getNamedElements(const WebString& name, | 73 void WebFormElement::getNamedElements(const WebString& name, |
| 80 WebVector<WebNode>& result) | 74 WebVector<WebNode>& result) |
| 81 { | 75 { |
| 82 Vector<RefPtr<Node> > tempVector; | 76 Vector<RefPtr<Node> > tempVector; |
| 83 unwrap<HTMLFormElement>()->getNamedElements(name, tempVector); | 77 unwrap<HTMLFormElement>()->getNamedElements(name, tempVector); |
| 84 result.assign(tempVector); | 78 result.assign(tempVector); |
| 85 } | 79 } |
| 86 | 80 |
| 87 void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& re
sult) const | 81 void WebFormElement::getFormControlElements(WebVector<WebFormControlElement>& re
sult) const |
| 88 { | 82 { |
| 89 const HTMLFormElement* form = constUnwrap<HTMLFormElement>(); | 83 const HTMLFormElement* form = constUnwrap<HTMLFormElement>(); |
| 90 Vector<RefPtr<HTMLFormControlElement> > tempVector; | 84 Vector<RefPtr<HTMLFormControlElement> > tempVector; |
| 91 // FIXME: We should move the for-loop condition into a variable instead of | 85 // FIXME: We should move the for-loop condition into a variable instead of |
| 92 // re-evaluating size each time. Also, consider refactoring this code so tha
t | 86 // re-evaluating size each time. Also, consider refactoring this code so tha
t |
| 93 // we don't call form->associatedElements() multiple times. | 87 // we don't call form->associatedElements() multiple times. |
| 94 for (size_t i = 0; i < form->associatedElements().size(); i++) { | 88 for (size_t i = 0; i < form->associatedElements().size(); i++) { |
| 95 if (form->associatedElements()[i]->hasLocalName(HTMLNames::inputTag) | 89 if (form->associatedElements()[i]->hasLocalName(HTMLNames::inputTag) |
| 96 || form->associatedElements()[i]->hasLocalName(HTMLNames::selectTag)
) | 90 || form->associatedElements()[i]->hasLocalName(HTMLNames::selectTag)
) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 109 m_private = e; | 103 m_private = e; |
| 110 return *this; | 104 return *this; |
| 111 } | 105 } |
| 112 | 106 |
| 113 WebFormElement::operator PassRefPtr<HTMLFormElement>() const | 107 WebFormElement::operator PassRefPtr<HTMLFormElement>() const |
| 114 { | 108 { |
| 115 return static_cast<HTMLFormElement*>(m_private.get()); | 109 return static_cast<HTMLFormElement*>(m_private.get()); |
| 116 } | 110 } |
| 117 | 111 |
| 118 } // namespace WebKit | 112 } // namespace WebKit |
| OLD | NEW |