OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 15 matching lines...) Expand all Loading... | |
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 "WebFormControlElement.h" | 32 #include "WebFormControlElement.h" |
33 | 33 |
34 #include "core/html/HTMLFormControlElement.h" | 34 #include "core/html/HTMLFormControlElement.h" |
35 #include "core/html/HTMLFormElement.h" | 35 #include "core/html/HTMLFormElement.h" |
36 #include "core/html/HTMLInputElement.h" | |
37 #include "core/html/HTMLTextAreaElement.h" | |
38 | |
36 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
37 | 40 |
38 using namespace WebCore; | 41 using namespace WebCore; |
39 | 42 |
40 namespace blink { | 43 namespace blink { |
41 | 44 |
42 bool WebFormControlElement::isEnabled() const | 45 bool WebFormControlElement::isEnabled() const |
43 { | 46 { |
44 return !constUnwrap<HTMLFormControlElement>()->isDisabledFormControl(); | 47 return !constUnwrap<HTMLFormControlElement>()->isDisabledFormControl(); |
45 } | 48 } |
(...skipping 26 matching lines...) Expand all Loading... | |
72 void WebFormControlElement::setAutofilled(bool autofilled) | 75 void WebFormControlElement::setAutofilled(bool autofilled) |
73 { | 76 { |
74 unwrap<HTMLFormControlElement>()->setAutofilled(autofilled); | 77 unwrap<HTMLFormControlElement>()->setAutofilled(autofilled); |
75 } | 78 } |
76 | 79 |
77 WebString WebFormControlElement::nameForAutofill() const | 80 WebString WebFormControlElement::nameForAutofill() const |
78 { | 81 { |
79 return constUnwrap<HTMLFormControlElement>()->nameForAutofill(); | 82 return constUnwrap<HTMLFormControlElement>()->nameForAutofill(); |
80 } | 83 } |
81 | 84 |
85 WebString WebFormControlElement::editingValue() const | |
86 { | |
87 if (m_private->hasTagName(HTMLNames::inputTag)) | |
88 return constUnwrap<HTMLInputElement>()->innerTextValue(); | |
89 return constUnwrap<HTMLTextAreaElement>()->innerTextValue(); | |
tkent
2014/03/04 00:15:56
Need to check hasTagName(textareaTag) too.
ziran.sun
2014/03/04 12:12:40
Done.
| |
90 } | |
91 | |
92 int WebFormControlElement::selectionStart() const | |
93 { | |
94 if (m_private->hasTagName(HTMLNames::inputTag)) | |
95 return constUnwrap<HTMLInputElement>()->selectionStart(); | |
96 return constUnwrap<HTMLTextAreaElement>()->selectionStart(); | |
tkent
2014/03/04 00:15:56
ditto.
ziran.sun
2014/03/04 12:12:40
Done.
| |
97 } | |
98 | |
99 int WebFormControlElement::selectionEnd() const | |
100 { | |
101 if (m_private->hasTagName(HTMLNames::inputTag)) | |
102 return constUnwrap<HTMLInputElement>()->selectionEnd(); | |
103 return constUnwrap<HTMLTextAreaElement>()->selectionEnd(); | |
tkent
2014/03/04 00:15:56
ditto.
ziran.sun
2014/03/04 12:12:40
Done.
| |
104 } | |
105 | |
82 WebFormElement WebFormControlElement::form() const | 106 WebFormElement WebFormControlElement::form() const |
83 { | 107 { |
84 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form()); | 108 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form()); |
85 } | 109 } |
86 | 110 |
87 WebFormControlElement::WebFormControlElement(const PassRefPtr<HTMLFormControlEle ment>& elem) | 111 WebFormControlElement::WebFormControlElement(const PassRefPtr<HTMLFormControlEle ment>& elem) |
88 : WebElement(elem) | 112 : WebElement(elem) |
89 { | 113 { |
90 } | 114 } |
91 | 115 |
92 WebFormControlElement& WebFormControlElement::operator=(const PassRefPtr<HTMLFor mControlElement>& elem) | 116 WebFormControlElement& WebFormControlElement::operator=(const PassRefPtr<HTMLFor mControlElement>& elem) |
93 { | 117 { |
94 m_private = elem; | 118 m_private = elem; |
95 return *this; | 119 return *this; |
96 } | 120 } |
97 | 121 |
98 WebFormControlElement::operator PassRefPtr<HTMLFormControlElement>() const | 122 WebFormControlElement::operator PassRefPtr<HTMLFormControlElement>() const |
99 { | 123 { |
100 return toHTMLFormControlElement(m_private.get()); | 124 return toHTMLFormControlElement(m_private.get()); |
101 } | 125 } |
102 | 126 |
103 } // namespace blink | 127 } // namespace blink |
OLD | NEW |