Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: Source/core/html/HTMLTextFormControlElement.h

Issue 995363002: Implement autocapitalize in Blink to be used by the embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: ready for review Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
32 32
33 class ExceptionState; 33 class ExceptionState;
34 class Position; 34 class Position;
35 class Range; 35 class Range;
36 class VisiblePosition; 36 class VisiblePosition;
37 37
38 enum TextFieldSelectionDirection { SelectionHasNoDirection, SelectionHasForwardD irection, SelectionHasBackwardDirection }; 38 enum TextFieldSelectionDirection { SelectionHasNoDirection, SelectionHasForwardD irection, SelectionHasBackwardDirection };
39 enum TextFieldEventBehavior { DispatchNoEvent, DispatchChangeEvent, DispatchInpu tAndChangeEvent }; 39 enum TextFieldEventBehavior { DispatchNoEvent, DispatchChangeEvent, DispatchInpu tAndChangeEvent };
40 enum NeedToDispatchSelectEvent { DispatchSelectEvent, NotDispatchSelectEvent }; 40 enum NeedToDispatchSelectEvent { DispatchSelectEvent, NotDispatchSelectEvent };
41 41
42 class CORE_EXPORT HTMLTextFormControlElement : public HTMLFormControlElementWith State { 42 enum class TextFieldAutocapitalize : char {
43 Uninitialized,
44 None,
45 Characters,
46 Words,
47 Sentences
48 };
49
50 class HTMLTextFormControlElement : public HTMLFormControlElementWithState {
tkent 2015/03/17 22:53:50 Do not remove CORE_EXPORT.
mlamouri (slow - plz ping) 2015/03/18 10:08:16 Sorry about that, this is a rebase mistake.
43 public: 51 public:
44 // Common flag for HTMLInputElement::tooLong(), HTMLTextAreaElement::tooLong (), 52 // Common flag for HTMLInputElement::tooLong(), HTMLTextAreaElement::tooLong (),
45 // HTMLInputElement::tooShort() and HTMLTextAreaElement::tooShort(). 53 // HTMLInputElement::tooShort() and HTMLTextAreaElement::tooShort().
46 enum NeedsToCheckDirtyFlag {CheckDirtyFlag, IgnoreDirtyFlag}; 54 enum NeedsToCheckDirtyFlag {CheckDirtyFlag, IgnoreDirtyFlag};
47 // Option of setSelectionRange. 55 // Option of setSelectionRange.
48 enum SelectionOption { 56 enum SelectionOption {
49 ChangeSelection, 57 ChangeSelection,
50 ChangeSelectionAndFocus, 58 ChangeSelectionAndFocus,
51 ChangeSelectionIfFocused, 59 ChangeSelectionIfFocused,
52 NotChangeSelection 60 NotChangeSelection
(...skipping 21 matching lines...) Expand all
74 void setSelectionStart(int); 82 void setSelectionStart(int);
75 void setSelectionEnd(int); 83 void setSelectionEnd(int);
76 void setSelectionDirection(const String&); 84 void setSelectionDirection(const String&);
77 void select(NeedToDispatchSelectEvent = DispatchSelectEvent); 85 void select(NeedToDispatchSelectEvent = DispatchSelectEvent);
78 virtual void setRangeText(const String& replacement, ExceptionState&); 86 virtual void setRangeText(const String& replacement, ExceptionState&);
79 virtual void setRangeText(const String& replacement, unsigned start, unsigne d end, const String& selectionMode, ExceptionState&); 87 virtual void setRangeText(const String& replacement, unsigned start, unsigne d end, const String& selectionMode, ExceptionState&);
80 void setSelectionRange(int start, int end, const String& direction); 88 void setSelectionRange(int start, int end, const String& direction);
81 void setSelectionRange(int start, int end, TextFieldSelectionDirection = Sel ectionHasNoDirection, NeedToDispatchSelectEvent = DispatchSelectEvent, Selection Option = ChangeSelection); 89 void setSelectionRange(int start, int end, TextFieldSelectionDirection = Sel ectionHasNoDirection, NeedToDispatchSelectEvent = DispatchSelectEvent, Selection Option = ChangeSelection);
82 PassRefPtrWillBeRawPtr<Range> selection() const; 90 PassRefPtrWillBeRawPtr<Range> selection() const;
83 91
92 virtual bool supportsAutocapitalize() const = 0;
93 virtual TextFieldAutocapitalize defaultAutocapitalizeValue() const = 0;
94 TextFieldAutocapitalize autocapitalizeValue() const;
95 const AtomicString& autocapitalize() const;
96 void setAutocapitalize(const AtomicString&);
97
84 virtual void dispatchFormControlChangeEvent() override final; 98 virtual void dispatchFormControlChangeEvent() override final;
85 99
86 virtual String value() const = 0; 100 virtual String value() const = 0;
87 101
88 HTMLElement* innerEditorElement() const; 102 HTMLElement* innerEditorElement() const;
89 103
90 void selectionChanged(bool userTriggered); 104 void selectionChanged(bool userTriggered);
91 bool lastChangeWasUserEdit() const; 105 bool lastChangeWasUserEdit() const;
92 virtual void setInnerEditorValue(const String&); 106 virtual void setInnerEditorValue(const String&);
93 String innerEditorValue() const; 107 String innerEditorValue() const;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 virtual void handleFocusEvent(Element* /* oldFocusedNode */, WebFocusType) { } 162 virtual void handleFocusEvent(Element* /* oldFocusedNode */, WebFocusType) { }
149 // Called in dispatchBlurEvent(), after placeholder process, before calling parent's dispatchBlurEvent(). 163 // Called in dispatchBlurEvent(), after placeholder process, before calling parent's dispatchBlurEvent().
150 virtual void handleBlurEvent() { } 164 virtual void handleBlurEvent() { }
151 165
152 String m_textAsOfLastFormControlChangeEvent; 166 String m_textAsOfLastFormControlChangeEvent;
153 bool m_lastChangeWasUserEdit; 167 bool m_lastChangeWasUserEdit;
154 168
155 int m_cachedSelectionStart; 169 int m_cachedSelectionStart;
156 int m_cachedSelectionEnd; 170 int m_cachedSelectionEnd;
157 TextFieldSelectionDirection m_cachedSelectionDirection; 171 TextFieldSelectionDirection m_cachedSelectionDirection;
172 TextFieldAutocapitalize m_autocapitalize;
tkent 2015/03/17 22:53:50 Please remove this data member. We should avoid ca
158 }; 173 };
159 174
160 inline bool isHTMLTextFormControlElement(const Element& element) 175 inline bool isHTMLTextFormControlElement(const Element& element)
161 { 176 {
162 return element.isTextFormControl(); 177 return element.isTextFormControl();
163 } 178 }
164 179
165 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTextFormControlElement); 180 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTextFormControlElement);
166 181
167 HTMLTextFormControlElement* enclosingTextFormControl(const Position&); 182 HTMLTextFormControlElement* enclosingTextFormControl(const Position&);
168 HTMLTextFormControlElement* enclosingTextFormControl(Node*); 183 HTMLTextFormControlElement* enclosingTextFormControl(Node*);
169 184
170 } // namespace 185 } // namespace
171 186
172 #endif 187 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698