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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/Font.h

Issue 2416033003: Remove unsafe getFontMetrics methods (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Holger Hans Peter Freyther 6 * Copyright (C) 2008 Holger Hans Peter Freyther
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 int h, 116 int h,
117 int from = 0, 117 int from = 0,
118 int to = -1, 118 int to = -1,
119 bool accountForGlyphBounds = false) const; 119 bool accountForGlyphBounds = false) const;
120 CharacterRange getCharacterRange(const TextRun&, 120 CharacterRange getCharacterRange(const TextRun&,
121 unsigned from, 121 unsigned from,
122 unsigned to) const; 122 unsigned to) const;
123 Vector<CharacterRange> individualCharacterRanges(const TextRun&) const; 123 Vector<CharacterRange> individualCharacterRanges(const TextRun&) const;
124 124
125 // Metrics that we query the FontFallbackList for. 125 // Metrics that we query the FontFallbackList for.
126 const FontMetrics& getFontMetrics() const {
wkorman 2016/10/13 22:54:31 Suggest adding documentation to Font::primaryFont(
eae 2016/10/13 23:09:58 Done, thank you.
127 RELEASE_ASSERT(primaryFont());
128 return primaryFont()->getFontMetrics();
129 }
130 float spaceWidth() const { 126 float spaceWidth() const {
131 return primaryFont()->spaceWidth() + getFontDescription().letterSpacing(); 127 return primaryFont()->spaceWidth() + getFontDescription().letterSpacing();
132 } 128 }
133 float tabWidth(const SimpleFontData&, const TabSize&, float position) const; 129 float tabWidth(const SimpleFontData&, const TabSize&, float position) const;
134 float tabWidth(const TabSize& tabSize, float position) const { 130 float tabWidth(const TabSize& tabSize, float position) const {
135 return tabWidth(*primaryFont(), tabSize, position); 131 return tabWidth(*primaryFont(), tabSize, position);
136 } 132 }
137 133
138 int emphasisMarkAscent(const AtomicString&) const; 134 int emphasisMarkAscent(const AtomicString&) const;
139 int emphasisMarkDescent(const AtomicString&) const; 135 int emphasisMarkDescent(const AtomicString&) const;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // advance an additional tab stop. 253 // advance an additional tab stop.
258 if (distanceToTabStop < fontData.spaceWidth() / 2) 254 if (distanceToTabStop < fontData.spaceWidth() / 2)
259 distanceToTabStop += baseTabWidth; 255 distanceToTabStop += baseTabWidth;
260 256
261 return distanceToTabStop; 257 return distanceToTabStop;
262 } 258 }
263 259
264 } // namespace blink 260 } // namespace blink
265 261
266 #endif 262 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698