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/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 parsedStyle = i->value; | 51 parsedStyle = i->value; |
52 m_fontLRUList.remove(fontString); | 52 m_fontLRUList.remove(fontString); |
53 m_fontLRUList.add(fontString); | 53 m_fontLRUList.add(fontString); |
54 } else { | 54 } else { |
55 parsedStyle = MutableStylePropertySet::create(); | 55 parsedStyle = MutableStylePropertySet::create(); |
56 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, fontString, tr
ue, HTMLStandardMode, 0); | 56 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, fontString, tr
ue, HTMLStandardMode, 0); |
57 if (parsedStyle->isEmpty()) | 57 if (parsedStyle->isEmpty()) |
58 return nullptr; | 58 return nullptr; |
59 // According to http://lists.w3.org/Archives/Public/public-html/2009Jul/
0947.html, | 59 // According to http://lists.w3.org/Archives/Public/public-html/2009Jul/
0947.html, |
60 // the "inherit" and "initial" values must be ignored. | 60 // the "inherit" and "initial" values must be ignored. |
61 RefPtrWillBeRawPtr<CSSValue> fontValue = parsedStyle->getPropertyCSSValu
e(CSSPropertyFontSize); | 61 NullableCSSValue fontValue = parsedStyle->getPropertyCSSValue(CSSPropert
yFontSize); |
62 if (fontValue && (fontValue->isInitialValue() || fontValue->isInheritedV
alue())) | 62 if (fontValue && (fontValue->isInitialValue() || fontValue->isInheritedV
alue())) |
63 return nullptr; | 63 return nullptr; |
64 m_fetchedFonts.add(fontString, parsedStyle); | 64 m_fetchedFonts.add(fontString, parsedStyle); |
65 m_fontLRUList.add(fontString); | 65 m_fontLRUList.add(fontString); |
66 // Hard limit is applied here, on the fly, while the soft limit is | 66 // Hard limit is applied here, on the fly, while the soft limit is |
67 // applied at the end of the task. | 67 // applied at the end of the task. |
68 if (m_fetchedFonts.size() > hardMaxFonts()) { | 68 if (m_fetchedFonts.size() > hardMaxFonts()) { |
69 ASSERT(m_fetchedFonts.size() == hardMaxFonts() + 1); | 69 ASSERT(m_fetchedFonts.size() == hardMaxFonts() + 1); |
70 ASSERT(m_fontLRUList.size() == hardMaxFonts() + 1); | 70 ASSERT(m_fontLRUList.size() == hardMaxFonts() + 1); |
71 m_fetchedFonts.remove(m_fontLRUList.first()); | 71 m_fetchedFonts.remove(m_fontLRUList.first()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 DEFINE_TRACE(CanvasFontCache) | 113 DEFINE_TRACE(CanvasFontCache) |
114 { | 114 { |
115 #if ENABLE(OILPAN) | 115 #if ENABLE(OILPAN) |
116 visitor->trace(m_fetchedFonts); | 116 visitor->trace(m_fetchedFonts); |
117 #endif | 117 #endif |
118 } | 118 } |
119 | 119 |
120 } // blink | 120 } // blink |
OLD | NEW |