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

Side by Side Diff: ui/views/controls/textfield/textfield.h

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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 gfx::RenderText* GetRenderText() const; 312 gfx::RenderText* GetRenderText() const;
313 313
314 gfx::Point last_click_location() const { return last_click_location_; } 314 gfx::Point last_click_location() const { return last_click_location_; }
315 315
316 // Get the text from the selection clipboard. 316 // Get the text from the selection clipboard.
317 virtual base::string16 GetSelectionClipboardText() const; 317 virtual base::string16 GetSelectionClipboardText() const;
318 318
319 // Executes the given |command|. 319 // Executes the given |command|.
320 virtual void ExecuteTextEditCommand(ui::TextEditCommand command); 320 virtual void ExecuteTextEditCommand(ui::TextEditCommand command);
321 321
322 // Does necessary updates when the text and/or cursor position changes.
323 void UpdateAfterChange(bool text_changed, bool cursor_changed);
324
322 private: 325 private:
323 friend class TextfieldTestApi; 326 friend class TextfieldTestApi;
324 327
325 // View overrides: 328 // View overrides:
326 // Declared final since overriding by subclasses would interfere with the 329 // Declared final since overriding by subclasses would interfere with the
327 // accounting related to the scheduled text edit command. Subclasses should 330 // accounting related to the scheduled text edit command. Subclasses should
328 // use TextfieldController::HandleKeyEvent, to intercept the key event. 331 // use TextfieldController::HandleKeyEvent, to intercept the key event.
329 bool OnKeyPressed(const ui::KeyEvent& event) final; 332 bool OnKeyPressed(const ui::KeyEvent& event) final;
330 bool OnKeyReleased(const ui::KeyEvent& event) final; 333 bool OnKeyReleased(const ui::KeyEvent& event) final;
331 334
332 // Handles a request to change the value of this text field from software 335 // Handles a request to change the value of this text field from software
333 // using an accessibility API (typically automation software, screen readers 336 // using an accessibility API (typically automation software, screen readers
334 // don't normally use this). Sets the value and clears the selection. 337 // don't normally use this). Sets the value and clears the selection.
335 void AccessibilitySetValue(const base::string16& new_value); 338 void AccessibilitySetValue(const base::string16& new_value);
336 339
337 // Updates the painted background color. 340 // Updates the painted background color.
338 void UpdateBackgroundColor(); 341 void UpdateBackgroundColor();
339 342
340 // Does necessary updates when the text and/or cursor position changes.
341 void UpdateAfterChange(bool text_changed, bool cursor_changed);
342
343 // A callback function to periodically update the cursor state. 343 // A callback function to periodically update the cursor state.
344 void UpdateCursor(); 344 void UpdateCursor();
345 345
346 // Repaint the cursor. 346 // Repaint the cursor.
347 void RepaintCursor(); 347 void RepaintCursor();
348 348
349 void PaintTextAndCursor(gfx::Canvas* canvas); 349 void PaintTextAndCursor(gfx::Canvas* canvas);
350 350
351 // Helper function to call MoveCursorTo on the TextfieldModel. 351 // Helper function to call MoveCursorTo on the TextfieldModel.
352 void MoveCursorTo(const gfx::Point& point, bool select); 352 void MoveCursorTo(const gfx::Point& point, bool select);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 510
511 // Used to bind callback functions to this object. 511 // Used to bind callback functions to this object.
512 base::WeakPtrFactory<Textfield> weak_ptr_factory_; 512 base::WeakPtrFactory<Textfield> weak_ptr_factory_;
513 513
514 DISALLOW_COPY_AND_ASSIGN(Textfield); 514 DISALLOW_COPY_AND_ASSIGN(Textfield);
515 }; 515 };
516 516
517 } // namespace views 517 } // namespace views
518 518
519 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 519 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698