OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. |
3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 3 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "core/css/CSSValueList.h" | 36 #include "core/css/CSSValueList.h" |
37 #include "core/css/resolver/StyleResolver.h" | 37 #include "core/css/resolver/StyleResolver.h" |
38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
39 #include "core/fetch/FontResource.h" | 39 #include "core/fetch/FontResource.h" |
40 #include "core/fetch/ResourceFetcher.h" | 40 #include "core/fetch/ResourceFetcher.h" |
41 #include "core/loader/FrameLoader.h" | 41 #include "core/loader/FrameLoader.h" |
42 #include "core/page/Frame.h" | 42 #include "core/page/Frame.h" |
43 #include "core/page/Settings.h" | 43 #include "core/page/Settings.h" |
44 #include "core/platform/graphics/FontCache.h" | 44 #include "core/platform/graphics/FontCache.h" |
45 #include "core/platform/graphics/SimpleFontData.h" | 45 #include "core/platform/graphics/SimpleFontData.h" |
| 46 #include "core/platform/text/LocaleToScriptMapping.h" |
46 #include "wtf/text/AtomicString.h" | 47 #include "wtf/text/AtomicString.h" |
47 | 48 |
48 using namespace std; | 49 using namespace std; |
49 | 50 |
50 namespace WebCore { | 51 namespace WebCore { |
51 | 52 |
52 CSSFontSelector::CSSFontSelector(Document* document) | 53 CSSFontSelector::CSSFontSelector(Document* document) |
53 : m_document(document) | 54 : m_document(document) |
54 , m_beginLoadingTimer(this, &CSSFontSelector::beginLoadTimerFired) | 55 , m_beginLoadingTimer(this, &CSSFontSelector::beginLoadTimerFired) |
55 , m_version(0) | 56 , m_version(0) |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 static PassRefPtr<FontData> fontDataForGenericFamily(Document* document, const F
ontDescription& fontDescription, const AtomicString& familyName) | 162 static PassRefPtr<FontData> fontDataForGenericFamily(Document* document, const F
ontDescription& fontDescription, const AtomicString& familyName) |
162 { | 163 { |
163 if (!document || !document->frame()) | 164 if (!document || !document->frame()) |
164 return 0; | 165 return 0; |
165 | 166 |
166 const Settings* settings = document->frame()->settings(); | 167 const Settings* settings = document->frame()->settings(); |
167 if (!settings) | 168 if (!settings) |
168 return 0; | 169 return 0; |
169 | 170 |
170 AtomicString genericFamily; | 171 AtomicString genericFamily; |
171 UScriptCode script = fontDescription.script(); | 172 UScriptCode script = localeToScriptCodeForFontSelection(fontDescription.loca
le()); |
172 | 173 |
173 if (familyName == serifFamily) | 174 if (familyName == serifFamily) |
174 genericFamily = settings->serifFontFamily(script); | 175 genericFamily = settings->serifFontFamily(script); |
175 else if (familyName == sansSerifFamily) | 176 else if (familyName == sansSerifFamily) |
176 genericFamily = settings->sansSerifFontFamily(script); | 177 genericFamily = settings->sansSerifFontFamily(script); |
177 else if (familyName == cursiveFamily) | 178 else if (familyName == cursiveFamily) |
178 genericFamily = settings->cursiveFontFamily(script); | 179 genericFamily = settings->cursiveFontFamily(script); |
179 else if (familyName == fantasyFamily) | 180 else if (familyName == fantasyFamily) |
180 genericFamily = settings->fantasyFontFamily(script); | 181 genericFamily = settings->fantasyFontFamily(script); |
181 else if (familyName == monospaceFamily) | 182 else if (familyName == monospaceFamily) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 401 } |
401 // Ensure that if the request count reaches zero, the frame loader will know
about it. | 402 // Ensure that if the request count reaches zero, the frame loader will know
about it. |
402 fetcher->didLoadResource(0); | 403 fetcher->didLoadResource(0); |
403 // New font loads may be triggered by layout after the document load is comp
lete but before we have dispatched | 404 // New font loads may be triggered by layout after the document load is comp
lete but before we have dispatched |
404 // didFinishLoading for the frame. Make sure the delegate is always dispatch
ed by checking explicitly. | 405 // didFinishLoading for the frame. Make sure the delegate is always dispatch
ed by checking explicitly. |
405 if (m_document && m_document->frame()) | 406 if (m_document && m_document->frame()) |
406 m_document->frame()->loader()->checkLoadComplete(); | 407 m_document->frame()->loader()->checkLoadComplete(); |
407 } | 408 } |
408 | 409 |
409 } | 410 } |
OLD | NEW |