| 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 24 matching lines...) Expand all Loading... |
| 35 class CORE_EXPORT HTMLTextAreaElement final : public HTMLTextFormControlElement
{ | 35 class CORE_EXPORT HTMLTextAreaElement final : public HTMLTextFormControlElement
{ |
| 36 DEFINE_WRAPPERTYPEINFO(); | 36 DEFINE_WRAPPERTYPEINFO(); |
| 37 public: | 37 public: |
| 38 static PassRefPtrWillBeRawPtr<HTMLTextAreaElement> create(Document&, HTMLFor
mElement*); | 38 static PassRefPtrWillBeRawPtr<HTMLTextAreaElement> create(Document&, HTMLFor
mElement*); |
| 39 | 39 |
| 40 unsigned cols() const { return m_cols; } | 40 unsigned cols() const { return m_cols; } |
| 41 unsigned rows() const { return m_rows; } | 41 unsigned rows() const { return m_rows; } |
| 42 | 42 |
| 43 bool shouldWrapText() const { return m_wrap != NoWrap; } | 43 bool shouldWrapText() const { return m_wrap != NoWrap; } |
| 44 | 44 |
| 45 virtual String value() const override; | 45 String value() const override; |
| 46 void setValue(const String&, TextFieldEventBehavior = DispatchNoEvent); | 46 void setValue(const String&, TextFieldEventBehavior = DispatchNoEvent); |
| 47 String defaultValue() const; | 47 String defaultValue() const; |
| 48 void setDefaultValue(const String&); | 48 void setDefaultValue(const String&); |
| 49 int textLength() const { return value().length(); } | 49 int textLength() const { return value().length(); } |
| 50 int maxLength() const; | 50 int maxLength() const; |
| 51 int minLength() const; | 51 int minLength() const; |
| 52 void setMaxLength(int, ExceptionState&); | 52 void setMaxLength(int, ExceptionState&); |
| 53 void setMinLength(int, ExceptionState&); | 53 void setMinLength(int, ExceptionState&); |
| 54 | 54 |
| 55 String suggestedValue() const; | 55 String suggestedValue() const; |
| 56 void setSuggestedValue(const String&); | 56 void setSuggestedValue(const String&); |
| 57 | 57 |
| 58 // For ValidityState | 58 // For ValidityState |
| 59 virtual String validationMessage() const override; | 59 String validationMessage() const override; |
| 60 virtual bool valueMissing() const override; | 60 bool valueMissing() const override; |
| 61 virtual bool tooLong() const override; | 61 bool tooLong() const override; |
| 62 virtual bool tooShort() const override; | 62 bool tooShort() const override; |
| 63 bool isValidValue(const String&) const; | 63 bool isValidValue(const String&) const; |
| 64 | 64 |
| 65 void setCols(unsigned); | 65 void setCols(unsigned); |
| 66 void setRows(unsigned); | 66 void setRows(unsigned); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 HTMLTextAreaElement(Document&, HTMLFormElement*); | 69 HTMLTextAreaElement(Document&, HTMLFormElement*); |
| 70 | 70 |
| 71 enum WrapMethod { NoWrap, SoftWrap, HardWrap }; | 71 enum WrapMethod { NoWrap, SoftWrap, HardWrap }; |
| 72 enum SetValueCommonOption { | 72 enum SetValueCommonOption { |
| 73 NotSetSelection, | 73 NotSetSelection, |
| 74 SetSeletion | 74 SetSeletion |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 virtual void didAddUserAgentShadowRoot(ShadowRoot&) override; | 77 void didAddUserAgentShadowRoot(ShadowRoot&) override; |
| 78 // FIXME: Author shadows should be allowed | 78 // FIXME: Author shadows should be allowed |
| 79 // https://bugs.webkit.org/show_bug.cgi?id=92608 | 79 // https://bugs.webkit.org/show_bug.cgi?id=92608 |
| 80 virtual bool areAuthorShadowsAllowed() const override { return false; } | 80 bool areAuthorShadowsAllowed() const override { return false; } |
| 81 | 81 |
| 82 void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) const; | 82 void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) const; |
| 83 static String sanitizeUserInputValue(const String&, unsigned maxLength); | 83 static String sanitizeUserInputValue(const String&, unsigned maxLength); |
| 84 void updateValue() const; | 84 void updateValue() const; |
| 85 virtual void setInnerEditorValue(const String&) override; | 85 void setInnerEditorValue(const String&) override; |
| 86 void setNonDirtyValue(const String&); | 86 void setNonDirtyValue(const String&); |
| 87 void setValueCommon(const String&, TextFieldEventBehavior, SetValueCommonOpt
ion = NotSetSelection); | 87 void setValueCommon(const String&, TextFieldEventBehavior, SetValueCommonOpt
ion = NotSetSelection); |
| 88 | 88 |
| 89 virtual bool supportsPlaceholder() const override { return true; } | 89 bool supportsPlaceholder() const override { return true; } |
| 90 virtual void updatePlaceholderText() override; | 90 void updatePlaceholderText() override; |
| 91 virtual bool isEmptyValue() const override { return value().isEmpty(); } | 91 bool isEmptyValue() const override { return value().isEmpty(); } |
| 92 virtual bool isEmptySuggestedValue() const override final { return suggested
Value().isEmpty(); } | 92 bool isEmptySuggestedValue() const final { return suggestedValue().isEmpty()
; } |
| 93 virtual bool supportsAutocapitalize() const override { return true; } | 93 bool supportsAutocapitalize() const override { return true; } |
| 94 virtual const AtomicString& defaultAutocapitalize() const override; | 94 const AtomicString& defaultAutocapitalize() const override; |
| 95 | 95 |
| 96 virtual bool isOptionalFormControl() const override { return !isRequiredForm
Control(); } | 96 bool isOptionalFormControl() const override { return !isRequiredFormControl(
); } |
| 97 virtual bool isRequiredFormControl() const override { return isRequired(); } | 97 bool isRequiredFormControl() const override { return isRequired(); } |
| 98 | 98 |
| 99 virtual void defaultEventHandler(Event*) override; | 99 void defaultEventHandler(Event*) override; |
| 100 virtual void handleFocusEvent(Element* oldFocusedNode, WebFocusType) overrid
e; | 100 void handleFocusEvent(Element* oldFocusedNode, WebFocusType) override; |
| 101 | 101 |
| 102 virtual void subtreeHasChanged() override; | 102 void subtreeHasChanged() override; |
| 103 | 103 |
| 104 virtual bool isEnumeratable() const override { return true; } | 104 bool isEnumeratable() const override { return true; } |
| 105 virtual bool isInteractiveContent() const override; | 105 bool isInteractiveContent() const override; |
| 106 virtual bool supportsAutofocus() const override; | 106 bool supportsAutofocus() const override; |
| 107 virtual bool supportLabels() const override { return true; } | 107 bool supportLabels() const override { return true; } |
| 108 | 108 |
| 109 virtual const AtomicString& formControlType() const override; | 109 const AtomicString& formControlType() const override; |
| 110 | 110 |
| 111 virtual FormControlState saveFormControlState() const override; | 111 FormControlState saveFormControlState() const override; |
| 112 virtual void restoreFormControlState(const FormControlState&) override; | 112 void restoreFormControlState(const FormControlState&) override; |
| 113 | 113 |
| 114 virtual bool isTextFormControl() const override { return true; } | 114 bool isTextFormControl() const override { return true; } |
| 115 | 115 |
| 116 virtual void childrenChanged(const ChildrenChange&) override; | 116 void childrenChanged(const ChildrenChange&) override; |
| 117 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; | 117 void parseAttribute(const QualifiedName&, const AtomicString&) override; |
| 118 virtual bool isPresentationAttribute(const QualifiedName&) const override; | 118 bool isPresentationAttribute(const QualifiedName&) const override; |
| 119 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) override; | 119 void collectStyleForPresentationAttribute(const QualifiedName&, const Atomic
String&, MutableStylePropertySet*) override; |
| 120 virtual LayoutObject* createLayoutObject(const ComputedStyle&) override; | 120 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
| 121 virtual bool appendFormData(FormDataList&, bool) override; | 121 bool appendFormData(FormDataList&, bool) override; |
| 122 virtual void resetImpl() override; | 122 void resetImpl() override; |
| 123 virtual bool hasCustomFocusLogic() const override; | 123 bool hasCustomFocusLogic() const override; |
| 124 virtual bool shouldShowFocusRingOnMouseFocus() const override; | 124 bool shouldShowFocusRingOnMouseFocus() const override; |
| 125 virtual bool isKeyboardFocusable() const override; | 125 bool isKeyboardFocusable() const override; |
| 126 virtual void updateFocusAppearance(bool restorePreviousSelection) override; | 126 void updateFocusAppearance(bool restorePreviousSelection) override; |
| 127 | 127 |
| 128 virtual void accessKeyAction(bool sendMouseEvents) override; | 128 void accessKeyAction(bool sendMouseEvents) override; |
| 129 | 129 |
| 130 virtual bool matchesReadOnlyPseudoClass() const override; | 130 bool matchesReadOnlyPseudoClass() const override; |
| 131 virtual bool matchesReadWritePseudoClass() const override; | 131 bool matchesReadWritePseudoClass() const override; |
| 132 virtual void copyNonAttributePropertiesFromElement(const Element&) override
final; | 132 void copyNonAttributePropertiesFromElement(const Element&) final; |
| 133 | 133 |
| 134 // If the String* argument is 0, apply this->value(). | 134 // If the String* argument is 0, apply this->value(). |
| 135 bool valueMissing(const String*) const; | 135 bool valueMissing(const String*) const; |
| 136 bool tooLong(const String*, NeedsToCheckDirtyFlag) const; | 136 bool tooLong(const String*, NeedsToCheckDirtyFlag) const; |
| 137 bool tooShort(const String*, NeedsToCheckDirtyFlag) const; | 137 bool tooShort(const String*, NeedsToCheckDirtyFlag) const; |
| 138 | 138 |
| 139 unsigned m_rows; | 139 unsigned m_rows; |
| 140 unsigned m_cols; | 140 unsigned m_cols; |
| 141 WrapMethod m_wrap; | 141 WrapMethod m_wrap; |
| 142 mutable String m_value; | 142 mutable String m_value; |
| 143 mutable bool m_isDirty; | 143 mutable bool m_isDirty; |
| 144 bool m_valueIsUpToDate; | 144 bool m_valueIsUpToDate; |
| 145 String m_suggestedValue; | 145 String m_suggestedValue; |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 } // namespace blink | 148 } // namespace blink |
| 149 | 149 |
| 150 #endif // HTMLTextAreaElement_h | 150 #endif // HTMLTextAreaElement_h |
| OLD | NEW |