| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 int indexForVisiblePosition(const VisiblePosition&) const; | 63 int indexForVisiblePosition(const VisiblePosition&) const; |
| 64 int selectionStart() const; | 64 int selectionStart() const; |
| 65 int selectionEnd() const; | 65 int selectionEnd() const; |
| 66 const AtomicString& selectionDirection() const; | 66 const AtomicString& selectionDirection() const; |
| 67 void setSelectionStart(int); | 67 void setSelectionStart(int); |
| 68 void setSelectionEnd(int); | 68 void setSelectionEnd(int); |
| 69 void setSelectionDirection(const String&); | 69 void setSelectionDirection(const String&); |
| 70 void select(NeedToDispatchSelectEvent = DispatchSelectEvent); | 70 void select(NeedToDispatchSelectEvent = DispatchSelectEvent); |
| 71 virtual void setRangeText(const String& replacement, ExceptionState&); | 71 virtual void setRangeText(const String& replacement, ExceptionState&); |
| 72 virtual void setRangeText(const String& replacement, unsigned start, unsigne
d end, const String& selectionMode, ExceptionState&); | 72 virtual void setRangeText(const String& replacement, unsigned start, unsigne
d end, const String& selectionMode, ExceptionState&); |
| 73 // Web-exposed setSelectionRange() function. This translates "none" | 73 // Web-exposed setSelectionRange() function. This schedule to dispatch |
| 74 // direction to "forward" if necessary. | 74 // 'select' event. |
| 75 void setSelectionRangeForBinding(int start, int end, const String& direction
= "none"); | 75 void setSelectionRangeForBinding(int start, int end, const String& direction
= "none"); |
| 76 // Blink-internal version of setSelectionRange(). This never translates | 76 // Blink-internal version of setSelectionRange(). This translates "none" |
| 77 // "none" direction. | 77 // direction to "forward" on platforms without "none" direction. |
| 78 void setSelectionRange(int start, int end, TextFieldSelectionDirection = Sel
ectionHasNoDirection, NeedToDispatchSelectEvent = DispatchSelectEvent); | 78 void setSelectionRange(int start, int end, TextFieldSelectionDirection = Sel
ectionHasNoDirection, NeedToDispatchSelectEvent = DispatchSelectEvent); |
| 79 Range* selection() const; | 79 Range* selection() const; |
| 80 | 80 |
| 81 virtual bool supportsAutocapitalize() const = 0; | 81 virtual bool supportsAutocapitalize() const = 0; |
| 82 virtual const AtomicString& defaultAutocapitalize() const = 0; | 82 virtual const AtomicString& defaultAutocapitalize() const = 0; |
| 83 const AtomicString& autocapitalize() const; | 83 const AtomicString& autocapitalize() const; |
| 84 void setAutocapitalize(const AtomicString&); | 84 void setAutocapitalize(const AtomicString&); |
| 85 | 85 |
| 86 void dispatchFormControlChangeEvent() final; | 86 void dispatchFormControlChangeEvent() final; |
| 87 | 87 |
| (...skipping 20 matching lines...) Expand all 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 // TODO(tkent): Add DCHECK_LE(start, end). It breaks |
| 138 // editing/selection/select-across-readonly-input-{1,4}.html |
| 139 m_cachedSelectionStart = start; |
| 140 m_cachedSelectionEnd = end; |
| 141 m_cachedSelectionDirection = direction; |
| 142 } |
| 142 | 143 |
| 143 void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, InputDevic
eCapabilities* sourceCapabilities) final; | 144 void dispatchFocusEvent(Element* oldFocusedElement, WebFocusType, InputDevic
eCapabilities* sourceCapabilities) final; |
| 144 void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, InputDevice
Capabilities* sourceCapabilities) final; | 145 void dispatchBlurEvent(Element* newFocusedElement, WebFocusType, InputDevice
Capabilities* sourceCapabilities) final; |
| 145 void scheduleSelectEvent(); | 146 void scheduleSelectEvent(); |
| 146 | 147 |
| 147 // Returns true if user-editable value is empty. Used to check placeholder v
isibility. | 148 // Returns true if user-editable value is empty. Used to check placeholder v
isibility. |
| 148 virtual bool isEmptyValue() const = 0; | 149 virtual bool isEmptyValue() const = 0; |
| 149 // Returns true if suggested value is empty. Used to check placeholder visib
ility. | 150 // Returns true if suggested value is empty. Used to check placeholder visib
ility. |
| 150 virtual bool isEmptySuggestedValue() const { return true; } | 151 virtual bool isEmptySuggestedValue() const { return true; } |
| 151 // Called in dispatchFocusEvent(), after placeholder process, before calling
parent's dispatchFocusEvent(). | 152 // Called in dispatchFocusEvent(), after placeholder process, before calling
parent's dispatchFocusEvent(). |
| (...skipping 17 matching lines...) Expand all Loading... |
| 169 } | 170 } |
| 170 | 171 |
| 171 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTextFormControlElement); | 172 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTextFormControlElement); |
| 172 | 173 |
| 173 HTMLTextFormControlElement* enclosingTextFormControl(const Position&); | 174 HTMLTextFormControlElement* enclosingTextFormControl(const Position&); |
| 174 HTMLTextFormControlElement* enclosingTextFormControl(Node*); | 175 HTMLTextFormControlElement* enclosingTextFormControl(Node*); |
| 175 | 176 |
| 176 } // namespace blink | 177 } // namespace blink |
| 177 | 178 |
| 178 #endif | 179 #endif |
| OLD | NEW |