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

Side by Side Diff: Source/core/css/FontSize.h

Issue 1304623002: Make blink classes and structures in core/css fast-allocated (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing (Fixed windows compile error) Created 5 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 unified diff | Download patch
« no previous file with comments | « Source/core/css/FontFaceSet.h ('k') | Source/core/css/HashTools.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 * 19 *
20 */ 20 */
21 21
22 #ifndef FontSize_h 22 #ifndef FontSize_h
23 #define FontSize_h 23 #define FontSize_h
24 24
25 #include "core/CSSValueKeywords.h" 25 #include "core/CSSValueKeywords.h"
26 #include "wtf/Allocator.h"
26 27
27 namespace blink { 28 namespace blink {
28 29
29 class Document; 30 class Document;
30 31
31 enum ESmartMinimumForFontSize { DoNotUseSmartMinimumForFontSize, UseSmartMinimum ForFontFize }; 32 enum ESmartMinimumForFontSize { DoNotUseSmartMinimumForFontSize, UseSmartMinimum ForFontFize };
32 33
33 class FontSize { 34 class FontSize {
34 private: 35 STATIC_ONLY(FontSize);
35 FontSize()
36 {
37 }
38
39 public: 36 public:
40 static float getComputedSizeFromSpecifiedSize(const Document*, float zoomFac tor, bool isAbsoluteSize, float specifiedSize, ESmartMinimumForFontSize = UseSma rtMinimumForFontFize); 37 static float getComputedSizeFromSpecifiedSize(const Document*, float zoomFac tor, bool isAbsoluteSize, float specifiedSize, ESmartMinimumForFontSize = UseSma rtMinimumForFontFize);
41 38
42 // Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this fu nction returns 39 // Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this fu nction returns
43 // values from '1' to '8'. 40 // values from '1' to '8'.
44 static unsigned keywordSize(CSSValueID valueID) 41 static unsigned keywordSize(CSSValueID valueID)
45 { 42 {
46 ASSERT(valueID >= CSSValueXxSmall && valueID <= CSSValueWebkitXxxLarge); 43 ASSERT(valueID >= CSSValueXxSmall && valueID <= CSSValueWebkitXxxLarge);
47 return valueID - CSSValueXxSmall + 1; 44 return valueID - CSSValueXxSmall + 1;
48 } 45 }
49 46
50 static unsigned initialKeywordSize() { return 4; } // CSSValueMedium 47 static unsigned initialKeywordSize() { return 4; } // CSSValueMedium
51 48
52 // Given a keyword size in the range (1 to 8), this function will return 49 // Given a keyword size in the range (1 to 8), this function will return
53 // the correct font size scaled relative to the user's default (4). 50 // the correct font size scaled relative to the user's default (4).
54 static float fontSizeForKeyword(const Document*, unsigned keyword, bool isMo nospace); 51 static float fontSizeForKeyword(const Document*, unsigned keyword, bool isMo nospace);
55 52
56 // Given a font size in pixel, this function will return legacy font size be tween 1 and 7. 53 // Given a font size in pixel, this function will return legacy font size be tween 1 and 7.
57 static int legacyFontSize(const Document*, int pixelFontSize, bool isMonospa ce); 54 static int legacyFontSize(const Document*, int pixelFontSize, bool isMonospa ce);
58 }; 55 };
59 56
60 } // namespace blink 57 } // namespace blink
61 58
62 #endif // FontSize_h 59 #endif // FontSize_h
OLDNEW
« no previous file with comments | « Source/core/css/FontFaceSet.h ('k') | Source/core/css/HashTools.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698