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 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google 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 * 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 30 matching lines...) Expand all Loading... |
41 class StyleRuleFontFace; | 41 class StyleRuleFontFace; |
42 | 42 |
43 class FontFaceCache { | 43 class FontFaceCache { |
44 public: | 44 public: |
45 FontFaceCache(); | 45 FontFaceCache(); |
46 | 46 |
47 // FIXME: Remove CSSFontSelector as argument. Passing CSSFontSelector here i
s | 47 // FIXME: Remove CSSFontSelector as argument. Passing CSSFontSelector here i
s |
48 // a result of egregious spaghettification in FontFace/FontFaceSet. | 48 // a result of egregious spaghettification in FontFace/FontFaceSet. |
49 void add(CSSFontSelector*, const StyleRuleFontFace*, PassRefPtr<FontFace>); | 49 void add(CSSFontSelector*, const StyleRuleFontFace*, PassRefPtr<FontFace>); |
50 void remove(const StyleRuleFontFace*); | 50 void remove(const StyleRuleFontFace*); |
| 51 void clear(); |
51 void addFontFace(CSSFontSelector*, PassRefPtr<FontFace>, bool cssConnected); | 52 void addFontFace(CSSFontSelector*, PassRefPtr<FontFace>, bool cssConnected); |
52 void removeFontFace(FontFace*, bool cssConnected); | 53 void removeFontFace(FontFace*, bool cssConnected); |
53 | 54 |
54 // FIXME: It's sort of weird that add/remove uses StyleRuleFontFace* as key, | 55 // FIXME: It's sort of weird that add/remove uses StyleRuleFontFace* as key, |
55 // but this function uses FontDescription/family pair. | 56 // but this function uses FontDescription/family pair. |
56 CSSSegmentedFontFace* get(const FontDescription&, const AtomicString& family
); | 57 CSSSegmentedFontFace* get(const FontDescription&, const AtomicString& family
); |
57 | 58 |
58 const ListHashSet<RefPtr<FontFace> >& cssConnectedFontFaces() const { return
m_cssConnectedFontFaces; } | 59 const ListHashSet<RefPtr<FontFace> >& cssConnectedFontFaces() const { return
m_cssConnectedFontFaces; } |
59 | 60 |
60 unsigned version() const { return m_version; } | 61 unsigned version() const { return m_version; } |
61 | 62 |
62 private: | 63 private: |
63 typedef HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > TraitsMap; | 64 typedef HashMap<unsigned, RefPtr<CSSSegmentedFontFace> > TraitsMap; |
64 typedef HashMap<String, OwnPtr<TraitsMap>, CaseFoldingHash> FamilyToTraitsMa
p; | 65 typedef HashMap<String, OwnPtr<TraitsMap>, CaseFoldingHash> FamilyToTraitsMa
p; |
65 typedef HashMap<const StyleRuleFontFace*, RefPtr<FontFace> > StyleRuleToFont
Face; | 66 typedef HashMap<const StyleRuleFontFace*, RefPtr<FontFace> > StyleRuleToFont
Face; |
66 FamilyToTraitsMap m_fontFaces; | 67 FamilyToTraitsMap m_fontFaces; |
67 FamilyToTraitsMap m_fonts; | 68 FamilyToTraitsMap m_fonts; |
68 StyleRuleToFontFace m_styleRuleToFontFace; | 69 StyleRuleToFontFace m_styleRuleToFontFace; |
69 ListHashSet<RefPtr<FontFace> > m_cssConnectedFontFaces; | 70 ListHashSet<RefPtr<FontFace> > m_cssConnectedFontFaces; |
70 | 71 |
71 // FIXME: See if this could be ditched | 72 // FIXME: See if this could be ditched |
72 // Used to compare Font instances, and the usage seems suspect. | 73 // Used to compare Font instances, and the usage seems suspect. |
73 unsigned m_version; | 74 unsigned m_version; |
74 }; | 75 }; |
75 | 76 |
76 } | 77 } |
77 | 78 |
78 #endif | 79 #endif |
OLD | NEW |