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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (i != m_fetchedFonts.end()) { | 84 if (i != m_fetchedFonts.end()) { |
85 ASSERT(m_fontLRUList.contains(fontString)); | 85 ASSERT(m_fontLRUList.contains(fontString)); |
86 parsedStyle = i->value; | 86 parsedStyle = i->value; |
87 m_fontLRUList.remove(fontString); | 87 m_fontLRUList.remove(fontString); |
88 m_fontLRUList.add(fontString); | 88 m_fontLRUList.add(fontString); |
89 } else { | 89 } else { |
90 parsedStyle = MutableStylePropertySet::create(HTMLStandardMode); | 90 parsedStyle = MutableStylePropertySet::create(HTMLStandardMode); |
91 CSSParser::parseValue(parsedStyle, CSSPropertyFont, fontString, true, 0); | 91 CSSParser::parseValue(parsedStyle, CSSPropertyFont, fontString, true, 0); |
92 if (parsedStyle->isEmpty()) | 92 if (parsedStyle->isEmpty()) |
93 return nullptr; | 93 return nullptr; |
94 // According to http://lists.w3.org/Archives/Public/public-html/2009Jul/0947
.html, | 94 // According to |
| 95 // http://lists.w3.org/Archives/Public/public-html/2009Jul/0947.html, |
95 // the "inherit" and "initial" values must be ignored. | 96 // the "inherit" and "initial" values must be ignored. |
96 const CSSValue* fontValue = | 97 const CSSValue* fontValue = |
97 parsedStyle->getPropertyCSSValue(CSSPropertyFontSize); | 98 parsedStyle->getPropertyCSSValue(CSSPropertyFontSize); |
98 if (fontValue && | 99 if (fontValue && |
99 (fontValue->isInitialValue() || fontValue->isInheritedValue())) | 100 (fontValue->isInitialValue() || fontValue->isInheritedValue())) |
100 return nullptr; | 101 return nullptr; |
101 m_fetchedFonts.add(fontString, parsedStyle); | 102 m_fetchedFonts.add(fontString, parsedStyle); |
102 m_fontLRUList.add(fontString); | 103 m_fontLRUList.add(fontString); |
103 // 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 |
104 // applied at the end of the task. | 105 // applied at the end of the task. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 m_fontLRUList.clear(); | 147 m_fontLRUList.clear(); |
147 m_fontsResolvedUsingDefaultStyle.clear(); | 148 m_fontsResolvedUsingDefaultStyle.clear(); |
148 } | 149 } |
149 | 150 |
150 DEFINE_TRACE(CanvasFontCache) { | 151 DEFINE_TRACE(CanvasFontCache) { |
151 visitor->trace(m_fetchedFonts); | 152 visitor->trace(m_fetchedFonts); |
152 visitor->trace(m_document); | 153 visitor->trace(m_document); |
153 } | 154 } |
154 | 155 |
155 } // namespace blink | 156 } // namespace blink |
OLD | NEW |