OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 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 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/css/CSSSegmentedFontFace.h" | 27 #include "core/css/CSSSegmentedFontFace.h" |
28 | 28 |
29 #include "core/css/CSSFontFace.h" | 29 #include "core/css/CSSFontFace.h" |
30 #include "core/css/CSSFontSelector.h" | 30 #include "core/css/CSSFontSelector.h" |
31 #include "platform/RuntimeEnabledFeatures.h" | 31 #include "platform/RuntimeEnabledFeatures.h" |
32 #include "platform/fonts/FontCache.h" | 32 #include "platform/fonts/FontCache.h" |
33 #include "platform/fonts/FontDescription.h" | 33 #include "platform/fonts/FontDescription.h" |
| 34 #include "platform/fonts/FontFaceCreationParams.h" |
34 #include "platform/fonts/SegmentedFontData.h" | 35 #include "platform/fonts/SegmentedFontData.h" |
35 #include "platform/fonts/SimpleFontData.h" | 36 #include "platform/fonts/SimpleFontData.h" |
36 | 37 |
37 namespace WebCore { | 38 namespace WebCore { |
38 | 39 |
39 CSSSegmentedFontFace::CSSSegmentedFontFace(CSSFontSelector* fontSelector, FontTr
aits traits) | 40 CSSSegmentedFontFace::CSSSegmentedFontFace(CSSFontSelector* fontSelector, FontTr
aits traits) |
40 : m_fontSelector(fontSelector) | 41 : m_fontSelector(fontSelector) |
41 , m_traits(traits) | 42 , m_traits(traits) |
42 , m_firstNonCssConnectedFace(m_fontFaces.end()) | 43 , m_firstNonCssConnectedFace(m_fontFaces.end()) |
43 { | 44 { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 for (unsigned j = 0; j < numRanges; ++j) | 124 for (unsigned j = 0; j < numRanges; ++j) |
124 newFontData->appendRange(FontDataRange(ranges.rangeAt(j).from(), ranges.
rangeAt(j).to(), faceFontData)); | 125 newFontData->appendRange(FontDataRange(ranges.rangeAt(j).from(), ranges.
rangeAt(j).to(), faceFontData)); |
125 } | 126 } |
126 | 127 |
127 PassRefPtr<FontData> CSSSegmentedFontFace::getFontData(const FontDescription& fo
ntDescription) | 128 PassRefPtr<FontData> CSSSegmentedFontFace::getFontData(const FontDescription& fo
ntDescription) |
128 { | 129 { |
129 if (!isValid()) | 130 if (!isValid()) |
130 return nullptr; | 131 return nullptr; |
131 | 132 |
132 FontTraits desiredTraits = fontDescription.traits(); | 133 FontTraits desiredTraits = fontDescription.traits(); |
133 AtomicString emptyFontFamily = ""; | 134 FontCacheKey key = fontDescription.cacheKey(FontFaceCreationParams(), desire
dTraits); |
134 FontCacheKey key = fontDescription.cacheKey(emptyFontFamily, desiredTraits); | |
135 | 135 |
136 RefPtr<SegmentedFontData>& fontData = m_fontDataTable.add(key.hash(), nullpt
r).storedValue->value; | 136 RefPtr<SegmentedFontData>& fontData = m_fontDataTable.add(key.hash(), nullpt
r).storedValue->value; |
137 if (fontData && fontData->numRanges()) | 137 if (fontData && fontData->numRanges()) |
138 return fontData; // No release, we have a reference to an object in the
cache which should retain the ref count it has. | 138 return fontData; // No release, we have a reference to an object in the
cache which should retain the ref count it has. |
139 | 139 |
140 if (!fontData) | 140 if (!fontData) |
141 fontData = SegmentedFontData::create(); | 141 fontData = SegmentedFontData::create(); |
142 | 142 |
143 FontDescription requestedFontDescription(fontDescription); | 143 FontDescription requestedFontDescription(fontDescription); |
144 requestedFontDescription.setTraits(m_traits); | 144 requestedFontDescription.setTraits(m_traits); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 void CSSSegmentedFontFace::trace(Visitor* visitor) | 213 void CSSSegmentedFontFace::trace(Visitor* visitor) |
214 { | 214 { |
215 visitor->trace(m_fontSelector); | 215 visitor->trace(m_fontSelector); |
216 visitor->trace(m_fontFaces); | 216 visitor->trace(m_fontFaces); |
217 } | 217 } |
218 | 218 |
219 } | 219 } |
OLD | NEW |