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

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

Issue 2366243002: Remove all ordering requirements in CSSValueKeywords.in (WIP) (Closed)
Patch Set: Some mor efixes Created 4 years, 1 month 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) 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. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 float zoomFactor, 44 float zoomFactor,
45 bool isAbsoluteSize, 45 bool isAbsoluteSize,
46 float specifiedSize, 46 float specifiedSize,
47 ESmartMinimumForFontSize = UseSmartMinimumForFontSize); 47 ESmartMinimumForFontSize = UseSmartMinimumForFontSize);
48 48
49 // Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this 49 // Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this
50 // function returns 50 // function returns
51 // values from '1' to '8'. 51 // values from '1' to '8'.
52 static unsigned keywordSize(CSSValueID valueID) { 52 static unsigned keywordSize(CSSValueID valueID) {
53 ASSERT(isValidValueID(valueID)); 53 ASSERT(isValidValueID(valueID));
54 return valueID - CSSValueXxSmall + 1; 54 switch (valueID) {
55 case CSSValueXxSmall:
56 return 1;
57 case CSSValueXSmall:
58 return 2;
59 case CSSValueSmall:
60 return 3;
61 case CSSValueMedium:
62 return 4;
63 case CSSValueLarge:
64 return 5;
65 case CSSValueXLarge:
66 return 6;
67 case CSSValueXxLarge:
68 return 7;
69 case CSSValueWebkitXxxLarge:
70 return 8;
71 default:
72 NOTREACHED();
73 return 1;
74 }
55 } 75 }
56 76
57 static bool isValidValueID(CSSValueID valueID) { 77 static bool isValidValueID(CSSValueID valueID) {
58 return valueID >= CSSValueXxSmall && valueID <= CSSValueWebkitXxxLarge; 78 return valueID == CSSValueXxSmall || valueID == CSSValueXSmall || valueID == CSSValueSmall || valueID == CSSValueMedium || valueID == CSSValueLarge || value ID == CSSValueXLarge || valueID == CSSValueXxLarge || valueID == CSSValueWebkitX xxLarge;
59 } 79 }
60 80
61 static CSSValueID initialValueID() { return CSSValueMedium; } 81 static CSSValueID initialValueID() { return CSSValueMedium; }
62 static unsigned initialKeywordSize() { return keywordSize(initialValueID()); } 82 static unsigned initialKeywordSize() { return keywordSize(initialValueID()); }
63 83
64 // Given a keyword size in the range (1 to 8), this function will return 84 // Given a keyword size in the range (1 to 8), this function will return
65 // the correct font size scaled relative to the user's default (4). 85 // the correct font size scaled relative to the user's default (4).
66 static float fontSizeForKeyword(const Document*, 86 static float fontSizeForKeyword(const Document*,
67 unsigned keyword, 87 unsigned keyword,
68 bool isMonospace); 88 bool isMonospace);
69 89
70 // Given a font size in pixel, this function will return legacy font size 90 // Given a font size in pixel, this function will return legacy font size
71 // between 1 and 7. 91 // between 1 and 7.
72 static int legacyFontSize(const Document*, 92 static int legacyFontSize(const Document*,
73 int pixelFontSize, 93 int pixelFontSize,
74 bool isMonospace); 94 bool isMonospace);
75 }; 95 };
76 96
77 } // namespace blink 97 } // namespace blink
78 98
79 #endif // FontSize_h 99 #endif // FontSize_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp ('k') | third_party/WebKit/Source/core/css/StyleColor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698