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

Side by Side Diff: Source/core/css/CSSFontSelector.cpp

Issue 16415007: Cleanup usage of CSSPropertyID and CSSValueID inside Blink. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.cpp ('k') | Source/core/css/CSSGradientValue.cpp » ('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) 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
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 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return; 99 return;
100 100
101 CSSValueList* rangeList = toCSSValueList(unicodeRange.get()); 101 CSSValueList* rangeList = toCSSValueList(unicodeRange.get());
102 102
103 unsigned traitsMask = 0; 103 unsigned traitsMask = 0;
104 104
105 if (RefPtr<CSSValue> fontStyle = style->getPropertyCSSValue(CSSPropertyFontS tyle)) { 105 if (RefPtr<CSSValue> fontStyle = style->getPropertyCSSValue(CSSPropertyFontS tyle)) {
106 if (!fontStyle->isPrimitiveValue()) 106 if (!fontStyle->isPrimitiveValue())
107 return; 107 return;
108 108
109 switch (toCSSPrimitiveValue(fontStyle.get())->getIdent()) { 109 switch (toCSSPrimitiveValue(fontStyle.get())->getValueID()) {
110 case CSSValueNormal: 110 case CSSValueNormal:
111 traitsMask |= FontStyleNormalMask; 111 traitsMask |= FontStyleNormalMask;
112 break; 112 break;
113 case CSSValueItalic: 113 case CSSValueItalic:
114 case CSSValueOblique: 114 case CSSValueOblique:
115 traitsMask |= FontStyleItalicMask; 115 traitsMask |= FontStyleItalicMask;
116 break; 116 break;
117 default: 117 default:
118 break; 118 break;
119 } 119 }
120 } else 120 } else
121 traitsMask |= FontStyleNormalMask; 121 traitsMask |= FontStyleNormalMask;
122 122
123 if (RefPtr<CSSValue> fontWeight = style->getPropertyCSSValue(CSSPropertyFont Weight)) { 123 if (RefPtr<CSSValue> fontWeight = style->getPropertyCSSValue(CSSPropertyFont Weight)) {
124 if (!fontWeight->isPrimitiveValue()) 124 if (!fontWeight->isPrimitiveValue())
125 return; 125 return;
126 126
127 switch (toCSSPrimitiveValue(fontWeight.get())->getIdent()) { 127 switch (toCSSPrimitiveValue(fontWeight.get())->getValueID()) {
128 case CSSValueBold: 128 case CSSValueBold:
129 case CSSValue700: 129 case CSSValue700:
130 traitsMask |= FontWeight700Mask; 130 traitsMask |= FontWeight700Mask;
131 break; 131 break;
132 case CSSValueNormal: 132 case CSSValueNormal:
133 case CSSValue400: 133 case CSSValue400:
134 traitsMask |= FontWeight400Mask; 134 traitsMask |= FontWeight400Mask;
135 break; 135 break;
136 case CSSValue900: 136 case CSSValue900:
137 traitsMask |= FontWeight900Mask; 137 traitsMask |= FontWeight900Mask;
(...skipping 30 matching lines...) Expand all
168 fontVariant = list; 168 fontVariant = list;
169 } else if (!fontVariant->isValueList()) 169 } else if (!fontVariant->isValueList())
170 return; 170 return;
171 171
172 CSSValueList* variantList = toCSSValueList(fontVariant.get()); 172 CSSValueList* variantList = toCSSValueList(fontVariant.get());
173 unsigned numVariants = variantList->length(); 173 unsigned numVariants = variantList->length();
174 if (!numVariants) 174 if (!numVariants)
175 return; 175 return;
176 176
177 for (unsigned i = 0; i < numVariants; ++i) { 177 for (unsigned i = 0; i < numVariants; ++i) {
178 switch (toCSSPrimitiveValue(variantList->itemWithoutBoundsCheck(i))- >getIdent()) { 178 switch (toCSSPrimitiveValue(variantList->itemWithoutBoundsCheck(i))- >getValueID()) {
179 case CSSValueNormal: 179 case CSSValueNormal:
180 traitsMask |= FontVariantNormalMask; 180 traitsMask |= FontVariantNormalMask;
181 break; 181 break;
182 case CSSValueSmallCaps: 182 case CSSValueSmallCaps:
183 traitsMask |= FontVariantSmallCapsMask; 183 traitsMask |= FontVariantSmallCapsMask;
184 break; 184 break;
185 default: 185 default:
186 break; 186 break;
187 } 187 }
188 } 188 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 CSSUnicodeRangeValue* range = static_cast<CSSUnicodeRangeValue*>(ran geList->itemWithoutBoundsCheck(i)); 248 CSSUnicodeRangeValue* range = static_cast<CSSUnicodeRangeValue*>(ran geList->itemWithoutBoundsCheck(i));
249 fontFace->addRange(range->from(), range->to()); 249 fontFace->addRange(range->from(), range->to());
250 } 250 }
251 } 251 }
252 252
253 // Hash under every single family name. 253 // Hash under every single family name.
254 int familyLength = familyList->length(); 254 int familyLength = familyList->length();
255 for (int i = 0; i < familyLength; i++) { 255 for (int i = 0; i < familyLength; i++) {
256 CSSPrimitiveValue* item = toCSSPrimitiveValue(familyList->itemWithoutBou ndsCheck(i)); 256 CSSPrimitiveValue* item = toCSSPrimitiveValue(familyList->itemWithoutBou ndsCheck(i));
257 String familyName; 257 String familyName;
258 if (item->isString()) 258 if (item->isString()) {
259 familyName = item->getStringValue(); 259 familyName = item->getStringValue();
260 else if (item->isIdent()) { 260 } else if (item->isValueID()) {
261 // We need to use the raw text for all the generic family types, sin ce @font-face is a way of actually 261 // We need to use the raw text for all the generic family types, sin ce @font-face is a way of actually
262 // defining what font to use for those types. 262 // defining what font to use for those types.
263 switch (item->getIdent()) { 263 switch (item->getValueID()) {
264 case CSSValueSerif: 264 case CSSValueSerif:
265 familyName = serifFamily; 265 familyName = serifFamily;
266 break; 266 break;
267 case CSSValueSansSerif: 267 case CSSValueSansSerif:
268 familyName = sansSerifFamily; 268 familyName = sansSerifFamily;
269 break; 269 break;
270 case CSSValueCursive: 270 case CSSValueCursive:
271 familyName = cursiveFamily; 271 familyName = cursiveFamily;
272 break; 272 break;
273 case CSSValueFantasy: 273 case CSSValueFantasy:
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 } 597 }
598 // Ensure that if the request count reaches zero, the frame loader will know about it. 598 // Ensure that if the request count reaches zero, the frame loader will know about it.
599 cachedResourceLoader->loadDone(0); 599 cachedResourceLoader->loadDone(0);
600 // New font loads may be triggered by layout after the document load is comp lete but before we have dispatched 600 // New font loads may be triggered by layout after the document load is comp lete but before we have dispatched
601 // didFinishLoading for the frame. Make sure the delegate is always dispatch ed by checking explicitly. 601 // didFinishLoading for the frame. Make sure the delegate is always dispatch ed by checking explicitly.
602 if (m_document && m_document->frame()) 602 if (m_document && m_document->frame())
603 m_document->frame()->loader()->checkLoadComplete(); 603 m_document->frame()->loader()->checkLoadComplete();
604 } 604 }
605 605
606 } 606 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.cpp ('k') | Source/core/css/CSSGradientValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698