OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "core/html/canvas/CanvasFontCache.h" | 7 #include "core/html/canvas/CanvasFontCache.h" |
8 | 8 |
9 #include "core/css/parser/CSSParser.h" | 9 #include "core/css/parser/CSSParser.h" |
10 #include "core/css/resolver/StyleResolver.h" | 10 #include "core/css/resolver/StyleResolver.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 parsedStyle = i->value; | 90 parsedStyle = i->value; |
91 m_fontLRUList.remove(fontString); | 91 m_fontLRUList.remove(fontString); |
92 m_fontLRUList.add(fontString); | 92 m_fontLRUList.add(fontString); |
93 } else { | 93 } else { |
94 parsedStyle = MutableStylePropertySet::create(); | 94 parsedStyle = MutableStylePropertySet::create(); |
95 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, fontString, tr
ue, HTMLStandardMode, 0); | 95 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, fontString, tr
ue, HTMLStandardMode, 0); |
96 if (parsedStyle->isEmpty()) | 96 if (parsedStyle->isEmpty()) |
97 return nullptr; | 97 return nullptr; |
98 // According to http://lists.w3.org/Archives/Public/public-html/2009Jul/
0947.html, | 98 // According to http://lists.w3.org/Archives/Public/public-html/2009Jul/
0947.html, |
99 // the "inherit" and "initial" values must be ignored. | 99 // the "inherit" and "initial" values must be ignored. |
100 RefPtrWillBeRawPtr<CSSValue> fontValue = parsedStyle->getPropertyCSSValu
e(CSSPropertyFontSize); | 100 NullableCSSValue fontValue = parsedStyle->getPropertyCSSValue(CSSPropert
yFontSize); |
101 if (fontValue && (fontValue->isInitialValue() || fontValue->isInheritedV
alue())) | 101 if (fontValue && (fontValue->isInitialValue() || fontValue->isInheritedV
alue())) |
102 return nullptr; | 102 return nullptr; |
103 m_fetchedFonts.add(fontString, parsedStyle); | 103 m_fetchedFonts.add(fontString, parsedStyle); |
104 m_fontLRUList.add(fontString); | 104 m_fontLRUList.add(fontString); |
105 // Hard limit is applied here, on the fly, while the soft limit is | 105 // Hard limit is applied here, on the fly, while the soft limit is |
106 // applied at the end of the task. | 106 // applied at the end of the task. |
107 if (m_fetchedFonts.size() > hardMaxFonts()) { | 107 if (m_fetchedFonts.size() > hardMaxFonts()) { |
108 ASSERT(m_fetchedFonts.size() == hardMaxFonts() + 1); | 108 ASSERT(m_fetchedFonts.size() == hardMaxFonts() + 1); |
109 ASSERT(m_fontLRUList.size() == hardMaxFonts() + 1); | 109 ASSERT(m_fontLRUList.size() == hardMaxFonts() + 1); |
110 m_fetchedFonts.remove(m_fontLRUList.first()); | 110 m_fetchedFonts.remove(m_fontLRUList.first()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 DEFINE_TRACE(CanvasFontCache) | 155 DEFINE_TRACE(CanvasFontCache) |
156 { | 156 { |
157 #if ENABLE(OILPAN) | 157 #if ENABLE(OILPAN) |
158 visitor->trace(m_fetchedFonts); | 158 visitor->trace(m_fetchedFonts); |
159 visitor->trace(m_document); | 159 visitor->trace(m_document); |
160 #endif | 160 #endif |
161 } | 161 } |
162 | 162 |
163 } // blink | 163 } // blink |
OLD | NEW |