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

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

Issue 1829403002: Clean up font loading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Resource_status
Patch Set: Address hiroshige's comments Created 4 years, 8 months 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 else 388 else
389 m_callbacks.append(callback); 389 m_callbacks.append(callback);
390 } 390 }
391 391
392 void FontFace::loadInternal(ExecutionContext* context) 392 void FontFace::loadInternal(ExecutionContext* context)
393 { 393 {
394 if (m_status != Unloaded) 394 if (m_status != Unloaded)
395 return; 395 return;
396 396
397 m_cssFontFace->load(); 397 m_cssFontFace->load();
398 toDocument(context)->styleEngine().fontSelector()->fontLoader()->loadPending Fonts();
399 } 398 }
400 399
401 FontTraits FontFace::traits() const 400 FontTraits FontFace::traits() const
402 { 401 {
403 FontStretch stretch = FontStretchNormal; 402 FontStretch stretch = FontStretchNormal;
404 if (m_stretch) { 403 if (m_stretch) {
405 if (!m_stretch->isPrimitiveValue()) 404 if (!m_stretch->isPrimitiveValue())
406 return 0; 405 return 0;
407 406
408 switch (toCSSPrimitiveValue(m_stretch.get())->getValueID()) { 407 switch (toCSSPrimitiveValue(m_stretch.get())->getValueID()) {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 // An item in the list either specifies a string (local font name) or a URL (remote font to download). 584 // An item in the list either specifies a string (local font name) or a URL (remote font to download).
586 CSSFontFaceSrcValue* item = toCSSFontFaceSrcValue(srcList->item(i)); 585 CSSFontFaceSrcValue* item = toCSSFontFaceSrcValue(srcList->item(i));
587 CSSFontFaceSource* source = nullptr; 586 CSSFontFaceSource* source = nullptr;
588 587
589 if (!item->isLocal()) { 588 if (!item->isLocal()) {
590 const Settings* settings = document ? document->settings() : nullptr ; 589 const Settings* settings = document ? document->settings() : nullptr ;
591 bool allowDownloading = settings && settings->downloadableBinaryFont sEnabled(); 590 bool allowDownloading = settings && settings->downloadableBinaryFont sEnabled();
592 if (allowDownloading && item->isSupportedFormat() && document) { 591 if (allowDownloading && item->isSupportedFormat() && document) {
593 FontResource* fetched = item->fetch(document); 592 FontResource* fetched = item->fetch(document);
594 if (fetched) { 593 if (fetched) {
595 FontLoader* fontLoader = document->styleEngine().fontSelecto r()->fontLoader(); 594 CSSFontSelector* fontSelector = document->styleEngine().font Selector();
596 source = new RemoteFontFaceSource(fetched, fontLoader, CSSVa lueToFontDisplay(m_display.get())); 595 source = new RemoteFontFaceSource(fetched, fontSelector, CSS ValueToFontDisplay(m_display.get()));
597 } 596 }
598 } 597 }
599 } else { 598 } else {
600 source = new LocalFontFaceSource(item->resource()); 599 source = new LocalFontFaceSource(item->resource());
601 } 600 }
602 601
603 if (source) 602 if (source)
604 m_cssFontFace->addSource(source); 603 m_cssFontFace->addSource(source);
605 } 604 }
606 605
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 { 644 {
646 return m_cssFontFace->hadBlankText(); 645 return m_cssFontFace->hadBlankText();
647 } 646 }
648 647
649 bool FontFace::hasPendingActivity() const 648 bool FontFace::hasPendingActivity() const
650 { 649 {
651 return m_status == Loading && getExecutionContext() && !getExecutionContext( )->activeDOMObjectsAreStopped(); 650 return m_status == Loading && getExecutionContext() && !getExecutionContext( )->activeDOMObjectsAreStopped();
652 } 651 }
653 652
654 } // namespace blink 653 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698