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

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

Issue 392573002: HTMLTextAreaElement.setSelectionRange should not change focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix tests Created 6 years, 5 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 24 matching lines...) Expand all
35 class RenderTextControl; 35 class RenderTextControl;
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 40
41 class HTMLTextFormControlElement : public HTMLFormControlElementWithState { 41 class HTMLTextFormControlElement : public HTMLFormControlElementWithState {
42 public: 42 public:
43 // Common flag for HTMLInputElement::tooLong() and HTMLTextAreaElement::tooL ong(). 43 // Common flag for HTMLInputElement::tooLong() and HTMLTextAreaElement::tooL ong().
44 enum NeedsToCheckDirtyFlag {CheckDirtyFlag, IgnoreDirtyFlag}; 44 enum NeedsToCheckDirtyFlag {CheckDirtyFlag, IgnoreDirtyFlag};
45 // Option of setSelectionRange.
46 enum SelectionOption {
47 ChangeSelection,
48 NotChangeSelection
49 };
45 50
46 virtual ~HTMLTextFormControlElement(); 51 virtual ~HTMLTextFormControlElement();
47 52
48 void forwardEvent(Event*); 53 void forwardEvent(Event*);
49 54
50 55
51 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; 56 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
52 57
53 // The derived class should return true if placeholder processing is needed. 58 // The derived class should return true if placeholder processing is needed.
54 virtual bool supportsPlaceholder() const = 0; 59 virtual bool supportsPlaceholder() const = 0;
55 String strippedPlaceholder() const; 60 String strippedPlaceholder() const;
56 bool placeholderShouldBeVisible() const; 61 bool placeholderShouldBeVisible() const;
57 HTMLElement* placeholderElement() const; 62 HTMLElement* placeholderElement() const;
58 void updatePlaceholderVisibility(bool); 63 void updatePlaceholderVisibility(bool);
59 64
60 VisiblePosition visiblePositionForIndex(int) const; 65 VisiblePosition visiblePositionForIndex(int) const;
61 int indexForVisiblePosition(const VisiblePosition&) const; 66 int indexForVisiblePosition(const VisiblePosition&) const;
62 int selectionStart() const; 67 int selectionStart() const;
63 int selectionEnd() const; 68 int selectionEnd() const;
64 const AtomicString& selectionDirection() const; 69 const AtomicString& selectionDirection() const;
65 void setSelectionStart(int); 70 void setSelectionStart(int);
66 void setSelectionEnd(int); 71 void setSelectionEnd(int);
67 void setSelectionDirection(const String&); 72 void setSelectionDirection(const String&);
68 void select(); 73 void select();
69 virtual void setRangeText(const String& replacement, ExceptionState&); 74 virtual void setRangeText(const String& replacement, ExceptionState&);
70 virtual void setRangeText(const String& replacement, unsigned start, unsigne d end, const String& selectionMode, ExceptionState&); 75 virtual void setRangeText(const String& replacement, unsigned start, unsigne d end, const String& selectionMode, ExceptionState&);
71 void setSelectionRange(int start, int end, const String& direction); 76 void setSelectionRange(int start, int end, const String& direction);
72 void setSelectionRange(int start, int end, TextFieldSelectionDirection = Sel ectionHasNoDirection); 77 void setSelectionRange(int start, int end, TextFieldSelectionDirection = Sel ectionHasNoDirection, SelectionOption = ChangeSelection);
73 PassRefPtrWillBeRawPtr<Range> selection() const; 78 PassRefPtrWillBeRawPtr<Range> selection() const;
74 79
75 virtual void dispatchFormControlChangeEvent() OVERRIDE FINAL; 80 virtual void dispatchFormControlChangeEvent() OVERRIDE FINAL;
76 81
77 virtual String value() const = 0; 82 virtual String value() const = 0;
78 83
79 HTMLElement* innerEditorElement() const; 84 HTMLElement* innerEditorElement() const;
80 85
81 void selectionChanged(bool userTriggered); 86 void selectionChanged(bool userTriggered);
82 bool lastChangeWasUserEdit() const; 87 bool lastChangeWasUserEdit() const;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 157 }
153 158
154 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTextFormControlElement); 159 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLTextFormControlElement);
155 160
156 HTMLTextFormControlElement* enclosingTextFormControl(const Position&); 161 HTMLTextFormControlElement* enclosingTextFormControl(const Position&);
157 HTMLTextFormControlElement* enclosingTextFormControl(Node*); 162 HTMLTextFormControlElement* enclosingTextFormControl(Node*);
158 163
159 } // namespace 164 } // namespace
160 165
161 #endif 166 #endif
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTextAreaElement.cpp ('k') | Source/core/html/HTMLTextFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698