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

Unified Diff: ui/gfx/render_text.cc

Issue 738363002: Enable subpixel positioning for UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: re-disable dwrite in tests, re-enable dwrite metrics Created 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index 87e650b8cf3107637f407cad49850905f17fac68..cae8b7130b0a7dbc76c58d278a326f7a08e80a46 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -722,7 +722,8 @@ SizeF RenderText::GetStringSizeF() {
}
float RenderText::GetContentWidth() {
- return GetStringSizeF().width() + (cursor_enabled_ ? 1 : 0);
+ return cursor_enabled_ ?
msw 2014/11/24 21:51:00 This change seems hinge on the cursor painting 1px
ckocagil 2014/11/25 01:39:47 Correct.
+ GetStringSize().width() + 1 : GetStringSizeF().width();
}
int RenderText::GetBaseline() {
@@ -1071,7 +1072,7 @@ Vector2d RenderText::GetAlignmentOffset(size_t line_number) {
HorizontalAlignment horizontal_alignment = GetCurrentHorizontalAlignment();
if (horizontal_alignment != ALIGN_LEFT) {
#if defined(OS_WIN)
- const int width = lines_[line_number].size.width() +
+ const int width = std::ceil(lines_[line_number].size.width()) +
(cursor_enabled_ ? 1 : 0);
#else
const int width = GetContentWidth();

Powered by Google App Engine
This is Rietveld 408576698