| 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 (RenderStyle* style = constUnwrap<HTMLFormControlElement>()->renderStyle(
)) |
| 175 return constUnwrap<HTMLInputElement>()->directionForFormData(); | 176 return style->isLeftToRightDirection() ? WebString::fromUTF8("ltr") : We
bString::fromUTF8("rtl"); |
| 176 if (isHTMLTextAreaElement(*m_private)) | 177 return WebString::fromUTF8("ltr"); |
| 177 return constUnwrap<HTMLTextAreaElement>()->directionForFormData(); | |
| 178 return WebString(); | |
| 179 } | 178 } |
| 180 | 179 |
| 181 bool WebFormControlElement::isActivatedSubmit() const | 180 bool WebFormControlElement::isActivatedSubmit() const |
| 182 { | 181 { |
| 183 return constUnwrap<HTMLFormControlElement>()->isActivatedSubmit(); | 182 return constUnwrap<HTMLFormControlElement>()->isActivatedSubmit(); |
| 184 } | 183 } |
| 185 | 184 |
| 186 WebFormElement WebFormControlElement::form() const | 185 WebFormElement WebFormControlElement::form() const |
| 187 { | 186 { |
| 188 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form()); | 187 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form()); |
| 189 } | 188 } |
| 190 | 189 |
| 191 WebFormControlElement::WebFormControlElement(const PassRefPtrWillBeRawPtr<HTMLFo
rmControlElement>& elem) | 190 WebFormControlElement::WebFormControlElement(const PassRefPtrWillBeRawPtr<HTMLFo
rmControlElement>& elem) |
| 192 : WebElement(elem) | 191 : WebElement(elem) |
| 193 { | 192 { |
| 194 } | 193 } |
| 195 | 194 |
| 196 WebFormControlElement& WebFormControlElement::operator=(const PassRefPtrWillBeRa
wPtr<HTMLFormControlElement>& elem) | 195 WebFormControlElement& WebFormControlElement::operator=(const PassRefPtrWillBeRa
wPtr<HTMLFormControlElement>& elem) |
| 197 { | 196 { |
| 198 m_private = elem; | 197 m_private = elem; |
| 199 return *this; | 198 return *this; |
| 200 } | 199 } |
| 201 | 200 |
| 202 WebFormControlElement::operator PassRefPtrWillBeRawPtr<HTMLFormControlElement>()
const | 201 WebFormControlElement::operator PassRefPtrWillBeRawPtr<HTMLFormControlElement>()
const |
| 203 { | 202 { |
| 204 return toHTMLFormControlElement(m_private.get()); | 203 return toHTMLFormControlElement(m_private.get()); |
| 205 } | 204 } |
| 206 | 205 |
| 207 } // namespace blink | 206 } // namespace blink |
| OLD | NEW |