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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 toDocument(context)->styleEngine().fontSelector()->fontLoader()->loadPending
Fonts(); | 398 toDocument(context)->styleEngine().fontSelector()->fontLoader()->loadPending
Fonts(); |
399 } | 399 } |
400 | 400 |
401 FontTraits FontFace::traits() const | 401 FontTraits FontFace::traits() const |
402 { | 402 { |
403 FontStyle style = FontStyleNormal; | 403 FontStyle style = FontStyleNormal; |
404 if (m_style) { | 404 if (m_style) { |
405 if (!m_style->isPrimitiveValue()) | 405 if (!m_style->isPrimitiveValue()) |
406 return 0; | 406 return 0; |
407 | 407 |
408 switch (toCSSPrimitiveValue(m_style)->getValueID()) { | 408 switch (toCSSPrimitiveValue(*m_style).getValueID()) { |
409 case CSSValueNormal: | 409 case CSSValueNormal: |
410 style = FontStyleNormal; | 410 style = FontStyleNormal; |
411 break; | 411 break; |
412 case CSSValueItalic: | 412 case CSSValueItalic: |
413 case CSSValueOblique: | 413 case CSSValueOblique: |
414 style = FontStyleItalic; | 414 style = FontStyleItalic; |
415 break; | 415 break; |
416 default: | 416 default: |
417 break; | 417 break; |
418 } | 418 } |
419 } | 419 } |
420 | 420 |
421 FontWeight weight = FontWeight400; | 421 FontWeight weight = FontWeight400; |
422 if (m_weight) { | 422 if (m_weight) { |
423 if (!m_weight->isPrimitiveValue()) | 423 if (!m_weight->isPrimitiveValue()) |
424 return 0; | 424 return 0; |
425 | 425 |
426 switch (toCSSPrimitiveValue(m_weight)->getValueID()) { | 426 switch (toCSSPrimitiveValue(*m_weight).getValueID()) { |
427 case CSSValueBold: | 427 case CSSValueBold: |
428 case CSSValue700: | 428 case CSSValue700: |
429 weight = FontWeight700; | 429 weight = FontWeight700; |
430 break; | 430 break; |
431 case CSSValueNormal: | 431 case CSSValueNormal: |
432 case CSSValue400: | 432 case CSSValue400: |
433 weight = FontWeight400; | 433 weight = FontWeight400; |
434 break; | 434 break; |
435 case CSSValue900: | 435 case CSSValue900: |
436 weight = FontWeight900; | 436 weight = FontWeight900; |
(...skipping 144 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 |