| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 nullptr); | 65 nullptr); |
| 66 if (!segmentedFontFaceResult.storedValue->value) | 66 if (!segmentedFontFaceResult.storedValue->value) |
| 67 segmentedFontFaceResult.storedValue->value = | 67 segmentedFontFaceResult.storedValue->value = |
| 68 CSSSegmentedFontFace::create(cssFontSelector, fontFace->traits()); | 68 CSSSegmentedFontFace::create(cssFontSelector, fontFace->traits()); |
| 69 | 69 |
| 70 segmentedFontFaceResult.storedValue->value->addFontFace(fontFace, | 70 segmentedFontFaceResult.storedValue->value->addFontFace(fontFace, |
| 71 cssConnected); | 71 cssConnected); |
| 72 if (cssConnected) | 72 if (cssConnected) |
| 73 m_cssConnectedFontFaces.add(fontFace); | 73 m_cssConnectedFontFaces.add(fontFace); |
| 74 | 74 |
| 75 m_fonts.remove(fontFace->family()); | 75 m_fonts.erase(fontFace->family()); |
| 76 incrementVersion(); | 76 incrementVersion(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void FontFaceCache::remove(const StyleRuleFontFace* fontFaceRule) { | 79 void FontFaceCache::remove(const StyleRuleFontFace* fontFaceRule) { |
| 80 StyleRuleToFontFace::iterator it = m_styleRuleToFontFace.find(fontFaceRule); | 80 StyleRuleToFontFace::iterator it = m_styleRuleToFontFace.find(fontFaceRule); |
| 81 if (it != m_styleRuleToFontFace.end()) { | 81 if (it != m_styleRuleToFontFace.end()) { |
| 82 removeFontFace(it->value.get(), true); | 82 removeFontFace(it->value.get(), true); |
| 83 m_styleRuleToFontFace.remove(it); | 83 m_styleRuleToFontFace.remove(it); |
| 84 } | 84 } |
| 85 } | 85 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 96 if (familyFontFacesIter == familyFontFaces->end()) | 96 if (familyFontFacesIter == familyFontFaces->end()) |
| 97 return; | 97 return; |
| 98 CSSSegmentedFontFace* segmentedFontFace = familyFontFacesIter->value; | 98 CSSSegmentedFontFace* segmentedFontFace = familyFontFacesIter->value; |
| 99 | 99 |
| 100 segmentedFontFace->removeFontFace(fontFace); | 100 segmentedFontFace->removeFontFace(fontFace); |
| 101 if (segmentedFontFace->isEmpty()) { | 101 if (segmentedFontFace->isEmpty()) { |
| 102 familyFontFaces->remove(familyFontFacesIter); | 102 familyFontFaces->remove(familyFontFacesIter); |
| 103 if (familyFontFaces->isEmpty()) | 103 if (familyFontFaces->isEmpty()) |
| 104 m_fontFaces.remove(fontFacesIter); | 104 m_fontFaces.remove(fontFacesIter); |
| 105 } | 105 } |
| 106 m_fonts.remove(fontFace->family()); | 106 m_fonts.erase(fontFace->family()); |
| 107 if (cssConnected) | 107 if (cssConnected) |
| 108 m_cssConnectedFontFaces.remove(fontFace); | 108 m_cssConnectedFontFaces.remove(fontFace); |
| 109 | 109 |
| 110 incrementVersion(); | 110 incrementVersion(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void FontFaceCache::clearCSSConnected() { | 113 void FontFaceCache::clearCSSConnected() { |
| 114 for (const auto& item : m_styleRuleToFontFace) | 114 for (const auto& item : m_styleRuleToFontFace) |
| 115 removeFontFace(item.value.get(), true); | 115 removeFontFace(item.value.get(), true); |
| 116 m_styleRuleToFontFace.clear(); | 116 m_styleRuleToFontFace.clear(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 DEFINE_TRACE(FontFaceCache) { | 160 DEFINE_TRACE(FontFaceCache) { |
| 161 visitor->trace(m_fontFaces); | 161 visitor->trace(m_fontFaces); |
| 162 visitor->trace(m_fonts); | 162 visitor->trace(m_fonts); |
| 163 visitor->trace(m_styleRuleToFontFace); | 163 visitor->trace(m_styleRuleToFontFace); |
| 164 visitor->trace(m_cssConnectedFontFaces); | 164 visitor->trace(m_cssConnectedFontFaces); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace blink | 167 } // namespace blink |
| OLD | NEW |