Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/TextControlElement.h |
| diff --git a/third_party/WebKit/Source/core/html/TextControlElement.h b/third_party/WebKit/Source/core/html/TextControlElement.h |
| index c7ad473554c4d91c23ff80955f9c0b4a44d981c6..8667c1ff259bf92e819da9fa2c7c120b14fa2c63 100644 |
| --- a/third_party/WebKit/Source/core/html/TextControlElement.h |
| +++ b/third_party/WebKit/Source/core/html/TextControlElement.h |
| @@ -47,6 +47,11 @@ enum TextFieldEventBehavior { |
| DispatchInputAndChangeEvent |
| }; |
| +enum class TextControlSetValueSelection { |
| + kSetSelectionToEnd, |
|
yoichio
2017/03/07 09:00:56
Why do you use another coding style to above enums
tkent
2017/03/07 09:27:34
kFooBar is the standard naming convention. FooBar
|
| + kDoNotSet, |
| +}; |
| + |
| class CORE_EXPORT TextControlElement : public HTMLFormControlElementWithState { |
| public: |
| // Common flag for HTMLInputElement::tooLong(), |
| @@ -124,8 +129,11 @@ class CORE_EXPORT TextControlElement : public HTMLFormControlElementWithState { |
| void setChangedSinceLastFormControlChangeEvent(bool); |
| virtual String value() const = 0; |
| - virtual void setValue(const String&, |
| - TextFieldEventBehavior = DispatchNoEvent) = 0; |
| + virtual void setValue( |
| + const String&, |
| + TextFieldEventBehavior = DispatchNoEvent, |
| + TextControlSetValueSelection = |
| + TextControlSetValueSelection::kSetSelectionToEnd) = 0; |
| HTMLElement* innerEditorElement() const; |
| @@ -160,14 +168,10 @@ class CORE_EXPORT TextControlElement : public HTMLFormControlElementWithState { |
| unsigned computeSelectionStart() const; |
| unsigned computeSelectionEnd() const; |
| TextFieldSelectionDirection computeSelectionDirection() const; |
| - void cacheSelection(unsigned start, |
| + // Returns true if cached values and arguments are not same. |
| + bool cacheSelection(unsigned start, |
| unsigned end, |
| - TextFieldSelectionDirection direction) { |
| - DCHECK_LE(start, end); |
| - m_cachedSelectionStart = start; |
| - m_cachedSelectionEnd = end; |
| - m_cachedSelectionDirection = direction; |
| - } |
| + TextFieldSelectionDirection); |
| static unsigned indexForPosition(HTMLElement* innerEditor, const Position&); |
| void dispatchFocusEvent(Element* oldFocusedElement, |