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 "core/html/canvas/CanvasFontCache.h" | 5 #include "core/html/canvas/CanvasFontCache.h" |
6 | 6 |
7 #include "core/css/parser/CSSParser.h" | 7 #include "core/css/parser/CSSParser.h" |
8 #include "core/css/resolver/StyleResolver.h" | 8 #include "core/css/resolver/StyleResolver.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 parsedStyle = i->value; | 89 parsedStyle = i->value; |
90 m_fontLRUList.remove(fontString); | 90 m_fontLRUList.remove(fontString); |
91 m_fontLRUList.add(fontString); | 91 m_fontLRUList.add(fontString); |
92 } else { | 92 } else { |
93 parsedStyle = MutableStylePropertySet::create(HTMLStandardMode); | 93 parsedStyle = MutableStylePropertySet::create(HTMLStandardMode); |
94 CSSParser::parseValue(parsedStyle, CSSPropertyFont, fontString, true, 0)
; | 94 CSSParser::parseValue(parsedStyle, CSSPropertyFont, fontString, true, 0)
; |
95 if (parsedStyle->isEmpty()) | 95 if (parsedStyle->isEmpty()) |
96 return nullptr; | 96 return nullptr; |
97 // According to http://lists.w3.org/Archives/Public/public-html/2009Jul/
0947.html, | 97 // According to http://lists.w3.org/Archives/Public/public-html/2009Jul/
0947.html, |
98 // the "inherit" and "initial" values must be ignored. | 98 // the "inherit" and "initial" values must be ignored. |
99 CSSValue* fontValue = parsedStyle->getPropertyCSSValue(CSSPropertyFontSi
ze); | 99 const CSSValue* fontValue = parsedStyle->getPropertyCSSValue(CSSProperty
FontSize); |
100 if (fontValue && (fontValue->isInitialValue() || fontValue->isInheritedV
alue())) | 100 if (fontValue && (fontValue->isInitialValue() || fontValue->isInheritedV
alue())) |
101 return nullptr; | 101 return nullptr; |
102 m_fetchedFonts.add(fontString, parsedStyle); | 102 m_fetchedFonts.add(fontString, parsedStyle); |
103 m_fontLRUList.add(fontString); | 103 m_fontLRUList.add(fontString); |
104 // Hard limit is applied here, on the fly, while the soft limit is | 104 // Hard limit is applied here, on the fly, while the soft limit is |
105 // applied at the end of the task. | 105 // applied at the end of the task. |
106 if (m_fetchedFonts.size() > hardMaxFonts()) { | 106 if (m_fetchedFonts.size() > hardMaxFonts()) { |
107 ASSERT(m_fetchedFonts.size() == hardMaxFonts() + 1); | 107 ASSERT(m_fetchedFonts.size() == hardMaxFonts() + 1); |
108 ASSERT(m_fontLRUList.size() == hardMaxFonts() + 1); | 108 ASSERT(m_fontLRUList.size() == hardMaxFonts() + 1); |
109 m_fetchedFonts.remove(m_fontLRUList.first()); | 109 m_fetchedFonts.remove(m_fontLRUList.first()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 m_fontsResolvedUsingDefaultStyle.clear(); | 152 m_fontsResolvedUsingDefaultStyle.clear(); |
153 } | 153 } |
154 | 154 |
155 DEFINE_TRACE(CanvasFontCache) | 155 DEFINE_TRACE(CanvasFontCache) |
156 { | 156 { |
157 visitor->trace(m_fetchedFonts); | 157 visitor->trace(m_fetchedFonts); |
158 visitor->trace(m_document); | 158 visitor->trace(m_document); |
159 } | 159 } |
160 | 160 |
161 } // namespace blink | 161 } // namespace blink |
OLD | NEW |