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

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

Issue 2341633006: MacViews/a11y: Allow accessibility clients to update the selected text. (Closed)
Patch Set: Make set value callbacks not have a const bool |replace| arg. Created 4 years, 1 month 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 #include "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 cursor_changed |= GetSelectionModel() != selection_model; 1801 cursor_changed |= GetSelectionModel() != selection_model;
1802 if (cursor_changed) 1802 if (cursor_changed)
1803 UpdateSelectionClipboard(); 1803 UpdateSelectionClipboard();
1804 UpdateAfterChange(text_changed, cursor_changed); 1804 UpdateAfterChange(text_changed, cursor_changed);
1805 OnAfterUserAction(); 1805 OnAfterUserAction();
1806 } 1806 }
1807 1807
1808 //////////////////////////////////////////////////////////////////////////////// 1808 ////////////////////////////////////////////////////////////////////////////////
1809 // Textfield, private: 1809 // Textfield, private:
1810 1810
1811 void Textfield::AccessibilitySetValue(const base::string16& new_value) { 1811 void Textfield::AccessibilitySetValue(const base::string16& new_value,
1812 if (!read_only()) { 1812 bool replace) {
1813 if (read_only())
1814 return;
1815 if (replace)
1816 InsertOrReplaceText(new_value);
1817 else
1813 SetText(new_value); 1818 SetText(new_value);
1814 ClearSelection(); 1819 ClearSelection();
1815 }
1816 } 1820 }
1817 1821
1818 void Textfield::UpdateBackgroundColor() { 1822 void Textfield::UpdateBackgroundColor() {
1819 const SkColor color = GetBackgroundColor(); 1823 const SkColor color = GetBackgroundColor();
1820 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { 1824 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
1821 set_background(Background::CreateBackgroundPainter( 1825 set_background(Background::CreateBackgroundPainter(
1822 true, Painter::CreateSolidRoundRectPainter( 1826 true, Painter::CreateSolidRoundRectPainter(
1823 color, FocusableBorder::kCornerRadiusDp))); 1827 color, FocusableBorder::kCornerRadiusDp)));
1824 } else { 1828 } else {
1825 set_background(Background::CreateSolidBackground(color)); 1829 set_background(Background::CreateSolidBackground(color));
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 } 2109 }
2106 2110
2107 void Textfield::OnCursorBlinkTimerFired() { 2111 void Textfield::OnCursorBlinkTimerFired() {
2108 DCHECK(ShouldBlinkCursor()); 2112 DCHECK(ShouldBlinkCursor());
2109 gfx::RenderText* render_text = GetRenderText(); 2113 gfx::RenderText* render_text = GetRenderText();
2110 render_text->set_cursor_visible(!render_text->cursor_visible()); 2114 render_text->set_cursor_visible(!render_text->cursor_visible());
2111 RepaintCursor(); 2115 RepaintCursor();
2112 } 2116 }
2113 2117
2114 } // namespace views 2118 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698