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 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include "core/css/CSSFontSelector.h" | 29 #include "core/css/CSSFontSelector.h" |
30 #include "core/css/CSSSegmentedFontFace.h" | 30 #include "core/css/CSSSegmentedFontFace.h" |
31 #include "core/css/FontFaceSet.h" | 31 #include "core/css/FontFaceSet.h" |
32 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
33 #include "core/frame/UseCounter.h" | 33 #include "core/frame/UseCounter.h" |
34 #include "core/platform/graphics/SimpleFontData.h" | 34 #include "core/platform/graphics/SimpleFontData.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
| 38 PassRefPtr<CSSFontFace> CSSFontFace::createFromStyleRule(Document* document, con
st StyleRuleFontFace* fontFaceRule) |
| 39 { |
| 40 RefPtr<FontFace> fontFace = FontFace::create(fontFaceRule); |
| 41 if (!fontFace || fontFace->family().isEmpty()) |
| 42 return 0; |
| 43 |
| 44 unsigned traitsMask = fontFace->traitsMask(); |
| 45 if (!traitsMask) |
| 46 return 0; |
| 47 |
| 48 // FIXME: Plumbing back into createCSSFontFace seems odd. |
| 49 // Maybe move FontFace::createCSSFontFace logic here? |
| 50 RefPtr<CSSFontFace> cssFontFace = fontFace->createCSSFontFace(document); |
| 51 if (!cssFontFace || !cssFontFace->isValid()) |
| 52 return 0; |
| 53 |
| 54 return cssFontFace; |
| 55 } |
| 56 |
38 bool CSSFontFace::isLoaded() const | 57 bool CSSFontFace::isLoaded() const |
39 { | 58 { |
40 size_t size = m_sources.size(); | 59 size_t size = m_sources.size(); |
41 for (size_t i = 0; i < size; i++) { | 60 for (size_t i = 0; i < size; i++) { |
42 if (!m_sources[i]->isLoaded()) | 61 if (!m_sources[i]->isLoaded()) |
43 return false; | 62 return false; |
44 } | 63 } |
45 return true; | 64 return true; |
46 } | 65 } |
47 | 66 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 index += U16_LENGTH(c); | 220 index += U16_LENGTH(c); |
202 for (unsigned i = 0; i < m_ranges.size(); i++) { | 221 for (unsigned i = 0; i < m_ranges.size(); i++) { |
203 if (m_ranges[i].contains(c)) | 222 if (m_ranges[i].contains(c)) |
204 return true; | 223 return true; |
205 } | 224 } |
206 } | 225 } |
207 return false; | 226 return false; |
208 } | 227 } |
209 | 228 |
210 } | 229 } |
OLD | NEW |