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 reserved. |
6 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 6 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 static Position startOfSentence(const Position&); | 108 static Position startOfSentence(const Position&); |
109 static Position endOfSentence(const Position&); | 109 static Position endOfSentence(const Position&); |
110 | 110 |
111 protected: | 111 protected: |
112 HTMLTextFormControlElement(const QualifiedName&, Document&, HTMLFormElement* ); | 112 HTMLTextFormControlElement(const QualifiedName&, Document&, HTMLFormElement* ); |
113 bool isPlaceholderEmpty() const; | 113 bool isPlaceholderEmpty() const; |
114 virtual void updatePlaceholderText() = 0; | 114 virtual void updatePlaceholderText() = 0; |
115 | 115 |
116 void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicS tring&) override; | 116 void parseAttribute(const QualifiedName&, const AtomicString&, const AtomicS tring&) override; |
117 | 117 |
118 void cacheSelection(int start, int end, TextFieldSelectionDirection directio n) | |
119 { | |
120 DCHECK_GE(start, 0); | |
121 m_cachedSelectionStart = start; | |
122 m_cachedSelectionEnd = end; | |
123 m_cachedSelectionDirection = direction; | |
124 } | |
125 | |
126 void restoreCachedSelection(); | 118 void restoreCachedSelection(); |
127 | 119 |
128 void defaultEventHandler(Event*) override; | 120 void defaultEventHandler(Event*) override; |
129 virtual void subtreeHasChanged() = 0; | 121 virtual void subtreeHasChanged() = 0; |
130 | 122 |
131 void setLastChangeWasNotUserEdit() { m_lastChangeWasUserEdit = false; } | 123 void setLastChangeWasNotUserEdit() { m_lastChangeWasUserEdit = false; } |
132 void addPlaceholderBreakElementIfNecessary(); | 124 void addPlaceholderBreakElementIfNecessary(); |
133 String valueWithHardLineBreaks() const; | 125 String valueWithHardLineBreaks() const; |
134 | 126 |
135 virtual bool shouldDispatchFormControlChangeEvent(String&, String&); | 127 virtual bool shouldDispatchFormControlChangeEvent(String&, String&); |
136 void copyNonAttributePropertiesFromElement(const Element&) override; | 128 void copyNonAttributePropertiesFromElement(const Element&) override; |
137 | 129 |
138 private: | 130 private: |
139 int computeSelectionStart() const; | 131 int computeSelectionStart() const; |
140 int computeSelectionEnd() const; | 132 int computeSelectionEnd() const; |
141 TextFieldSelectionDirection computeSelectionDirection() const; | 133 TextFieldSelectionDirection computeSelectionDirection() const; |
134 void cacheSelection(int start, int end, TextFieldSelectionDirection directio n) | |
135 { | |
136 DCHECK_GE(start, 0); | |
137 m_cachedSelectionStart = start; | |
yosin_UTC9
2016/08/25 08:10:22
nit: Could you add |DCHECK_LE(start, end)|?
tkent
2016/08/25 09:12:40
Done.
tkent
2016/08/25 10:21:03
editing/selection/select-across-readonly-input-1.h
| |
138 m_cachedSelectionEnd = end; | |
139 m_cachedSelectionDirection = direction; | |
140 } | |
142 | 141 |
143 void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, InputDevic eCapabilities* sourceCapabilities) final; | 142 void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, InputDevic eCapabilities* sourceCapabilities) final; |
144 void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, InputDevice Capabilities* sourceCapabilities) final; | 143 void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, InputDevice Capabilities* sourceCapabilities) final; |
145 void scheduleSelectEvent(); | 144 void scheduleSelectEvent(); |
146 | 145 |
147 // Returns true if user-editable value is empty. Used to check placeholder v isibility. | 146 // Returns true if user-editable value is empty. Used to check placeholder v isibility. |
148 virtual bool isEmptyValue() const = 0; | 147 virtual bool isEmptyValue() const = 0; |
149 // Returns true if suggested value is empty. Used to check placeholder visib ility. | 148 // Returns true if suggested value is empty. Used to check placeholder visib ility. |
150 virtual bool isEmptySuggestedValue() const { return true; } | 149 virtual bool isEmptySuggestedValue() const { return true; } |
151 // Called in dispatchFocusEvent(), after placeholder process, before calling parent's dispatchFocusEvent(). | 150 // Called in dispatchFocusEvent(), after placeholder process, before calling parent's dispatchFocusEvent(). |
(...skipping 17 matching lines...) Expand all Loading... | |
169 } | 168 } |
170 | 169 |
171 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTextFormControlElement); | 170 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTextFormControlElement); |
172 | 171 |
173 HTMLTextFormControlElement* enclosingTextFormControl(const Position&); | 172 HTMLTextFormControlElement* enclosingTextFormControl(const Position&); |
174 HTMLTextFormControlElement* enclosingTextFormControl(Node*); | 173 HTMLTextFormControlElement* enclosingTextFormControl(Node*); |
175 | 174 |
176 } // namespace blink | 175 } // namespace blink |
177 | 176 |
178 #endif | 177 #endif |
OLD | NEW |