OLD | NEW |
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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 } | 1315 } |
1316 | 1316 |
1317 int Textfield::GetTextInputFlags() const { | 1317 int Textfield::GetTextInputFlags() const { |
1318 return text_input_flags_; | 1318 return text_input_flags_; |
1319 } | 1319 } |
1320 | 1320 |
1321 bool Textfield::CanComposeInline() const { | 1321 bool Textfield::CanComposeInline() const { |
1322 return true; | 1322 return true; |
1323 } | 1323 } |
1324 | 1324 |
| 1325 float Textfield::GetScaleFactor() const { |
| 1326 return display::Screen::GetScreen()->GetDisplayNearestWindow( |
| 1327 GetWidget()->GetNativeWindow()).device_scale_factor(); |
| 1328 } |
| 1329 |
1325 gfx::Rect Textfield::GetCaretBounds() const { | 1330 gfx::Rect Textfield::GetCaretBounds() const { |
1326 gfx::Rect rect = GetRenderText()->GetUpdatedCursorBounds(); | 1331 gfx::Rect rect = GetRenderText()->GetUpdatedCursorBounds(); |
1327 ConvertRectToScreen(this, &rect); | 1332 ConvertRectToScreen(this, &rect); |
1328 return rect; | 1333 return rect; |
1329 } | 1334 } |
1330 | 1335 |
1331 bool Textfield::GetCompositionCharacterBounds(uint32_t index, | 1336 bool Textfield::GetCompositionCharacterBounds(uint32_t index, |
1332 gfx::Rect* rect) const { | 1337 gfx::Rect* rect) const { |
1333 DCHECK(rect); | 1338 DCHECK(rect); |
1334 if (!HasCompositionText()) | 1339 if (!HasCompositionText()) |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2057 } | 2062 } |
2058 | 2063 |
2059 void Textfield::OnCursorBlinkTimerFired() { | 2064 void Textfield::OnCursorBlinkTimerFired() { |
2060 DCHECK(ShouldBlinkCursor()); | 2065 DCHECK(ShouldBlinkCursor()); |
2061 gfx::RenderText* render_text = GetRenderText(); | 2066 gfx::RenderText* render_text = GetRenderText(); |
2062 render_text->set_cursor_visible(!render_text->cursor_visible()); | 2067 render_text->set_cursor_visible(!render_text->cursor_visible()); |
2063 RepaintCursor(); | 2068 RepaintCursor(); |
2064 } | 2069 } |
2065 | 2070 |
2066 } // namespace views | 2071 } // namespace views |
OLD | NEW |