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 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 "public/web/WebFormControlElement.h" | 32 #include "public/web/WebFormControlElement.h" |
33 | 33 |
34 #include "core/dom/NodeRenderStyle.h" | |
34 #include "core/html/HTMLFormControlElement.h" | 35 #include "core/html/HTMLFormControlElement.h" |
35 #include "core/html/HTMLFormElement.h" | 36 #include "core/html/HTMLFormElement.h" |
36 #include "core/html/HTMLInputElement.h" | 37 #include "core/html/HTMLInputElement.h" |
37 #include "core/html/HTMLSelectElement.h" | 38 #include "core/html/HTMLSelectElement.h" |
38 #include "core/html/HTMLTextAreaElement.h" | 39 #include "core/html/HTMLTextAreaElement.h" |
39 | 40 |
40 #include "wtf/PassRefPtr.h" | 41 #include "wtf/PassRefPtr.h" |
41 | 42 |
42 using namespace blink; | 43 using namespace blink; |
43 | 44 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 { | 165 { |
165 if (isHTMLInputElement(*m_private)) | 166 if (isHTMLInputElement(*m_private)) |
166 return constUnwrap<HTMLInputElement>()->selectionEnd(); | 167 return constUnwrap<HTMLInputElement>()->selectionEnd(); |
167 if (isHTMLTextAreaElement(*m_private)) | 168 if (isHTMLTextAreaElement(*m_private)) |
168 return constUnwrap<HTMLTextAreaElement>()->selectionEnd(); | 169 return constUnwrap<HTMLTextAreaElement>()->selectionEnd(); |
169 return 0; | 170 return 0; |
170 } | 171 } |
171 | 172 |
172 WebString WebFormControlElement::directionForFormData() const | 173 WebString WebFormControlElement::directionForFormData() const |
173 { | 174 { |
174 if (isHTMLInputElement(*m_private)) | 175 if (isHTMLInputElement(*m_private)) { |
Sunil Ratnu
2014/08/07 07:06:18
Can we have it like this as well?
if (RenderStyle
tkent
2014/08/07 07:13:46
No. It doesn't work if m_private is not HTMLTextF
| |
175 return constUnwrap<HTMLInputElement>()->directionForFormData(); | 176 if (RenderStyle* style = constUnwrap<HTMLInputElement>()->renderStyle()) |
176 if (isHTMLTextAreaElement(*m_private)) | 177 return style->isLeftToRightDirection() ? "ltr" : "rtl"; |
177 return constUnwrap<HTMLTextAreaElement>()->directionForFormData(); | 178 } |
178 return WebString(); | 179 if (isHTMLTextAreaElement(*m_private)) { |
180 if (RenderStyle* style = constUnwrap<HTMLTextAreaElement>()->renderStyle ()) | |
181 return style->isLeftToRightDirection() ? "ltr" : "rtl"; | |
182 } | |
183 return "ltr"; | |
179 } | 184 } |
180 | 185 |
181 bool WebFormControlElement::isActivatedSubmit() const | 186 bool WebFormControlElement::isActivatedSubmit() const |
182 { | 187 { |
183 return constUnwrap<HTMLFormControlElement>()->isActivatedSubmit(); | 188 return constUnwrap<HTMLFormControlElement>()->isActivatedSubmit(); |
184 } | 189 } |
185 | 190 |
186 WebFormElement WebFormControlElement::form() const | 191 WebFormElement WebFormControlElement::form() const |
187 { | 192 { |
188 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form()); | 193 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form()); |
189 } | 194 } |
190 | 195 |
191 WebFormControlElement::WebFormControlElement(const PassRefPtrWillBeRawPtr<HTMLFo rmControlElement>& elem) | 196 WebFormControlElement::WebFormControlElement(const PassRefPtrWillBeRawPtr<HTMLFo rmControlElement>& elem) |
192 : WebElement(elem) | 197 : WebElement(elem) |
193 { | 198 { |
194 } | 199 } |
195 | 200 |
196 WebFormControlElement& WebFormControlElement::operator=(const PassRefPtrWillBeRa wPtr<HTMLFormControlElement>& elem) | 201 WebFormControlElement& WebFormControlElement::operator=(const PassRefPtrWillBeRa wPtr<HTMLFormControlElement>& elem) |
197 { | 202 { |
198 m_private = elem; | 203 m_private = elem; |
199 return *this; | 204 return *this; |
200 } | 205 } |
201 | 206 |
202 WebFormControlElement::operator PassRefPtrWillBeRawPtr<HTMLFormControlElement>() const | 207 WebFormControlElement::operator PassRefPtrWillBeRawPtr<HTMLFormControlElement>() const |
203 { | 208 { |
204 return toHTMLFormControlElement(m_private.get()); | 209 return toHTMLFormControlElement(m_private.get()); |
205 } | 210 } |
206 | 211 |
207 } // namespace blink | 212 } // namespace blink |
OLD | NEW |