OLD | NEW |
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, |
(...skipping 11 matching lines...) Expand all Loading... |
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 #include "wtf/Allocator.h" |
27 | 27 |
28 namespace blink { | 28 namespace blink { |
29 | 29 |
30 class Document; | 30 class Document; |
31 | 31 |
32 enum ESmartMinimumForFontSize { DoNotUseSmartMinimumForFontSize, UseSmartMinimum
ForFontFize }; | 32 enum ESmartMinimumForFontSize { DoNotUseSmartMinimumForFontSize, UseSmartMinimum
ForFontSize }; |
33 | 33 |
34 class FontSize { | 34 class FontSize { |
35 STATIC_ONLY(FontSize); | 35 STATIC_ONLY(FontSize); |
36 public: | 36 public: |
37 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
rtMinimumForFontSize); |
38 | 38 |
39 // 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 |
40 // values from '1' to '8'. | 40 // values from '1' to '8'. |
41 static unsigned keywordSize(CSSValueID valueID) | 41 static unsigned keywordSize(CSSValueID valueID) |
42 { | 42 { |
43 ASSERT(valueID >= CSSValueXxSmall && valueID <= CSSValueWebkitXxxLarge); | 43 ASSERT(valueID >= CSSValueXxSmall && valueID <= CSSValueWebkitXxxLarge); |
44 return valueID - CSSValueXxSmall + 1; | 44 return valueID - CSSValueXxSmall + 1; |
45 } | 45 } |
46 | 46 |
47 static unsigned initialKeywordSize() { return 4; } // CSSValueMedium | 47 static unsigned initialKeywordSize() { return 4; } // CSSValueMedium |
48 | 48 |
49 // 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 |
50 // 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). |
51 static float fontSizeForKeyword(const Document*, unsigned keyword, bool isMo
nospace); | 51 static float fontSizeForKeyword(const Document*, unsigned keyword, bool isMo
nospace); |
52 | 52 |
53 // 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. |
54 static int legacyFontSize(const Document*, int pixelFontSize, bool isMonospa
ce); | 54 static int legacyFontSize(const Document*, int pixelFontSize, bool isMonospa
ce); |
55 }; | 55 }; |
56 | 56 |
57 } // namespace blink | 57 } // namespace blink |
58 | 58 |
59 #endif // FontSize_h | 59 #endif // FontSize_h |
OLD | NEW |