OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 13 matching lines...) Expand all Loading... |
24 #ifndef HTMLTextAreaElement_h | 24 #ifndef HTMLTextAreaElement_h |
25 #define HTMLTextAreaElement_h | 25 #define HTMLTextAreaElement_h |
26 | 26 |
27 #include "core/html/HTMLTextFormControlElement.h" | 27 #include "core/html/HTMLTextFormControlElement.h" |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 | 30 |
31 class BeforeTextInsertedEvent; | 31 class BeforeTextInsertedEvent; |
32 class ExceptionState; | 32 class ExceptionState; |
33 | 33 |
34 class HTMLTextAreaElement FINAL : public HTMLTextFormControlElement { | 34 class HTMLTextAreaElement final : public HTMLTextFormControlElement { |
35 DEFINE_WRAPPERTYPEINFO(); | 35 DEFINE_WRAPPERTYPEINFO(); |
36 public: | 36 public: |
37 static PassRefPtrWillBeRawPtr<HTMLTextAreaElement> create(Document&, HTMLFor
mElement*); | 37 static PassRefPtrWillBeRawPtr<HTMLTextAreaElement> create(Document&, HTMLFor
mElement*); |
38 | 38 |
39 int cols() const { return m_cols; } | 39 int cols() const { return m_cols; } |
40 int rows() const { return m_rows; } | 40 int rows() const { return m_rows; } |
41 | 41 |
42 bool shouldWrapText() const { return m_wrap != NoWrap; } | 42 bool shouldWrapText() const { return m_wrap != NoWrap; } |
43 | 43 |
44 virtual String value() const OVERRIDE; | 44 virtual String value() const override; |
45 void setValue(const String&, TextFieldEventBehavior = DispatchNoEvent); | 45 void setValue(const String&, TextFieldEventBehavior = DispatchNoEvent); |
46 String defaultValue() const; | 46 String defaultValue() const; |
47 void setDefaultValue(const String&); | 47 void setDefaultValue(const String&); |
48 int textLength() const { return value().length(); } | 48 int textLength() const { return value().length(); } |
49 int maxLength() const; | 49 int maxLength() const; |
50 void setMaxLength(int, ExceptionState&); | 50 void setMaxLength(int, ExceptionState&); |
51 | 51 |
52 String suggestedValue() const; | 52 String suggestedValue() const; |
53 void setSuggestedValue(const String&); | 53 void setSuggestedValue(const String&); |
54 | 54 |
55 // For ValidityState | 55 // For ValidityState |
56 virtual String validationMessage() const OVERRIDE; | 56 virtual String validationMessage() const override; |
57 virtual bool valueMissing() const OVERRIDE; | 57 virtual bool valueMissing() const override; |
58 virtual bool tooLong() const OVERRIDE; | 58 virtual bool tooLong() const override; |
59 bool isValidValue(const String&) const; | 59 bool isValidValue(const String&) const; |
60 | 60 |
61 void setCols(int); | 61 void setCols(int); |
62 void setRows(int); | 62 void setRows(int); |
63 | 63 |
64 private: | 64 private: |
65 HTMLTextAreaElement(Document&, HTMLFormElement*); | 65 HTMLTextAreaElement(Document&, HTMLFormElement*); |
66 | 66 |
67 enum WrapMethod { NoWrap, SoftWrap, HardWrap }; | 67 enum WrapMethod { NoWrap, SoftWrap, HardWrap }; |
68 | 68 |
69 virtual void didAddUserAgentShadowRoot(ShadowRoot&) OVERRIDE; | 69 virtual void didAddUserAgentShadowRoot(ShadowRoot&) override; |
70 // FIXME: Author shadows should be allowed | 70 // FIXME: Author shadows should be allowed |
71 // https://bugs.webkit.org/show_bug.cgi?id=92608 | 71 // https://bugs.webkit.org/show_bug.cgi?id=92608 |
72 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } | 72 virtual bool areAuthorShadowsAllowed() const override { return false; } |
73 | 73 |
74 void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) const; | 74 void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) const; |
75 static String sanitizeUserInputValue(const String&, unsigned maxLength); | 75 static String sanitizeUserInputValue(const String&, unsigned maxLength); |
76 void updateValue() const; | 76 void updateValue() const; |
77 virtual void setInnerEditorValue(const String&) OVERRIDE; | 77 virtual void setInnerEditorValue(const String&) override; |
78 void setNonDirtyValue(const String&); | 78 void setNonDirtyValue(const String&); |
79 void setValueCommon(const String&, TextFieldEventBehavior, SelectionOption =
NotChangeSelection); | 79 void setValueCommon(const String&, TextFieldEventBehavior, SelectionOption =
NotChangeSelection); |
80 | 80 |
81 virtual bool supportsPlaceholder() const OVERRIDE { return true; } | 81 virtual bool supportsPlaceholder() const override { return true; } |
82 virtual void updatePlaceholderText() OVERRIDE; | 82 virtual void updatePlaceholderText() override; |
83 virtual bool isEmptyValue() const OVERRIDE { return value().isEmpty(); } | 83 virtual bool isEmptyValue() const override { return value().isEmpty(); } |
84 virtual bool isEmptySuggestedValue() const OVERRIDE FINAL { return suggested
Value().isEmpty(); } | 84 virtual bool isEmptySuggestedValue() const override final { return suggested
Value().isEmpty(); } |
85 | 85 |
86 virtual bool isOptionalFormControl() const OVERRIDE { return !isRequiredForm
Control(); } | 86 virtual bool isOptionalFormControl() const override { return !isRequiredForm
Control(); } |
87 virtual bool isRequiredFormControl() const OVERRIDE { return isRequired(); } | 87 virtual bool isRequiredFormControl() const override { return isRequired(); } |
88 | 88 |
89 virtual void defaultEventHandler(Event*) OVERRIDE; | 89 virtual void defaultEventHandler(Event*) override; |
90 virtual void handleFocusEvent(Element* oldFocusedNode, FocusType) OVERRIDE; | 90 virtual void handleFocusEvent(Element* oldFocusedNode, FocusType) override; |
91 | 91 |
92 virtual void subtreeHasChanged() OVERRIDE; | 92 virtual void subtreeHasChanged() override; |
93 | 93 |
94 virtual bool isEnumeratable() const OVERRIDE { return true; } | 94 virtual bool isEnumeratable() const override { return true; } |
95 virtual bool isInteractiveContent() const OVERRIDE; | 95 virtual bool isInteractiveContent() const override; |
96 virtual bool supportsAutofocus() const OVERRIDE; | 96 virtual bool supportsAutofocus() const override; |
97 virtual bool supportLabels() const OVERRIDE { return true; } | 97 virtual bool supportLabels() const override { return true; } |
98 | 98 |
99 virtual const AtomicString& formControlType() const OVERRIDE; | 99 virtual const AtomicString& formControlType() const override; |
100 | 100 |
101 virtual FormControlState saveFormControlState() const OVERRIDE; | 101 virtual FormControlState saveFormControlState() const override; |
102 virtual void restoreFormControlState(const FormControlState&) OVERRIDE; | 102 virtual void restoreFormControlState(const FormControlState&) override; |
103 | 103 |
104 virtual bool isTextFormControl() const OVERRIDE { return true; } | 104 virtual bool isTextFormControl() const override { return true; } |
105 | 105 |
106 virtual void childrenChanged(const ChildrenChange&) OVERRIDE; | 106 virtual void childrenChanged(const ChildrenChange&) override; |
107 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 107 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; |
108 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; | 108 virtual bool isPresentationAttribute(const QualifiedName&) const override; |
109 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) OVERRIDE; | 109 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) override; |
110 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; | 110 virtual RenderObject* createRenderer(RenderStyle*) override; |
111 virtual bool appendFormData(FormDataList&, bool) OVERRIDE; | 111 virtual bool appendFormData(FormDataList&, bool) override; |
112 virtual void resetImpl() OVERRIDE; | 112 virtual void resetImpl() override; |
113 virtual bool hasCustomFocusLogic() const OVERRIDE; | 113 virtual bool hasCustomFocusLogic() const override; |
114 virtual bool shouldShowFocusRingOnMouseFocus() const OVERRIDE; | 114 virtual bool shouldShowFocusRingOnMouseFocus() const override; |
115 virtual bool isKeyboardFocusable() const OVERRIDE; | 115 virtual bool isKeyboardFocusable() const override; |
116 virtual void updateFocusAppearance(bool restorePreviousSelection) OVERRIDE; | 116 virtual void updateFocusAppearance(bool restorePreviousSelection) override; |
117 | 117 |
118 virtual void accessKeyAction(bool sendMouseEvents) OVERRIDE; | 118 virtual void accessKeyAction(bool sendMouseEvents) override; |
119 | 119 |
120 virtual bool matchesReadOnlyPseudoClass() const OVERRIDE; | 120 virtual bool matchesReadOnlyPseudoClass() const override; |
121 virtual bool matchesReadWritePseudoClass() const OVERRIDE; | 121 virtual bool matchesReadWritePseudoClass() const override; |
122 | 122 |
123 // If the String* argument is 0, apply this->value(). | 123 // If the String* argument is 0, apply this->value(). |
124 bool valueMissing(const String*) const; | 124 bool valueMissing(const String*) const; |
125 bool tooLong(const String*, NeedsToCheckDirtyFlag) const; | 125 bool tooLong(const String*, NeedsToCheckDirtyFlag) const; |
126 | 126 |
127 int m_rows; | 127 int m_rows; |
128 int m_cols; | 128 int m_cols; |
129 WrapMethod m_wrap; | 129 WrapMethod m_wrap; |
130 mutable String m_value; | 130 mutable String m_value; |
131 mutable bool m_isDirty; | 131 mutable bool m_isDirty; |
132 bool m_valueIsUpToDate; | 132 bool m_valueIsUpToDate; |
133 String m_suggestedValue; | 133 String m_suggestedValue; |
134 }; | 134 }; |
135 | 135 |
136 } // namespace blink | 136 } // namespace blink |
137 | 137 |
138 #endif // HTMLTextAreaElement_h | 138 #endif // HTMLTextAreaElement_h |
OLD | NEW |