| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 return false; | 71 return false; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void CSSSegmentedFontFace::fontFaceInvalidated() | 74 void CSSSegmentedFontFace::fontFaceInvalidated() |
| 75 { | 75 { |
| 76 pruneTable(); | 76 pruneTable(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void CSSSegmentedFontFace::addFontFace(PassRefPtrWillBeRawPtr<FontFace> prpFontF
ace, bool cssConnected) | 79 void CSSSegmentedFontFace::addFontFace(RawPtr<FontFace> prpFontFace, bool cssCon
nected) |
| 80 { | 80 { |
| 81 RefPtrWillBeRawPtr<FontFace> fontFace = prpFontFace; | 81 RawPtr<FontFace> fontFace = prpFontFace; |
| 82 pruneTable(); | 82 pruneTable(); |
| 83 fontFace->cssFontFace()->setSegmentedFontFace(this); | 83 fontFace->cssFontFace()->setSegmentedFontFace(this); |
| 84 if (cssConnected) { | 84 if (cssConnected) { |
| 85 m_fontFaces.insertBefore(m_firstNonCssConnectedFace, fontFace); | 85 m_fontFaces.insertBefore(m_firstNonCssConnectedFace, fontFace); |
| 86 } else { | 86 } else { |
| 87 // This is the only place in Blink that is using addReturnIterator. | 87 // This is the only place in Blink that is using addReturnIterator. |
| 88 FontFaceList::iterator iterator = m_fontFaces.addReturnIterator(fontFace
); | 88 FontFaceList::iterator iterator = m_fontFaces.addReturnIterator(fontFace
); |
| 89 if (m_firstNonCssConnectedFace == m_fontFaces.end()) | 89 if (m_firstNonCssConnectedFace == m_fontFaces.end()) |
| 90 m_firstNonCssConnectedFace = iterator; | 90 m_firstNonCssConnectedFace = iterator; |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 void CSSSegmentedFontFace::removeFontFace(PassRefPtrWillBeRawPtr<FontFace> prpFo
ntFace) | 94 void CSSSegmentedFontFace::removeFontFace(RawPtr<FontFace> prpFontFace) |
| 95 { | 95 { |
| 96 RefPtrWillBeRawPtr<FontFace> fontFace = prpFontFace; | 96 RawPtr<FontFace> fontFace = prpFontFace; |
| 97 FontFaceList::iterator it = m_fontFaces.find(fontFace); | 97 FontFaceList::iterator it = m_fontFaces.find(fontFace); |
| 98 if (it == m_fontFaces.end()) | 98 if (it == m_fontFaces.end()) |
| 99 return; | 99 return; |
| 100 | 100 |
| 101 if (it == m_firstNonCssConnectedFace) | 101 if (it == m_firstNonCssConnectedFace) |
| 102 ++m_firstNonCssConnectedFace; | 102 ++m_firstNonCssConnectedFace; |
| 103 m_fontFaces.remove(it); | 103 m_fontFaces.remove(it); |
| 104 | 104 |
| 105 pruneTable(); | 105 pruneTable(); |
| 106 fontFace->cssFontFace()->clearSegmentedFontFace(); | 106 fontFace->cssFontFace()->clearSegmentedFontFace(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 bool CSSSegmentedFontFace::checkFont(const String& text) const | 178 bool CSSSegmentedFontFace::checkFont(const String& text) const |
| 179 { | 179 { |
| 180 for (const auto& fontFace : m_fontFaces) { | 180 for (const auto& fontFace : m_fontFaces) { |
| 181 if (fontFace->loadStatus() != FontFace::Loaded && fontFace->cssFontFace(
)->ranges().intersectsWith(text)) | 181 if (fontFace->loadStatus() != FontFace::Loaded && fontFace->cssFontFace(
)->ranges().intersectsWith(text)) |
| 182 return false; | 182 return false; |
| 183 } | 183 } |
| 184 return true; | 184 return true; |
| 185 } | 185 } |
| 186 | 186 |
| 187 void CSSSegmentedFontFace::match(const String& text, WillBeHeapVector<RefPtrWill
BeMember<FontFace>>& faces) const | 187 void CSSSegmentedFontFace::match(const String& text, HeapVector<Member<FontFace>
>& faces) const |
| 188 { | 188 { |
| 189 for (const auto& fontFace : m_fontFaces) { | 189 for (const auto& fontFace : m_fontFaces) { |
| 190 if (fontFace->cssFontFace()->ranges().intersectsWith(text)) | 190 if (fontFace->cssFontFace()->ranges().intersectsWith(text)) |
| 191 faces.append(fontFace); | 191 faces.append(fontFace); |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 | 194 |
| 195 DEFINE_TRACE(CSSSegmentedFontFace) | 195 DEFINE_TRACE(CSSSegmentedFontFace) |
| 196 { | 196 { |
| 197 #if ENABLE(OILPAN) | 197 #if ENABLE(OILPAN) |
| 198 visitor->trace(m_fontSelector); | 198 visitor->trace(m_fontSelector); |
| 199 visitor->trace(m_fontFaces); | 199 visitor->trace(m_fontFaces); |
| 200 #endif | 200 #endif |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace blink | 203 } // namespace blink |
| OLD | NEW |