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

Side by Side Diff: Source/core/css/CSSFontFaceSource.cpp

Issue 307243002: Fix font family based fallback font selection (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Windows link fix. Created 6 years, 6 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) 2007, 2008, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2010, 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 11 matching lines...) Expand all
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/css/CSSFontFaceSource.h" 27 #include "core/css/CSSFontFaceSource.h"
28 28
29 #include "core/css/CSSFontFace.h" 29 #include "core/css/CSSFontFace.h"
30 #include "platform/fonts/FontCacheKey.h" 30 #include "platform/fonts/FontCacheKey.h"
31 #include "platform/fonts/FontDescription.h" 31 #include "platform/fonts/FontDescription.h"
32 #include "platform/fonts/FontFaceCreationParams.h"
32 #include "platform/fonts/SimpleFontData.h" 33 #include "platform/fonts/SimpleFontData.h"
33 34
34 namespace WebCore { 35 namespace WebCore {
35 36
36 CSSFontFaceSource::CSSFontFaceSource() 37 CSSFontFaceSource::CSSFontFaceSource()
37 : m_face(nullptr) 38 : m_face(nullptr)
38 { 39 {
39 } 40 }
40 41
41 CSSFontFaceSource::~CSSFontFaceSource() 42 CSSFontFaceSource::~CSSFontFaceSource()
42 { 43 {
43 } 44 }
44 45
45 PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription& fontDescription) 46 PassRefPtr<SimpleFontData> CSSFontFaceSource::getFontData(const FontDescription& fontDescription)
46 { 47 {
47 // If the font hasn't loaded or an error occurred, then we've got nothing. 48 // If the font hasn't loaded or an error occurred, then we've got nothing.
48 if (!isValid()) 49 if (!isValid())
49 return nullptr; 50 return nullptr;
50 51
51 if (isLocal()) { 52 if (isLocal()) {
52 // We're local. Just return a SimpleFontData from the normal cache. 53 // We're local. Just return a SimpleFontData from the normal cache.
53 return createFontData(fontDescription); 54 return createFontData(fontDescription);
54 } 55 }
55 56
56 // See if we have a mapping in our FontData cache. 57 // See if we have a mapping in our FontData cache.
57 AtomicString emptyFontFamily = ""; 58 FontCacheKey key = fontDescription.cacheKey(FontFaceCreationParams());
58 FontCacheKey key = fontDescription.cacheKey(emptyFontFamily);
59 59
60 RefPtr<SimpleFontData>& fontData = m_fontDataTable.add(key.hash(), nullptr). storedValue->value; 60 RefPtr<SimpleFontData>& fontData = m_fontDataTable.add(key.hash(), nullptr). storedValue->value;
61 if (!fontData) 61 if (!fontData)
62 fontData = createFontData(fontDescription); 62 fontData = createFontData(fontDescription);
63 return fontData; // No release, because fontData is a reference to a RefPtr that is held in the m_fontDataTable. 63 return fontData; // No release, because fontData is a reference to a RefPtr that is held in the m_fontDataTable.
64 } 64 }
65 65
66 void CSSFontFaceSource::trace(Visitor* visitor) 66 void CSSFontFaceSource::trace(Visitor* visitor)
67 { 67 {
68 visitor->trace(m_face); 68 visitor->trace(m_face);
69 } 69 }
70 70
71 } 71 }
OLDNEW
« no previous file with comments | « LayoutTests/third_party/GardinerMod/README.Chromium ('k') | Source/core/css/CSSSegmentedFontFace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698