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

Unified Diff: ui/views/controls/textfield/textfield.cc

Issue 2399863002: views: call UpdateAfterChange() in Textfield::InsertOrReplaceText(). (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/controls/textfield/textfield.cc
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 7c7b03534634c075e20a209397b5897961b0bbcf..e46fef351a30a15c5bf6c75aa60fb08576f95506 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -1771,6 +1771,31 @@ void Textfield::ExecuteTextEditCommand(ui::TextEditCommand command) {
OnAfterUserAction();
}
+void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) {
+ if (text_changed) {
+ if (controller_)
+ controller_->ContentsChanged(this, text());
+ NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true);
+ }
+ if (cursor_changed) {
+ GetRenderText()->set_cursor_visible(ShouldShowCursor());
+ RepaintCursor();
+ if (ShouldBlinkCursor())
+ StartBlinkingCursor();
+ else
+ StopBlinkingCursor();
+ if (!text_changed) {
+ // TEXT_CHANGED implies TEXT_SELECTION_CHANGED, so we only need to fire
+ // this if only the selection changed.
+ NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_SELECTION_CHANGED, true);
+ }
+ }
+ if (text_changed || cursor_changed) {
+ OnCaretBoundsChanged();
+ SchedulePaint();
+ }
+}
+
////////////////////////////////////////////////////////////////////////////////
// Textfield, private:
@@ -1798,31 +1823,6 @@ void Textfield::UpdateBackgroundColor() {
SchedulePaint();
}
-void Textfield::UpdateAfterChange(bool text_changed, bool cursor_changed) {
- if (text_changed) {
- if (controller_)
- controller_->ContentsChanged(this, text());
- NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true);
- }
- if (cursor_changed) {
- GetRenderText()->set_cursor_visible(ShouldShowCursor());
- RepaintCursor();
- if (ShouldBlinkCursor())
- StartBlinkingCursor();
- else
- StopBlinkingCursor();
- if (!text_changed) {
- // TEXT_CHANGED implies TEXT_SELECTION_CHANGED, so we only need to fire
- // this if only the selection changed.
- NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_SELECTION_CHANGED, true);
- }
- }
- if (text_changed || cursor_changed) {
- OnCaretBoundsChanged();
- SchedulePaint();
- }
-}
-
void Textfield::RepaintCursor() {
gfx::Rect r(GetRenderText()->GetUpdatedCursorBounds());
r.Inset(-1, -1, -1, -1);

Powered by Google App Engine
This is Rietveld 408576698