OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Nicholas Shanks <contact@nickshanks.com> | 2 * Copyright (C) 2007 Nicholas Shanks <contact@nickshanks.com> |
3 * Copyright (C) 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 11 matching lines...) Expand all Loading... |
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "platform/fonts/FontDescription.h" | 30 #include "platform/fonts/FontDescription.h" |
31 | 31 |
| 32 #include "platform/Language.h" |
32 #include "platform/RuntimeEnabledFeatures.h" | 33 #include "platform/RuntimeEnabledFeatures.h" |
33 #include "wtf/StringHasher.h" | 34 #include "wtf/StringHasher.h" |
34 #include "wtf/text/AtomicStringHash.h" | 35 #include "wtf/text/AtomicStringHash.h" |
35 #include "wtf/text/StringHash.h" | 36 #include "wtf/text/StringHash.h" |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 struct SameSizeAsFontDescription { | 40 struct SameSizeAsFontDescription { |
40 DISALLOW_NEW(); | 41 DISALLOW_NEW(); |
41 FontFamily familyList; | 42 FontFamily familyList; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 ligatures.discretionary = discretionaryLigaturesState(); | 119 ligatures.discretionary = discretionaryLigaturesState(); |
119 ligatures.historical = historicalLigaturesState(); | 120 ligatures.historical = historicalLigaturesState(); |
120 ligatures.contextual = contextualLigaturesState(); | 121 ligatures.contextual = contextualLigaturesState(); |
121 | 122 |
122 return ligatures; | 123 return ligatures; |
123 } | 124 } |
124 | 125 |
125 static const AtomicString& defaultLocale() | 126 static const AtomicString& defaultLocale() |
126 { | 127 { |
127 DEFINE_STATIC_LOCAL(AtomicString, locale, ()); | 128 DEFINE_STATIC_LOCAL(AtomicString, locale, ()); |
128 if (locale.isNull()) | 129 if (locale.isNull()) { |
129 locale = AtomicString("en"); | 130 AtomicString defaultLocale = defaultLanguage(); |
| 131 if (!defaultLocale.isEmpty()) |
| 132 locale = defaultLocale; |
| 133 else |
| 134 locale = AtomicString("en"); |
| 135 } |
130 return locale; | 136 return locale; |
131 } | 137 } |
132 | 138 |
133 const AtomicString& FontDescription::locale(bool includeDefault) const | 139 const AtomicString& FontDescription::locale(bool includeDefault) const |
134 { | 140 { |
135 if (m_locale.isNull() && includeDefault) | 141 if (m_locale.isNull() && includeDefault) |
136 return defaultLocale(); | 142 return defaultLocale(); |
137 return m_locale; | 143 return m_locale; |
138 } | 144 } |
139 | 145 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 addFloatToHash(hash, m_sizeAdjust); | 278 addFloatToHash(hash, m_sizeAdjust); |
273 addFloatToHash(hash, m_letterSpacing); | 279 addFloatToHash(hash, m_letterSpacing); |
274 addFloatToHash(hash, m_wordSpacing); | 280 addFloatToHash(hash, m_wordSpacing); |
275 addToHash(hash, m_fieldsAsUnsigned[0]); | 281 addToHash(hash, m_fieldsAsUnsigned[0]); |
276 addToHash(hash, m_fieldsAsUnsigned[1]); | 282 addToHash(hash, m_fieldsAsUnsigned[1]); |
277 | 283 |
278 return hash; | 284 return hash; |
279 } | 285 } |
280 | 286 |
281 } // namespace blink | 287 } // namespace blink |
OLD | NEW |