Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: Source/web/WebFormControlElement.cpp

Issue 133443011: Add text field change handling for autofill preview in textarea element. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update documentation as per tkent's review comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/web/ChromeClientImpl.cpp ('k') | Source/web/WebInputElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 if (m_private->hasTagName(HTMLNames::textareaTag))
90 return constUnwrap<HTMLTextAreaElement>()->innerTextValue();
91 return WebString();
92 }
93
94 int WebFormControlElement::selectionStart() const
95 {
96 if (m_private->hasTagName(HTMLNames::inputTag))
97 return constUnwrap<HTMLInputElement>()->selectionStart();
98 if (m_private->hasTagName(HTMLNames::textareaTag))
99 return constUnwrap<HTMLTextAreaElement>()->selectionStart();
100 return 0;
101 }
102
103 int WebFormControlElement::selectionEnd() const
104 {
105 if (m_private->hasTagName(HTMLNames::inputTag))
106 return constUnwrap<HTMLInputElement>()->selectionEnd();
107 if (m_private->hasTagName(HTMLNames::textareaTag))
108 return constUnwrap<HTMLTextAreaElement>()->selectionEnd();
109 return 0;
110 }
111
82 WebFormElement WebFormControlElement::form() const 112 WebFormElement WebFormControlElement::form() const
83 { 113 {
84 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form()); 114 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form());
85 } 115 }
86 116
87 WebFormControlElement::WebFormControlElement(const PassRefPtr<HTMLFormControlEle ment>& elem) 117 WebFormControlElement::WebFormControlElement(const PassRefPtr<HTMLFormControlEle ment>& elem)
88 : WebElement(elem) 118 : WebElement(elem)
89 { 119 {
90 } 120 }
91 121
92 WebFormControlElement& WebFormControlElement::operator=(const PassRefPtr<HTMLFor mControlElement>& elem) 122 WebFormControlElement& WebFormControlElement::operator=(const PassRefPtr<HTMLFor mControlElement>& elem)
93 { 123 {
94 m_private = elem; 124 m_private = elem;
95 return *this; 125 return *this;
96 } 126 }
97 127
98 WebFormControlElement::operator PassRefPtr<HTMLFormControlElement>() const 128 WebFormControlElement::operator PassRefPtr<HTMLFormControlElement>() const
99 { 129 {
100 return toHTMLFormControlElement(m_private.get()); 130 return toHTMLFormControlElement(m_private.get());
101 } 131 }
102 132
103 } // namespace blink 133 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/ChromeClientImpl.cpp ('k') | Source/web/WebInputElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698