WebKit/chromium/src/WebInputElement.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 /*
       
     2  * Copyright (C) 2009 Google Inc. All rights reserved.
       
     3  *
       
     4  * Redistribution and use in source and binary forms, with or without
       
     5  * modification, are permitted provided that the following conditions are
       
     6  * met:
       
     7  *
       
     8  *     * Redistributions of source code must retain the above copyright
       
     9  * notice, this list of conditions and the following disclaimer.
       
    10  *     * Redistributions in binary form must reproduce the above
       
    11  * copyright notice, this list of conditions and the following disclaimer
       
    12  * in the documentation and/or other materials provided with the
       
    13  * distribution.
       
    14  *     * Neither the name of Google Inc. nor the names of its
       
    15  * contributors may be used to endorse or promote products derived from
       
    16  * this software without specific prior written permission.
       
    17  *
       
    18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
       
    19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
       
    20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
       
    21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
       
    22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
       
    23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
       
    24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
       
    25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
       
    26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       
    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.
       
    29  */
       
    30 
       
    31 #include "config.h"
       
    32 #include "WebInputElement.h"
       
    33 
       
    34 #include "HTMLInputElement.h"
       
    35 #include "HTMLNames.h"
       
    36 #include "WebString.h"
       
    37 #include <wtf/PassRefPtr.h>
       
    38 
       
    39 using namespace WebCore;
       
    40 
       
    41 namespace WebKit {
       
    42 
       
    43 bool WebInputElement::autoComplete() const
       
    44 {
       
    45     return constUnwrap<HTMLInputElement>()->autoComplete();
       
    46 }
       
    47 
       
    48 bool WebInputElement::isReadOnly() const
       
    49 {
       
    50     return constUnwrap<HTMLInputElement>()->readOnly();
       
    51 }
       
    52 
       
    53 bool WebInputElement::isEnabledFormControl() const
       
    54 {
       
    55     return constUnwrap<HTMLInputElement>()->isEnabledFormControl();
       
    56 }
       
    57 
       
    58 WebInputElement::InputType WebInputElement::inputType() const
       
    59 {
       
    60     return static_cast<InputType>(constUnwrap<HTMLInputElement>()->inputType());
       
    61 }
       
    62 
       
    63 int WebInputElement::maxLength() const
       
    64 {
       
    65     return constUnwrap<HTMLInputElement>()->maxLength();
       
    66 }
       
    67 
       
    68 bool WebInputElement::isActivatedSubmit() const
       
    69 {
       
    70     return constUnwrap<HTMLInputElement>()->isActivatedSubmit();
       
    71 }
       
    72 
       
    73 void WebInputElement::setActivatedSubmit(bool activated)
       
    74 {
       
    75     unwrap<HTMLInputElement>()->setActivatedSubmit(activated);
       
    76 }
       
    77 
       
    78 int WebInputElement::size() const
       
    79 {
       
    80     return constUnwrap<HTMLInputElement>()->size();
       
    81 }
       
    82 
       
    83 void WebInputElement::setValue(const WebString& value)
       
    84 {
       
    85     unwrap<HTMLInputElement>()->setValue(value);
       
    86 }
       
    87 
       
    88 WebString WebInputElement::value() const
       
    89 {
       
    90     return constUnwrap<HTMLInputElement>()->value();
       
    91 }
       
    92 
       
    93 void WebInputElement::setSuggestedValue(const WebString& value)
       
    94 {
       
    95     unwrap<HTMLInputElement>()->setSuggestedValue(value);
       
    96 }
       
    97 
       
    98 WebString WebInputElement::suggestedValue() const
       
    99 {
       
   100     return constUnwrap<HTMLInputElement>()->suggestedValue();
       
   101 }
       
   102 
       
   103 void WebInputElement::setPlaceholder(const WebString& value)
       
   104 {
       
   105     unwrap<HTMLInputElement>()->setPlaceholder(value);
       
   106 }
       
   107 
       
   108 WebString WebInputElement::placeholder() const
       
   109 {
       
   110     return constUnwrap<HTMLInputElement>()->placeholder();
       
   111 }
       
   112 
       
   113 bool WebInputElement::isAutofilled() const
       
   114 {
       
   115     return constUnwrap<HTMLInputElement>()->isAutofilled();
       
   116 }
       
   117 
       
   118 void WebInputElement::setAutofilled(bool autoFilled)
       
   119 {
       
   120     unwrap<HTMLInputElement>()->setAutofilled(autoFilled);
       
   121 }
       
   122 
       
   123 void WebInputElement::dispatchFormControlChangeEvent()
       
   124 {
       
   125     unwrap<HTMLInputElement>()->dispatchFormControlChangeEvent();
       
   126 }
       
   127 
       
   128 void WebInputElement::setSelectionRange(int start, int end)
       
   129 {
       
   130     unwrap<HTMLInputElement>()->setSelectionRange(start, end);
       
   131 }
       
   132 
       
   133 int WebInputElement::selectionStart()
       
   134 {
       
   135     return unwrap<HTMLInputElement>()->selectionStart();
       
   136 }
       
   137 
       
   138 int WebInputElement::selectionEnd()
       
   139 {
       
   140     return unwrap<HTMLInputElement>()->selectionEnd();
       
   141 }
       
   142 
       
   143 WebInputElement::WebInputElement(const PassRefPtr<HTMLInputElement>& elem)
       
   144     : WebFormControlElement(elem)
       
   145 {
       
   146 }
       
   147 
       
   148 WebInputElement& WebInputElement::operator=(const PassRefPtr<HTMLInputElement>& elem)
       
   149 {
       
   150     m_private = elem;
       
   151     return *this;
       
   152 }
       
   153 
       
   154 WebInputElement::operator PassRefPtr<HTMLInputElement>() const
       
   155 {
       
   156     return static_cast<HTMLInputElement*>(m_private.get());
       
   157 }
       
   158 
       
   159 } // namespace WebKit