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

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

Issue 100463004: Make calls to AtomicString(const String&) explicit in css/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make MediaQuery::mediaType() return an AtomicString Created 7 years 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 static PassRefPtr<CSSValue> parseCSSValue(const String& s, CSSPropertyID propert yID) 92 static PassRefPtr<CSSValue> parseCSSValue(const String& s, CSSPropertyID propert yID)
93 { 93 {
94 if (s.isEmpty()) 94 if (s.isEmpty())
95 return 0; 95 return 0;
96 RefPtr<MutableStylePropertySet> parsedStyle = MutableStylePropertySet::creat e(); 96 RefPtr<MutableStylePropertySet> parsedStyle = MutableStylePropertySet::creat e();
97 CSSParser::parseValue(parsedStyle.get(), propertyID, s, true, HTMLStandardMo de, 0); 97 CSSParser::parseValue(parsedStyle.get(), propertyID, s, true, HTMLStandardMo de, 0);
98 return parsedStyle->getPropertyCSSValue(propertyID); 98 return parsedStyle->getPropertyCSSValue(propertyID);
99 } 99 }
100 100
101 PassRefPtr<FontFace> FontFace::create(const String& family, const String& source , const Dictionary& descriptors, ExceptionState& exceptionState) 101 PassRefPtr<FontFace> FontFace::create(const AtomicString& family, const String& source, const Dictionary& descriptors, ExceptionState& exceptionState)
102 { 102 {
103 RefPtr<CSSValue> src = parseCSSValue(source, CSSPropertySrc); 103 RefPtr<CSSValue> src = parseCSSValue(source, CSSPropertySrc);
104 if (!src || !src->isValueList()) { 104 if (!src || !src->isValueList()) {
105 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError); 105 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
106 return 0; 106 return 0;
107 } 107 }
108 108
109 RefPtr<FontFace> fontFace = adoptRef<FontFace>(new FontFace(src)); 109 RefPtr<FontFace> fontFace = adoptRef<FontFace>(new FontFace(src));
110 fontFace->setFamily(family, exceptionState); 110 fontFace->setFamily(family, exceptionState);
111 if (exceptionState.hadException()) 111 if (exceptionState.hadException())
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return true; 284 return true;
285 } 285 }
286 286
287 bool FontFace::setFamilyValue(CSSValueList* familyList) 287 bool FontFace::setFamilyValue(CSSValueList* familyList)
288 { 288 {
289 // The font-family descriptor has to have exactly one family name. 289 // The font-family descriptor has to have exactly one family name.
290 if (familyList->length() != 1) 290 if (familyList->length() != 1)
291 return false; 291 return false;
292 292
293 CSSPrimitiveValue* familyValue = toCSSPrimitiveValue(familyList->itemWithout BoundsCheck(0)); 293 CSSPrimitiveValue* familyValue = toCSSPrimitiveValue(familyList->itemWithout BoundsCheck(0));
294 String family; 294 AtomicString family;
295 if (familyValue->isString()) { 295 if (familyValue->isString()) {
296 family = familyValue->getStringValue(); 296 family = AtomicString(familyValue->getStringValue());
297 } else if (familyValue->isValueID()) { 297 } else if (familyValue->isValueID()) {
298 // We need to use the raw text for all the generic family types, since @ font-face is a way of actually 298 // We need to use the raw text for all the generic family types, since @ font-face is a way of actually
299 // defining what font to use for those types. 299 // defining what font to use for those types.
300 switch (familyValue->getValueID()) { 300 switch (familyValue->getValueID()) {
301 case CSSValueSerif: 301 case CSSValueSerif:
302 family = FontFamilyNames::webkit_serif; 302 family = FontFamilyNames::webkit_serif;
303 break; 303 break;
304 case CSSValueSansSerif: 304 case CSSValueSansSerif:
305 family = FontFamilyNames::webkit_sans_serif; 305 family = FontFamilyNames::webkit_sans_serif;
306 break; 306 break;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 unsigned numRanges = rangeList->length(); 531 unsigned numRanges = rangeList->length();
532 for (unsigned i = 0; i < numRanges; i++) { 532 for (unsigned i = 0; i < numRanges; i++) {
533 CSSUnicodeRangeValue* range = toCSSUnicodeRangeValue(rangeList->item WithoutBoundsCheck(i)); 533 CSSUnicodeRangeValue* range = toCSSUnicodeRangeValue(rangeList->item WithoutBoundsCheck(i));
534 cssFontFace->ranges().add(range->from(), range->to()); 534 cssFontFace->ranges().add(range->from(), range->to());
535 } 535 }
536 } 536 }
537 return cssFontFace; 537 return cssFontFace;
538 } 538 }
539 539
540 } // namespace WebCore 540 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698