summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_win.cc')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 513f68a..6a17f80 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -437,19 +437,17 @@ AutocompleteEditViewWin::AutocompleteEditViewWin(
SelectObject(dc, font_.hfont());
TEXTMETRIC tm = {0};
GetTextMetrics(dc, &tm);
- font_ascent_ = tm.tmAscent;
const float kXHeightRatio = 0.7f; // The ratio of a font's x-height to its
// cap height. Sadly, Windows doesn't
// provide a true value for a font's
// x-height in its text metrics, so we
// approximate.
- font_x_height_ = static_cast<int>((static_cast<float>(font_ascent_ -
+ font_x_height_ = static_cast<int>((static_cast<float>(font_.baseline() -
tm.tmInternalLeading) * kXHeightRatio) + 0.5);
// The distance from the top of the field to the desired baseline of the
// rendered text.
const int kTextBaseline = popup_window_mode_ ? 15 : 18;
- font_y_adjustment_ = kTextBaseline - font_ascent_;
- font_descent_ = tm.tmDescent;
+ font_y_adjustment_ = kTextBaseline - font_.baseline();
// Get the number of twips per pixel, which we need below to offset our text
// by the desired number of pixels.
@@ -2131,10 +2129,10 @@ void AutocompleteEditViewWin::DrawSlashForInsecureScheme(
const int kAdditionalSpaceOutsideFont =
static_cast<int>(ceil(kStrokeWidthPixels * 1.5f));
const CRect scheme_rect(PosFromChar(insecure_scheme_component_.begin).x,
- font_top + font_ascent_ - font_x_height_ -
+ font_top + font_.baseline() - font_x_height_ -
kAdditionalSpaceOutsideFont,
PosFromChar(insecure_scheme_component_.end()).x,
- font_top + font_ascent_ +
+ font_top + font_.baseline() +
kAdditionalSpaceOutsideFont);
// Clip to the portion we care about and translate to canvas coordinates
@@ -2215,7 +2213,7 @@ void AutocompleteEditViewWin::DrawDropHighlight(
const CRect highlight_rect(highlight_x,
highlight_y,
highlight_x + 1,
- highlight_y + font_ascent_ + font_descent_);
+ highlight_y + font_.height());
// Clip the highlight to the region being painted.
CRect clip_rect;
@@ -2409,7 +2407,7 @@ void AutocompleteEditViewWin::RepaintDropHighlight(int position) {
if ((position != -1) && (position <= GetTextLength())) {
const POINT min_loc(PosFromChar(position));
const RECT highlight_bounds = {min_loc.x - 1, font_y_adjustment_,
- min_loc.x + 2, font_ascent_ + font_descent_ + font_y_adjustment_};
+ min_loc.x + 2, font_.height() + font_y_adjustment_};
InvalidateRect(&highlight_bounds, false);
}
}