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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 MutableStylePropertySet* CanvasFontCache::parseFont(const String& fontString) | 84 MutableStylePropertySet* CanvasFontCache::parseFont(const String& fontString) |
85 { | 85 { |
86 RefPtrWillBeRawPtr<MutableStylePropertySet> parsedStyle; | 86 RefPtrWillBeRawPtr<MutableStylePropertySet> parsedStyle; |
87 MutableStylePropertyMap::iterator i = m_fetchedFonts.find(fontString); | 87 MutableStylePropertyMap::iterator i = m_fetchedFonts.find(fontString); |
88 if (i != m_fetchedFonts.end()) { | 88 if (i != m_fetchedFonts.end()) { |
89 ASSERT(m_fontLRUList.contains(fontString)); | 89 ASSERT(m_fontLRUList.contains(fontString)); |
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(HTMLQuirksMode); | 94 parsedStyle = MutableStylePropertySet::create(HTMLStandardMode); |
95 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, fontString, tr
ue, HTMLStandardMode, 0); | 95 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, fontString, tr
ue, 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 RefPtrWillBeRawPtr<CSSValue> fontValue = parsedStyle->getPropertyCSSValu
e(CSSPropertyFontSize); |
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 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 DEFINE_TRACE(CanvasFontCache) | 156 DEFINE_TRACE(CanvasFontCache) |
157 { | 157 { |
158 #if ENABLE(OILPAN) | 158 #if ENABLE(OILPAN) |
159 visitor->trace(m_fetchedFonts); | 159 visitor->trace(m_fetchedFonts); |
160 visitor->trace(m_document); | 160 visitor->trace(m_document); |
161 #endif | 161 #endif |
162 } | 162 } |
163 | 163 |
164 } // blink | 164 } // blink |
OLD | NEW |