| 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 14 matching lines...) Expand all Loading... |
| 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 "public/web/WebInputElement.h" | 32 #include "public/web/WebInputElement.h" |
| 33 | 33 |
| 34 #include "core/HTMLNames.h" | 34 #include "core/HTMLNames.h" |
| 35 #include "core/InputTypeNames.h" |
| 35 #include "core/dom/shadow/ElementShadow.h" | 36 #include "core/dom/shadow/ElementShadow.h" |
| 36 #include "core/dom/shadow/ShadowRoot.h" | 37 #include "core/dom/shadow/ShadowRoot.h" |
| 37 #include "core/html/HTMLDataListElement.h" | 38 #include "core/html/HTMLDataListElement.h" |
| 38 #include "core/html/HTMLDataListOptionsCollection.h" | 39 #include "core/html/HTMLDataListOptionsCollection.h" |
| 39 #include "core/html/HTMLInputElement.h" | 40 #include "core/html/HTMLInputElement.h" |
| 40 #include "core/html/shadow/ShadowElementNames.h" | 41 #include "core/html/shadow/ShadowElementNames.h" |
| 41 #include "core/html/shadow/TextControlInnerElements.h" | 42 #include "core/html/shadow/TextControlInnerElements.h" |
| 42 #include "platform/RuntimeEnabledFeatures.h" | 43 #include "platform/RuntimeEnabledFeatures.h" |
| 43 #include "public/platform/WebString.h" | 44 #include "public/platform/WebString.h" |
| 44 #include "public/web/WebElementCollection.h" | 45 #include "public/web/WebElementCollection.h" |
| 45 #include "wtf/PassRefPtr.h" | 46 #include "wtf/PassRefPtr.h" |
| 46 | 47 |
| 47 namespace blink { | 48 namespace blink { |
| 48 | 49 |
| 49 bool WebInputElement::isTextField() const | 50 bool WebInputElement::isTextField() const |
| 50 { | 51 { |
| 51 return constUnwrap<HTMLInputElement>()->isTextField(); | 52 return constUnwrap<HTMLInputElement>()->isTextField(); |
| 52 } | 53 } |
| 53 | 54 |
| 54 bool WebInputElement::isText() const | 55 bool WebInputElement::isText() const |
| 55 { | 56 { |
| 56 return constUnwrap<HTMLInputElement>()->isText(); | 57 return constUnwrap<HTMLInputElement>()->isText(); |
| 57 } | 58 } |
| 58 | 59 |
| 59 bool WebInputElement::isEmailField() const | 60 bool WebInputElement::isEmailField() const |
| 60 { | 61 { |
| 61 return constUnwrap<HTMLInputElement>()->isEmailField(); | 62 return constUnwrap<HTMLInputElement>()->type() == InputTypeNames::email; |
| 62 } | 63 } |
| 63 | 64 |
| 64 bool WebInputElement::isPasswordField() const | 65 bool WebInputElement::isPasswordField() const |
| 65 { | 66 { |
| 66 return constUnwrap<HTMLInputElement>()->isPasswordField(); | 67 return constUnwrap<HTMLInputElement>()->type() == InputTypeNames::password; |
| 67 } | 68 } |
| 68 | 69 |
| 69 bool WebInputElement::isImageButton() const | 70 bool WebInputElement::isImageButton() const |
| 70 { | 71 { |
| 71 return constUnwrap<HTMLInputElement>()->isImageButton(); | 72 return constUnwrap<HTMLInputElement>()->type() == InputTypeNames::image; |
| 72 } | 73 } |
| 73 | 74 |
| 74 bool WebInputElement::isRadioButton() const | 75 bool WebInputElement::isRadioButton() const |
| 75 { | 76 { |
| 76 return constUnwrap<HTMLInputElement>()->isRadioButton(); | 77 return constUnwrap<HTMLInputElement>()->type() == InputTypeNames::radio; |
| 77 } | 78 } |
| 78 | 79 |
| 79 bool WebInputElement::isCheckbox() const | 80 bool WebInputElement::isCheckbox() const |
| 80 { | 81 { |
| 81 return constUnwrap<HTMLInputElement>()->isCheckbox(); | 82 return constUnwrap<HTMLInputElement>()->type() == InputTypeNames::checkbox; |
| 82 } | 83 } |
| 83 | 84 |
| 84 int WebInputElement::maxLength() const | 85 int WebInputElement::maxLength() const |
| 85 { | 86 { |
| 86 return constUnwrap<HTMLInputElement>()->maxLength(); | 87 return constUnwrap<HTMLInputElement>()->maxLength(); |
| 87 } | 88 } |
| 88 | 89 |
| 89 void WebInputElement::setActivatedSubmit(bool activated) | 90 void WebInputElement::setActivatedSubmit(bool activated) |
| 90 { | 91 { |
| 91 unwrap<HTMLInputElement>()->setActivatedSubmit(activated); | 92 unwrap<HTMLInputElement>()->setActivatedSubmit(activated); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 161 } |
| 161 | 162 |
| 162 WebInputElement* toWebInputElement(WebElement* webElement) | 163 WebInputElement* toWebInputElement(WebElement* webElement) |
| 163 { | 164 { |
| 164 if (!isHTMLInputElement(*webElement->unwrap<Element>())) | 165 if (!isHTMLInputElement(*webElement->unwrap<Element>())) |
| 165 return 0; | 166 return 0; |
| 166 | 167 |
| 167 return static_cast<WebInputElement*>(webElement); | 168 return static_cast<WebInputElement*>(webElement); |
| 168 } | 169 } |
| 169 } // namespace blink | 170 } // namespace blink |
| OLD | NEW |