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

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

Issue 1429713004: Implement CSS font-display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: failure does not mean loaded Created 5 years, 1 month 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) 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 void CSSFontFace::fontLoaded(RemoteFontFaceSource* source) 58 void CSSFontFace::fontLoaded(RemoteFontFaceSource* source)
59 { 59 {
60 if (!isValid() || source != m_sources.first()) 60 if (!isValid() || source != m_sources.first())
61 return; 61 return;
62 62
63 if (loadStatus() == FontFace::Loading) { 63 if (loadStatus() == FontFace::Loading) {
64 if (source->isValid()) { 64 if (source->isValid()) {
65 setLoadStatus(FontFace::Loaded); 65 setLoadStatus(FontFace::Loaded);
66 } else if (source->displayPeriod() == RemoteFontFaceSource::FailurePerio d) {
67 m_sources.clear();
68 setLoadStatus(FontFace::Error);
66 } else { 69 } else {
67 m_sources.removeFirst(); 70 m_sources.removeFirst();
68 load(); 71 load();
69 } 72 }
70 } 73 }
71 74
72 if (m_segmentedFontFace) 75 if (m_segmentedFontFace)
73 m_segmentedFontFace->fontLoaded(this); 76 m_segmentedFontFace->fontFaceInvalidated();
74 } 77 }
75 78
76 void CSSFontFace::fontLoadWaitLimitExceeded(RemoteFontFaceSource* source) 79 void CSSFontFace::didBecomeVisibleFallback(RemoteFontFaceSource* source)
77 { 80 {
78 if (!isValid() || source != m_sources.first()) 81 if (!isValid() || source != m_sources.first())
79 return; 82 return;
80 if (m_segmentedFontFace) 83 if (m_segmentedFontFace)
81 m_segmentedFontFace->fontLoadWaitLimitExceeded(this); 84 m_segmentedFontFace->fontFaceInvalidated();
82 } 85 }
83 86
84 PassRefPtr<SimpleFontData> CSSFontFace::getFontData(const FontDescription& fontD escription) 87 PassRefPtr<SimpleFontData> CSSFontFace::getFontData(const FontDescription& fontD escription)
85 { 88 {
86 if (!isValid()) 89 if (!isValid())
87 return nullptr; 90 return nullptr;
88 91
89 while (!m_sources.isEmpty()) { 92 while (!m_sources.isEmpty()) {
90 OwnPtrWillBeMember<CSSFontFaceSource>& source = m_sources.first(); 93 OwnPtrWillBeMember<CSSFontFaceSource>& source = m_sources.first();
91 if (RefPtr<SimpleFontData> result = source->getFontData(fontDescription) ) { 94 if (RefPtr<SimpleFontData> result = source->getFontData(fontDescription) ) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 257 }
255 258
256 DEFINE_TRACE(CSSFontFace) 259 DEFINE_TRACE(CSSFontFace)
257 { 260 {
258 visitor->trace(m_segmentedFontFace); 261 visitor->trace(m_segmentedFontFace);
259 visitor->trace(m_sources); 262 visitor->trace(m_sources);
260 visitor->trace(m_fontFace); 263 visitor->trace(m_fontFace);
261 } 264 }
262 265
263 } 266 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSFontFace.h ('k') | third_party/WebKit/Source/core/css/CSSProperties.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698