| OLD | NEW |
| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 exceptionState->throwDOMException(SyntaxError, message); | 235 exceptionState->throwDOMException(SyntaxError, message); |
| 236 else | 236 else |
| 237 setError(DOMException::create(SyntaxError, message)); | 237 setError(DOMException::create(SyntaxError, message)); |
| 238 } | 238 } |
| 239 | 239 |
| 240 bool FontFace::setPropertyFromStyle(const StylePropertySet& properties, CSSPrope
rtyID propertyID) | 240 bool FontFace::setPropertyFromStyle(const StylePropertySet& properties, CSSPrope
rtyID propertyID) |
| 241 { | 241 { |
| 242 return setPropertyValue(properties.getPropertyCSSValue(propertyID), property
ID); | 242 return setPropertyValue(properties.getPropertyCSSValue(propertyID), property
ID); |
| 243 } | 243 } |
| 244 | 244 |
| 245 bool FontFace::setPropertyValue(NullableCSSValue value, CSSPropertyID propertyID
) | 245 bool FontFace::setPropertyValue(const NullableCSSValue& value, CSSPropertyID pro
pertyID) |
| 246 { | 246 { |
| 247 switch (propertyID) { | 247 switch (propertyID) { |
| 248 case CSSPropertyFontStyle: | 248 case CSSPropertyFontStyle: |
| 249 m_style = value; | 249 m_style = value; |
| 250 break; | 250 break; |
| 251 case CSSPropertyFontWeight: | 251 case CSSPropertyFontWeight: |
| 252 m_weight = value; | 252 m_weight = value; |
| 253 break; | 253 break; |
| 254 case CSSPropertyFontStretch: | 254 case CSSPropertyFontStretch: |
| 255 m_stretch = value; | 255 m_stretch = value; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 271 } | 271 } |
| 272 return true; | 272 return true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 bool FontFace::setFamilyValue(CSSValueList* familyList) | 275 bool FontFace::setFamilyValue(CSSValueList* familyList) |
| 276 { | 276 { |
| 277 // The font-family descriptor has to have exactly one family name. | 277 // The font-family descriptor has to have exactly one family name. |
| 278 if (familyList->length() != 1) | 278 if (familyList->length() != 1) |
| 279 return false; | 279 return false; |
| 280 | 280 |
| 281 CSSPrimitiveValue familyValue = toCSSPrimitiveValue(familyList->item(0)); | 281 const CSSPrimitiveValue& familyValue = toCSSPrimitiveValue(familyList->item(
0)); |
| 282 AtomicString family; | 282 AtomicString family; |
| 283 if (familyValue.isCustomIdent()) { | 283 if (familyValue.isCustomIdent()) { |
| 284 family = AtomicString(familyValue.getStringValue()); | 284 family = AtomicString(familyValue.getStringValue()); |
| 285 } else if (familyValue.isValueID()) { | 285 } else if (familyValue.isValueID()) { |
| 286 // We need to use the raw text for all the generic family types, since @
font-face is a way of actually | 286 // We need to use the raw text for all the generic family types, since @
font-face is a way of actually |
| 287 // defining what font to use for those types. | 287 // defining what font to use for those types. |
| 288 switch (familyValue.getValueID()) { | 288 switch (familyValue.getValueID()) { |
| 289 case CSSValueSerif: | 289 case CSSValueSerif: |
| 290 family = FontFamilyNames::webkit_serif; | 290 family = FontFamilyNames::webkit_serif; |
| 291 break; | 291 break; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 unsigned numRanges = rangeList->length(); | 504 unsigned numRanges = rangeList->length(); |
| 505 for (unsigned i = 0; i < numRanges; i++) { | 505 for (unsigned i = 0; i < numRanges; i++) { |
| 506 CSSUnicodeRangeValue& range = toCSSUnicodeRangeValue(rangeList->item
(i)); | 506 CSSUnicodeRangeValue& range = toCSSUnicodeRangeValue(rangeList->item
(i)); |
| 507 ranges.append(CSSFontFace::UnicodeRange(range.from(), range.to())); | 507 ranges.append(CSSFontFace::UnicodeRange(range.from(), range.to())); |
| 508 } | 508 } |
| 509 } | 509 } |
| 510 | 510 |
| 511 return adoptPtrWillBeNoop(new CSSFontFace(fontFace, ranges)); | 511 return adoptPtrWillBeNoop(new CSSFontFace(fontFace, ranges)); |
| 512 } | 512 } |
| 513 | 513 |
| 514 void FontFace::initCSSFontFace(Document* document, CSSValue src) | 514 void FontFace::initCSSFontFace(Document* document, const CSSValue& src) |
| 515 { | 515 { |
| 516 m_cssFontFace = createCSSFontFace(this, m_unicodeRange); | 516 m_cssFontFace = createCSSFontFace(this, m_unicodeRange); |
| 517 if (m_error) | 517 if (m_error) |
| 518 return; | 518 return; |
| 519 | 519 |
| 520 // Each item in the src property's list is a single CSSFontFaceSource. Put t
hem all into a CSSFontFace. | 520 // Each item in the src property's list is a single CSSFontFaceSource. Put t
hem all into a CSSFontFace. |
| 521 ASSERT(src.isValueList()); | 521 ASSERT(src.isValueList()); |
| 522 CSSValueList& srcList = toCSSValueList(src); | 522 CSSValueList& srcList = toCSSValueList(src); |
| 523 int srcLength = srcList.length(); | 523 int srcLength = srcList.length(); |
| 524 | 524 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 { | 581 { |
| 582 return m_cssFontFace->hadBlankText(); | 582 return m_cssFontFace->hadBlankText(); |
| 583 } | 583 } |
| 584 | 584 |
| 585 bool FontFace::hasPendingActivity() const | 585 bool FontFace::hasPendingActivity() const |
| 586 { | 586 { |
| 587 return m_status == Loading && executionContext() && !executionContext()->act
iveDOMObjectsAreStopped(); | 587 return m_status == Loading && executionContext() && !executionContext()->act
iveDOMObjectsAreStopped(); |
| 588 } | 588 } |
| 589 | 589 |
| 590 } // namespace blink | 590 } // namespace blink |
| OLD | NEW |