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

Unified Diff: chrome/browser/autocomplete/autocomplete_edit_view_win.cc

Issue 3083022: Rework gfx::Font by moving platform-specific code into inner classes.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/autocomplete_edit_view_win.cc
===================================================================
--- chrome/browser/autocomplete/autocomplete_edit_view_win.cc (revision 55911)
+++ chrome/browser/autocomplete/autocomplete_edit_view_win.cc (working copy)
@@ -429,7 +429,7 @@
Create(hwnd, 0, 0, 0, l10n_util::GetExtendedStyles());
SetReadOnly(popup_window_mode_);
- SetFont(font_.hfont());
+ SetFont(font_.GetNativeFont());
// NOTE: Do not use SetWordBreakProcEx() here, that is no longer supported as
// of Rich Edit 2.0 onward.
@@ -438,7 +438,7 @@
// Get the metrics for the font.
HDC dc = ::GetDC(NULL);
- SelectObject(dc, font_.hfont());
+ SelectObject(dc, font_.GetNativeFont());
TEXTMETRIC tm = {0};
GetTextMetrics(dc, &tm);
const float kXHeightRatio = 0.7f; // The ratio of a font's x-height to its
@@ -446,12 +446,12 @@
// 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_.baseline() -
+ font_x_height_ = static_cast<int>((static_cast<float>(font_.GetBaseline() -
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_.baseline();
+ font_y_adjustment_ = kTextBaseline - font_.GetBaseline();
// Get the number of twips per pixel, which we need below to offset our text
// by the desired number of pixels.
@@ -2149,10 +2149,10 @@
const int kAdditionalSpaceOutsideFont =
static_cast<int>(ceil(kStrokeWidthPixels * 1.5f));
const CRect scheme_rect(PosFromChar(insecure_scheme_component_.begin).x,
- font_top + font_.baseline() - font_x_height_ -
+ font_top + font_.GetBaseline() - font_x_height_ -
kAdditionalSpaceOutsideFont,
PosFromChar(insecure_scheme_component_.end()).x,
- font_top + font_.baseline() +
+ font_top + font_.GetBaseline() +
kAdditionalSpaceOutsideFont);
// Clip to the portion we care about and translate to canvas coordinates
@@ -2233,7 +2233,7 @@
const CRect highlight_rect(highlight_x,
highlight_y,
highlight_x + 1,
- highlight_y + font_.height());
+ highlight_y + font_.GetHeight());
// Clip the highlight to the region being painted.
CRect clip_rect;
@@ -2430,7 +2430,7 @@
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_.height() + font_y_adjustment_};
+ min_loc.x + 2, font_.GetHeight() + font_y_adjustment_};
InvalidateRect(&highlight_bounds, false);
}
}
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_mac.mm ('k') | chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698