| 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 } | 530 } |
| 531 return FontDisplayAuto; | 531 return FontDisplayAuto; |
| 532 } | 532 } |
| 533 | 533 |
| 534 static CSSFontFace* createCSSFontFace(FontFace* fontFace, CSSValue* unicodeRange
) | 534 static CSSFontFace* createCSSFontFace(FontFace* fontFace, CSSValue* unicodeRange
) |
| 535 { | 535 { |
| 536 Vector<UnicodeRange> ranges; | 536 Vector<UnicodeRange> ranges; |
| 537 if (CSSValueList* rangeList = toCSSValueList(unicodeRange)) { | 537 if (CSSValueList* rangeList = toCSSValueList(unicodeRange)) { |
| 538 unsigned numRanges = rangeList->length(); | 538 unsigned numRanges = rangeList->length(); |
| 539 for (unsigned i = 0; i < numRanges; i++) { | 539 for (unsigned i = 0; i < numRanges; i++) { |
| 540 CSSUnicodeRangeValue* range = toCSSUnicodeRangeValue(rangeList->item
(i)); | 540 const CSSUnicodeRangeValue* range = toCSSUnicodeRangeValue(rangeList
->item(i)); |
| 541 ranges.append(UnicodeRange(range->from(), range->to())); | 541 ranges.append(UnicodeRange(range->from(), range->to())); |
| 542 } | 542 } |
| 543 } | 543 } |
| 544 | 544 |
| 545 return new CSSFontFace(fontFace, ranges); | 545 return new CSSFontFace(fontFace, ranges); |
| 546 } | 546 } |
| 547 | 547 |
| 548 void FontFace::initCSSFontFace(Document* document, CSSValue* src) | 548 void FontFace::initCSSFontFace(Document* document, CSSValue* src) |
| 549 { | 549 { |
| 550 m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get()); | 550 m_cssFontFace = createCSSFontFace(this, m_unicodeRange.get()); |
| 551 if (m_error) | 551 if (m_error) |
| 552 return; | 552 return; |
| 553 | 553 |
| 554 // Each item in the src property's list is a single CSSFontFaceSource. Put t
hem all into a CSSFontFace. | 554 // Each item in the src property's list is a single CSSFontFaceSource. Put t
hem all into a CSSFontFace. |
| 555 ASSERT(src); | 555 ASSERT(src); |
| 556 ASSERT(src->isValueList()); | 556 ASSERT(src->isValueList()); |
| 557 CSSValueList* srcList = toCSSValueList(src); | 557 CSSValueList* srcList = toCSSValueList(src); |
| 558 int srcLength = srcList->length(); | 558 int srcLength = srcList->length(); |
| 559 | 559 |
| 560 for (int i = 0; i < srcLength; i++) { | 560 for (int i = 0; i < srcLength; i++) { |
| 561 // An item in the list either specifies a string (local font name) or a
URL (remote font to download). | 561 // An item in the list either specifies a string (local font name) or a
URL (remote font to download). |
| 562 CSSFontFaceSrcValue* item = toCSSFontFaceSrcValue(srcList->item(i)); | 562 const CSSFontFaceSrcValue* item = toCSSFontFaceSrcValue(srcList->item(i)
); |
| 563 CSSFontFaceSource* source = nullptr; | 563 CSSFontFaceSource* source = nullptr; |
| 564 | 564 |
| 565 if (!item->isLocal()) { | 565 if (!item->isLocal()) { |
| 566 const Settings* settings = document ? document->settings() : nullptr
; | 566 const Settings* settings = document ? document->settings() : nullptr
; |
| 567 bool allowDownloading = settings && settings->downloadableBinaryFont
sEnabled(); | 567 bool allowDownloading = settings && settings->downloadableBinaryFont
sEnabled(); |
| 568 if (allowDownloading && item->isSupportedFormat() && document) { | 568 if (allowDownloading && item->isSupportedFormat() && document) { |
| 569 FontResource* fetched = item->fetch(document); | 569 FontResource* fetched = item->fetch(document); |
| 570 if (fetched) { | 570 if (fetched) { |
| 571 CSSFontSelector* fontSelector = document->styleEngine().font
Selector(); | 571 CSSFontSelector* fontSelector = document->styleEngine().font
Selector(); |
| 572 source = new RemoteFontFaceSource(fetched, fontSelector, CSS
ValueToFontDisplay(m_display.get())); | 572 source = new RemoteFontFaceSource(fetched, fontSelector, CSS
ValueToFontDisplay(m_display.get())); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 { | 621 { |
| 622 return m_cssFontFace->hadBlankText(); | 622 return m_cssFontFace->hadBlankText(); |
| 623 } | 623 } |
| 624 | 624 |
| 625 bool FontFace::hasPendingActivity() const | 625 bool FontFace::hasPendingActivity() const |
| 626 { | 626 { |
| 627 return m_status == Loading && getExecutionContext() && !getExecutionContext(
)->activeDOMObjectsAreStopped(); | 627 return m_status == Loading && getExecutionContext() && !getExecutionContext(
)->activeDOMObjectsAreStopped(); |
| 628 } | 628 } |
| 629 | 629 |
| 630 } // namespace blink | 630 } // namespace blink |
| OLD | NEW |