| 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, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 6 * reserved. |
| 6 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 7 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. |
| 7 * | 8 * |
| 8 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 11 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 12 * | 13 * |
| 13 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| (...skipping 26 matching lines...) Expand all Loading... |
| 42 }; | 43 }; |
| 43 enum TextFieldEventBehavior { | 44 enum TextFieldEventBehavior { |
| 44 DispatchNoEvent, | 45 DispatchNoEvent, |
| 45 DispatchChangeEvent, | 46 DispatchChangeEvent, |
| 46 DispatchInputAndChangeEvent | 47 DispatchInputAndChangeEvent |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 class CORE_EXPORT HTMLTextFormControlElement | 50 class CORE_EXPORT HTMLTextFormControlElement |
| 50 : public HTMLFormControlElementWithState { | 51 : public HTMLFormControlElementWithState { |
| 51 public: | 52 public: |
| 52 // Common flag for HTMLInputElement::tooLong(), HTMLTextAreaElement::tooLong()
, | 53 // Common flag for HTMLInputElement::tooLong(), |
| 54 // HTMLTextAreaElement::tooLong(), |
| 53 // HTMLInputElement::tooShort() and HTMLTextAreaElement::tooShort(). | 55 // HTMLInputElement::tooShort() and HTMLTextAreaElement::tooShort(). |
| 54 enum NeedsToCheckDirtyFlag { CheckDirtyFlag, IgnoreDirtyFlag }; | 56 enum NeedsToCheckDirtyFlag { CheckDirtyFlag, IgnoreDirtyFlag }; |
| 55 | 57 |
| 56 ~HTMLTextFormControlElement() override; | 58 ~HTMLTextFormControlElement() override; |
| 57 | 59 |
| 58 void forwardEvent(Event*); | 60 void forwardEvent(Event*); |
| 59 | 61 |
| 60 InsertionNotificationRequest insertedInto(ContainerNode*) override; | 62 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
| 61 | 63 |
| 62 // The derived class should return true if placeholder processing is needed. | 64 // The derived class should return true if placeholder processing is needed. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 static int indexForPosition(HTMLElement* innerEditor, const Position&); | 167 static int indexForPosition(HTMLElement* innerEditor, const Position&); |
| 166 | 168 |
| 167 void dispatchFocusEvent(Element* oldFocusedElement, | 169 void dispatchFocusEvent(Element* oldFocusedElement, |
| 168 WebFocusType, | 170 WebFocusType, |
| 169 InputDeviceCapabilities* sourceCapabilities) final; | 171 InputDeviceCapabilities* sourceCapabilities) final; |
| 170 void dispatchBlurEvent(Element* newFocusedElement, | 172 void dispatchBlurEvent(Element* newFocusedElement, |
| 171 WebFocusType, | 173 WebFocusType, |
| 172 InputDeviceCapabilities* sourceCapabilities) final; | 174 InputDeviceCapabilities* sourceCapabilities) final; |
| 173 void scheduleSelectEvent(); | 175 void scheduleSelectEvent(); |
| 174 | 176 |
| 175 // Returns true if user-editable value is empty. Used to check placeholder vis
ibility. | 177 // Returns true if user-editable value is empty. Used to check placeholder |
| 178 // visibility. |
| 176 virtual bool isEmptyValue() const = 0; | 179 virtual bool isEmptyValue() const = 0; |
| 177 // Returns true if suggested value is empty. Used to check placeholder visibil
ity. | 180 // Returns true if suggested value is empty. Used to check placeholder |
| 181 // visibility. |
| 178 virtual bool isEmptySuggestedValue() const { return true; } | 182 virtual bool isEmptySuggestedValue() const { return true; } |
| 179 // Called in dispatchFocusEvent(), after placeholder process, before calling p
arent's dispatchFocusEvent(). | 183 // Called in dispatchFocusEvent(), after placeholder process, before calling |
| 184 // parent's dispatchFocusEvent(). |
| 180 virtual void handleFocusEvent(Element* /* oldFocusedNode */, WebFocusType) {} | 185 virtual void handleFocusEvent(Element* /* oldFocusedNode */, WebFocusType) {} |
| 181 // Called in dispatchBlurEvent(), after placeholder process, before calling pa
rent's dispatchBlurEvent(). | 186 // Called in dispatchBlurEvent(), after placeholder process, before calling |
| 187 // parent's dispatchBlurEvent(). |
| 182 virtual void handleBlurEvent() {} | 188 virtual void handleBlurEvent() {} |
| 183 | 189 |
| 184 bool placeholderShouldBeVisible() const; | 190 bool placeholderShouldBeVisible() const; |
| 185 | 191 |
| 186 String m_textAsOfLastFormControlChangeEvent; | 192 String m_textAsOfLastFormControlChangeEvent; |
| 187 bool m_lastChangeWasUserEdit; | 193 bool m_lastChangeWasUserEdit; |
| 188 | 194 |
| 189 int m_cachedSelectionStart; | 195 int m_cachedSelectionStart; |
| 190 int m_cachedSelectionEnd; | 196 int m_cachedSelectionEnd; |
| 191 TextFieldSelectionDirection m_cachedSelectionDirection; | 197 TextFieldSelectionDirection m_cachedSelectionDirection; |
| 192 | 198 |
| 193 FRIEND_TEST_ALL_PREFIXES(HTMLTextFormControlElementTest, IndexForPosition); | 199 FRIEND_TEST_ALL_PREFIXES(HTMLTextFormControlElementTest, IndexForPosition); |
| 194 }; | 200 }; |
| 195 | 201 |
| 196 inline bool isHTMLTextFormControlElement(const Element& element) { | 202 inline bool isHTMLTextFormControlElement(const Element& element) { |
| 197 return element.isTextFormControl(); | 203 return element.isTextFormControl(); |
| 198 } | 204 } |
| 199 | 205 |
| 200 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTextFormControlElement); | 206 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTextFormControlElement); |
| 201 | 207 |
| 202 HTMLTextFormControlElement* enclosingTextFormControl(const Position&); | 208 HTMLTextFormControlElement* enclosingTextFormControl(const Position&); |
| 203 HTMLTextFormControlElement* enclosingTextFormControl(Node*); | 209 HTMLTextFormControlElement* enclosingTextFormControl(Node*); |
| 204 | 210 |
| 205 } // namespace blink | 211 } // namespace blink |
| 206 | 212 |
| 207 #endif | 213 #endif |
| OLD | NEW |