OSDN Git Service

Merge "Fix text-shadow style when blur is 0px"
[android-x86/external-webkit.git] / WebCore / wml / WMLInputElement.h
1 /**
2  * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  *
19  */
20
21 #ifndef WMLInputElement_h
22 #define WMLInputElement_h
23
24 #if ENABLE(WML)
25 #include "WMLFormControlElement.h"
26 #include "InputElement.h"
27
28 namespace WebCore {
29
30 class FormDataList;
31
32 class WMLInputElement : public WMLFormControlElement, public InputElement {
33 public:
34     static PassRefPtr<WMLInputElement> create(const QualifiedName&, Document*);
35
36     WMLInputElement(const QualifiedName& tagName, Document*);
37     virtual ~WMLInputElement();
38
39     virtual bool isKeyboardFocusable(KeyboardEvent*) const;
40     virtual bool isMouseFocusable() const;
41     virtual void dispatchFocusEvent();
42     virtual void dispatchBlurEvent();
43     virtual void updateFocusAppearance(bool restorePreviousSelection);
44     virtual void aboutToUnload();
45
46     virtual bool shouldUseInputMethod() const { return !m_isPasswordField; }
47     virtual bool isChecked() const { return false; }
48     virtual bool isAutofilled() const { return false; }
49     virtual bool isIndeterminate() const { return false; }
50     virtual bool isTextFormControl() const { return true; }
51     virtual bool isRadioButton() const { return false; }
52     virtual bool isCheckbox() const { return false; }
53     virtual bool isTextField() const { return true; }
54     virtual bool isSearchField() const { return false; }
55     virtual bool isInputTypeHidden() const { return false; }
56     virtual bool isPasswordField() const { return m_isPasswordField; }
57     virtual bool searchEventsShouldBeDispatched() const { return false; }
58
59     virtual int size() const;
60     virtual const AtomicString& formControlType() const;
61     virtual const AtomicString& formControlName() const;
62     virtual const String& suggestedValue() const;
63     virtual String value() const;
64     virtual void setValue(const String&, bool sendChangeEvent = false);
65     virtual void setValueForUser(const String&);
66     virtual void setValueFromRenderer(const String&);
67
68     virtual bool saveFormControlState(String& value) const;
69     virtual void restoreFormControlState(const String&);
70
71     virtual void select();
72     virtual void accessKeyAction(bool sendToAnyElement);
73     virtual void parseMappedAttribute(Attribute*);
74
75     virtual void copyNonAttributeProperties(const Element* source);
76
77     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
78     virtual void detach();
79     virtual bool appendFormData(FormDataList&, bool);
80     virtual void reset();
81
82     virtual void defaultEventHandler(Event*);
83     virtual void cacheSelection(int start, int end);
84
85     virtual bool isAcceptableValue(const String&) const { return true; }
86     virtual String sanitizeValue(const String& proposedValue) const { return constrainValue(proposedValue); }
87
88     virtual void documentDidBecomeActive();
89
90     virtual void willMoveToNewOwnerDocument();
91     virtual void didMoveToNewOwnerDocument();
92
93     bool isConformedToInputMask(const String&);
94     bool isConformedToInputMask(UChar, unsigned, bool isUserInput = true);
95 #if ENABLE(WCSS)
96     virtual InputElementData data() const { return m_data; }
97 #endif
98
99 private:
100     friend class WMLCardElement;
101     void initialize();
102
103     virtual bool supportsMaxLength() const { return true; }
104     String validateInputMask(const String&);
105     unsigned cursorPositionToMaskIndex(unsigned);
106     String constrainValue(const String&) const;
107
108     InputElementData m_data;
109     bool m_isPasswordField;
110     bool m_isEmptyOk;
111     String m_formatMask;
112     unsigned m_numOfCharsAllowedByMask;
113 };
114
115 }
116
117 #endif
118 #endif