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 21 matching lines...) Expand all Loading... |
32 #define WebFormControlElement_h | 32 #define WebFormControlElement_h |
33 | 33 |
34 #include "../platform/WebString.h" | 34 #include "../platform/WebString.h" |
35 #include "WebElement.h" | 35 #include "WebElement.h" |
36 #include "WebFormElement.h" | 36 #include "WebFormElement.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class HTMLFormControlElement; | 40 class HTMLFormControlElement; |
41 | 41 |
42 // Provides readonly access to some properties of a DOM form control element nod
e. | 42 // Provides readonly access to some properties of a DOM form control element |
| 43 // node. |
43 class WebFormControlElement : public WebElement { | 44 class WebFormControlElement : public WebElement { |
44 public: | 45 public: |
45 WebFormControlElement() : WebElement() {} | 46 WebFormControlElement() : WebElement() {} |
46 WebFormControlElement(const WebFormControlElement& e) : WebElement(e) {} | 47 WebFormControlElement(const WebFormControlElement& e) : WebElement(e) {} |
47 | 48 |
48 WebFormControlElement& operator=(const WebFormControlElement& e) { | 49 WebFormControlElement& operator=(const WebFormControlElement& e) { |
49 WebElement::assign(e); | 50 WebElement::assign(e); |
50 return *this; | 51 return *this; |
51 } | 52 } |
52 void assign(const WebFormControlElement& e) { WebElement::assign(e); } | 53 void assign(const WebFormControlElement& e) { WebElement::assign(e); } |
53 | 54 |
54 BLINK_EXPORT bool isEnabled() const; | 55 BLINK_EXPORT bool isEnabled() const; |
55 BLINK_EXPORT bool isReadOnly() const; | 56 BLINK_EXPORT bool isReadOnly() const; |
56 BLINK_EXPORT WebString formControlName() const; | 57 BLINK_EXPORT WebString formControlName() const; |
57 BLINK_EXPORT WebString formControlType() const; | 58 BLINK_EXPORT WebString formControlType() const; |
58 | 59 |
59 BLINK_EXPORT bool isAutofilled() const; | 60 BLINK_EXPORT bool isAutofilled() const; |
60 BLINK_EXPORT void setAutofilled(bool); | 61 BLINK_EXPORT void setAutofilled(bool); |
61 | 62 |
62 // Returns true if autocomplete attribute of the element is not set as "off". | 63 // Returns true if autocomplete attribute of the element is not set as "off". |
63 BLINK_EXPORT bool autoComplete() const; | 64 BLINK_EXPORT bool autoComplete() const; |
64 | 65 |
65 // Sets value for input element, textarea element and select element. For sele
ct | 66 // Sets value for input element, textarea element and select element. For |
66 // element it finds the option with value matches the given parameter and make
the | 67 // select element it finds the option with value matches the given parameter |
67 // option as the current selection. | 68 // and make the option as the current selection. |
68 BLINK_EXPORT void setValue(const WebString&, bool sendEvents = false); | 69 BLINK_EXPORT void setValue(const WebString&, bool sendEvents = false); |
69 // Sets the autofilled value for input element, textarea element and select | 70 // Sets the autofilled value for input element, textarea element and select |
70 // element and sends a sequence of events to the element. | 71 // element and sends a sequence of events to the element. |
71 BLINK_EXPORT void setAutofillValue(const WebString&); | 72 BLINK_EXPORT void setAutofillValue(const WebString&); |
72 // Returns value of element. For select element, it returns the value of | 73 // Returns value of element. For select element, it returns the value of |
73 // the selected option if present. If no selected option, an empty string | 74 // the selected option if present. If no selected option, an empty string |
74 // is returned. If element doesn't fall into input element, textarea element | 75 // is returned. If element doesn't fall into input element, textarea element |
75 // and select element categories, a null string is returned. | 76 // and select element categories, a null string is returned. |
76 BLINK_EXPORT WebString value() const; | 77 BLINK_EXPORT WebString value() const; |
77 // Sets suggested value for element. For select element it finds the option | 78 // Sets suggested value for element. For select element it finds the option |
78 // with value matches the given parameter and make the option as the suggested | 79 // with value matches the given parameter and make the option as the suggested |
79 // selection. The goal of introducing suggested value is to not leak any infor
mation | 80 // selection. The goal of introducing suggested value is to not leak any |
80 // to JavaScript. | 81 // information to JavaScript. |
81 BLINK_EXPORT void setSuggestedValue(const WebString&); | 82 BLINK_EXPORT void setSuggestedValue(const WebString&); |
82 // Returns suggested value of element. If element doesn't fall into input elem
ent, | 83 // Returns suggested value of element. If element doesn't fall into input |
83 // textarea element and select element categories, a null string is returned. | 84 // element, textarea element and select element categories, a null string is |
| 85 // returned. |
84 BLINK_EXPORT WebString suggestedValue() const; | 86 BLINK_EXPORT WebString suggestedValue() const; |
85 | 87 |
86 // Returns the non-sanitized, exact value inside the text input field | 88 // Returns the non-sanitized, exact value inside the text input field |
87 // or insisde the textarea. If neither input element nor textarea element, | 89 // or insisde the textarea. If neither input element nor textarea element, |
88 // a null string is returned. | 90 // a null string is returned. |
89 BLINK_EXPORT WebString editingValue() const; | 91 BLINK_EXPORT WebString editingValue() const; |
90 | 92 |
91 // Sets character selection range. | 93 // Sets character selection range. |
92 BLINK_EXPORT void setSelectionRange(int start, int end); | 94 BLINK_EXPORT void setSelectionRange(int start, int end); |
93 // Returned value represents a cursor/caret position at the current | 95 // Returned value represents a cursor/caret position at the current |
94 // selection's start for text input field or textarea. If neither input | 96 // selection's start for text input field or textarea. If neither input |
95 // element nor textarea element, 0 is returned. | 97 // element nor textarea element, 0 is returned. |
96 BLINK_EXPORT int selectionStart() const; | 98 BLINK_EXPORT int selectionStart() const; |
97 // Returned value represents a cursor/caret position at the current | 99 // Returned value represents a cursor/caret position at the current |
98 // selection's end for text input field or textarea. If neither input | 100 // selection's end for text input field or textarea. If neither input |
99 // element nor textarea element, 0 is returned. | 101 // element nor textarea element, 0 is returned. |
100 BLINK_EXPORT int selectionEnd() const; | 102 BLINK_EXPORT int selectionEnd() const; |
101 | 103 |
102 // Returns text-align(only left and right are supported. see crbug.com/482339)
of text of element. | 104 // Returns text-align(only left and right are supported. see crbug.com/482339) |
| 105 // of text of element. |
103 BLINK_EXPORT WebString alignmentForFormData() const; | 106 BLINK_EXPORT WebString alignmentForFormData() const; |
104 | 107 |
105 // Returns direction of text of element. | 108 // Returns direction of text of element. |
106 BLINK_EXPORT WebString directionForFormData() const; | 109 BLINK_EXPORT WebString directionForFormData() const; |
107 | 110 |
108 // Returns the name that should be used for the specified |element| when | 111 // Returns the name that should be used for the specified |element| when |
109 // storing autofill data. This is either the field name or its id, an empty | 112 // storing autofill data. This is either the field name or its id, an empty |
110 // string if it has no name and no id. | 113 // string if it has no name and no id. |
111 BLINK_EXPORT WebString nameForAutofill() const; | 114 BLINK_EXPORT WebString nameForAutofill() const; |
112 | 115 |
113 BLINK_EXPORT WebFormElement form() const; | 116 BLINK_EXPORT WebFormElement form() const; |
114 | 117 |
115 #if BLINK_IMPLEMENTATION | 118 #if BLINK_IMPLEMENTATION |
116 WebFormControlElement(HTMLFormControlElement*); | 119 WebFormControlElement(HTMLFormControlElement*); |
117 WebFormControlElement& operator=(HTMLFormControlElement*); | 120 WebFormControlElement& operator=(HTMLFormControlElement*); |
118 operator HTMLFormControlElement*() const; | 121 operator HTMLFormControlElement*() const; |
119 #endif | 122 #endif |
120 }; | 123 }; |
121 | 124 |
122 DECLARE_WEB_NODE_TYPE_CASTS(WebFormControlElement); | 125 DECLARE_WEB_NODE_TYPE_CASTS(WebFormControlElement); |
123 | 126 |
124 } // namespace blink | 127 } // namespace blink |
125 | 128 |
126 #endif | 129 #endif |
OLD | NEW |