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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 2005, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Alexey Proskuryakov 3 * Copyright (C) 2006 Alexey Proskuryakov
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 150
151 #if OS(MACOSX) 151 #if OS(MACOSX)
152 // We are preserving this ascent hack to match Safari's ascent adjustment 152 // We are preserving this ascent hack to match Safari's ascent adjustment
153 // in their SimpleFontDataMac.mm, for details see crbug.com/445830. 153 // in their SimpleFontDataMac.mm, for details see crbug.com/445830.
154 // We need to adjust Times, Helvetica, and Courier to closely match the 154 // We need to adjust Times, Helvetica, and Courier to closely match the
155 // vertical metrics of their Microsoft counterparts that are the de facto 155 // vertical metrics of their Microsoft counterparts that are the de facto
156 // web standard. The AppKit adjustment of 20% is too big and is 156 // web standard. The AppKit adjustment of 20% is too big and is
157 // incorrectly added to line spacing, so we use a 15% adjustment instead 157 // incorrectly added to line spacing, so we use a 15% adjustment instead
158 // and add it to the ascent. 158 // and add it to the ascent.
159 DEFINE_STATIC_LOCAL(AtomicString, timesName, ("Times", AtomicString::Constru ctFromLiteral)); 159 DEFINE_STATIC_LOCAL(AtomicString, timesName, ("Times"));
160 DEFINE_STATIC_LOCAL(AtomicString, helveticaName, ("Helvetica", AtomicString: :ConstructFromLiteral)); 160 DEFINE_STATIC_LOCAL(AtomicString, helveticaName, ("Helvetica"));
161 DEFINE_STATIC_LOCAL(AtomicString, courierName, ("Courier", AtomicString::Con structFromLiteral)); 161 DEFINE_STATIC_LOCAL(AtomicString, courierName, ("Courier"));
162 String familyName = m_platformData.fontFamilyName(); 162 String familyName = m_platformData.fontFamilyName();
163 if (familyName == timesName || familyName == helveticaName || familyName == courierName) 163 if (familyName == timesName || familyName == helveticaName || familyName == courierName)
164 ascent += floorf(((ascent + descent) * 0.15f) + 0.5f); 164 ascent += floorf(((ascent + descent) * 0.15f) + 0.5f);
165 #endif 165 #endif
166 166
167 m_fontMetrics.setAscent(ascent); 167 m_fontMetrics.setAscent(ascent);
168 m_fontMetrics.setDescent(descent); 168 m_fontMetrics.setDescent(descent);
169 169
170 float xHeight; 170 float xHeight;
171 if (metrics.fXHeight) { 171 if (metrics.fXHeight) {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 if (glyphs[i]) { 447 if (glyphs[i]) {
448 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this); 448 pageToFill->setGlyphDataForIndex(offset + i, glyphs[i], this);
449 haveGlyphs = true; 449 haveGlyphs = true;
450 } 450 }
451 } 451 }
452 452
453 return haveGlyphs; 453 return haveGlyphs;
454 } 454 }
455 455
456 } // namespace blink 456 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698