| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 loadInternal(context); | 406 loadInternal(context); |
| 407 addCallback(callback); | 407 addCallback(callback); |
| 408 } | 408 } |
| 409 | 409 |
| 410 void FontFace::addCallback(LoadFontCallback* callback) { | 410 void FontFace::addCallback(LoadFontCallback* callback) { |
| 411 if (m_status == Loaded) | 411 if (m_status == Loaded) |
| 412 callback->notifyLoaded(this); | 412 callback->notifyLoaded(this); |
| 413 else if (m_status == Error) | 413 else if (m_status == Error) |
| 414 callback->notifyError(this); | 414 callback->notifyError(this); |
| 415 else | 415 else |
| 416 m_callbacks.append(callback); | 416 m_callbacks.push_back(callback); |
| 417 } | 417 } |
| 418 | 418 |
| 419 void FontFace::loadInternal(ExecutionContext* context) { | 419 void FontFace::loadInternal(ExecutionContext* context) { |
| 420 if (m_status != Unloaded) | 420 if (m_status != Unloaded) |
| 421 return; | 421 return; |
| 422 | 422 |
| 423 m_cssFontFace->load(); | 423 m_cssFontFace->load(); |
| 424 } | 424 } |
| 425 | 425 |
| 426 FontTraits FontFace::traits() const { | 426 FontTraits FontFace::traits() const { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 } | 556 } |
| 557 | 557 |
| 558 static CSSFontFace* createCSSFontFace(FontFace* fontFace, | 558 static CSSFontFace* createCSSFontFace(FontFace* fontFace, |
| 559 const CSSValue* unicodeRange) { | 559 const CSSValue* unicodeRange) { |
| 560 Vector<UnicodeRange> ranges; | 560 Vector<UnicodeRange> ranges; |
| 561 if (const CSSValueList* rangeList = toCSSValueList(unicodeRange)) { | 561 if (const CSSValueList* rangeList = toCSSValueList(unicodeRange)) { |
| 562 unsigned numRanges = rangeList->length(); | 562 unsigned numRanges = rangeList->length(); |
| 563 for (unsigned i = 0; i < numRanges; i++) { | 563 for (unsigned i = 0; i < numRanges; i++) { |
| 564 const CSSUnicodeRangeValue& range = | 564 const CSSUnicodeRangeValue& range = |
| 565 toCSSUnicodeRangeValue(rangeList->item(i)); | 565 toCSSUnicodeRangeValue(rangeList->item(i)); |
| 566 ranges.append(UnicodeRange(range.from(), range.to())); | 566 ranges.push_back(UnicodeRange(range.from(), range.to())); |
| 567 } | 567 } |
| 568 } | 568 } |
| 569 | 569 |
| 570 return new CSSFontFace(fontFace, ranges); | 570 return new CSSFontFace(fontFace, ranges); |
| 571 } | 571 } |
| 572 | 572 |
| 573 void FontFace::initCSSFontFace(Document* document, const CSSValue* src) { | 573 void FontFace::initCSSFontFace(Document* document, const CSSValue* src) { |
| 574 m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get()); | 574 m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get()); |
| 575 if (m_error) | 575 if (m_error) |
| 576 return; | 576 return; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 bool FontFace::hadBlankText() const { | 650 bool FontFace::hadBlankText() const { |
| 651 return m_cssFontFace->hadBlankText(); | 651 return m_cssFontFace->hadBlankText(); |
| 652 } | 652 } |
| 653 | 653 |
| 654 bool FontFace::hasPendingActivity() const { | 654 bool FontFace::hasPendingActivity() const { |
| 655 return m_status == Loading && getExecutionContext() && | 655 return m_status == Loading && getExecutionContext() && |
| 656 !getExecutionContext()->isContextDestroyed(); | 656 !getExecutionContext()->isContextDestroyed(); |
| 657 } | 657 } |
| 658 | 658 |
| 659 } // namespace blink | 659 } // namespace blink |
| OLD | NEW |