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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 MutableStylePropertySet* CanvasFontCache::parseFont(const String& fontString) { | 81 MutableStylePropertySet* CanvasFontCache::parseFont(const String& fontString) { |
82 MutableStylePropertySet* parsedStyle; | 82 MutableStylePropertySet* parsedStyle; |
83 MutableStylePropertyMap::iterator i = m_fetchedFonts.find(fontString); | 83 MutableStylePropertyMap::iterator i = m_fetchedFonts.find(fontString); |
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); |
92 if (parsedStyle->isEmpty()) | 92 if (parsedStyle->isEmpty()) |
93 return nullptr; | 93 return nullptr; |
94 // According to | 94 // According to |
95 // http://lists.w3.org/Archives/Public/public-html/2009Jul/0947.html, | 95 // http://lists.w3.org/Archives/Public/public-html/2009Jul/0947.html, |
96 // the "inherit" and "initial" values must be ignored. | 96 // the "inherit" and "initial" values must be ignored. |
97 const CSSValue* fontValue = | 97 const CSSValue* fontValue = |
98 parsedStyle->getPropertyCSSValue(CSSPropertyFontSize); | 98 parsedStyle->getPropertyCSSValue(CSSPropertyFontSize); |
99 if (fontValue && | 99 if (fontValue && |
100 (fontValue->isInitialValue() || fontValue->isInheritedValue())) | 100 (fontValue->isInitialValue() || fontValue->isInheritedValue())) |
101 return nullptr; | 101 return nullptr; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 m_fontLRUList.clear(); | 147 m_fontLRUList.clear(); |
148 m_fontsResolvedUsingDefaultStyle.clear(); | 148 m_fontsResolvedUsingDefaultStyle.clear(); |
149 } | 149 } |
150 | 150 |
151 DEFINE_TRACE(CanvasFontCache) { | 151 DEFINE_TRACE(CanvasFontCache) { |
152 visitor->trace(m_fetchedFonts); | 152 visitor->trace(m_fetchedFonts); |
153 visitor->trace(m_document); | 153 visitor->trace(m_document); |
154 } | 154 } |
155 | 155 |
156 } // namespace blink | 156 } // namespace blink |
OLD | NEW |