| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are met: | 5 * modification, are permitted provided that the following conditions are met: |
| 6 * | 6 * |
| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // So synchronously update style and layout here. | 250 // So synchronously update style and layout here. |
| 251 // This may trigger font loads, and replace |m_ready| with a new Promise. | 251 // This may trigger font loads, and replace |m_ready| with a new Promise. |
| 252 document()->updateStyleAndLayout(); | 252 document()->updateStyleAndLayout(); |
| 253 } | 253 } |
| 254 return m_ready->promise(scriptState->world()); | 254 return m_ready->promise(scriptState->world()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 FontFaceSet* FontFaceSet::addForBinding(ScriptState*, | 257 FontFaceSet* FontFaceSet::addForBinding(ScriptState*, |
| 258 FontFace* fontFace, | 258 FontFace* fontFace, |
| 259 ExceptionState&) { | 259 ExceptionState&) { |
| 260 ASSERT(fontFace); | 260 DCHECK(fontFace); |
| 261 if (!inActiveDocumentContext()) | 261 if (!inActiveDocumentContext()) |
| 262 return this; | 262 return this; |
| 263 if (m_nonCSSConnectedFaces.contains(fontFace)) | 263 if (m_nonCSSConnectedFaces.contains(fontFace)) |
| 264 return this; | 264 return this; |
| 265 if (isCSSConnectedFontFace(fontFace)) | 265 if (isCSSConnectedFontFace(fontFace)) |
| 266 return this; | 266 return this; |
| 267 CSSFontSelector* fontSelector = document()->styleEngine().fontSelector(); | 267 CSSFontSelector* fontSelector = document()->styleEngine().fontSelector(); |
| 268 m_nonCSSConnectedFaces.insert(fontFace); | 268 m_nonCSSConnectedFaces.insert(fontFace); |
| 269 fontSelector->fontFaceCache()->addFontFace(fontSelector, fontFace, false); | 269 fontSelector->fontFaceCache()->addFontFace(fontSelector, fontFace, false); |
| 270 if (fontFace->loadStatus() == FontFace::Loading) | 270 if (fontFace->loadStatus() == FontFace::Loading) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 283 if (fontFace->loadStatus() == FontFace::Loading) | 283 if (fontFace->loadStatus() == FontFace::Loading) |
| 284 removeFromLoadingFonts(fontFace); | 284 removeFromLoadingFonts(fontFace); |
| 285 } | 285 } |
| 286 m_nonCSSConnectedFaces.clear(); | 286 m_nonCSSConnectedFaces.clear(); |
| 287 fontSelector->fontFaceInvalidated(); | 287 fontSelector->fontFaceInvalidated(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 bool FontFaceSet::deleteForBinding(ScriptState*, | 290 bool FontFaceSet::deleteForBinding(ScriptState*, |
| 291 FontFace* fontFace, | 291 FontFace* fontFace, |
| 292 ExceptionState&) { | 292 ExceptionState&) { |
| 293 ASSERT(fontFace); | 293 DCHECK(fontFace); |
| 294 if (!inActiveDocumentContext()) | 294 if (!inActiveDocumentContext()) |
| 295 return false; | 295 return false; |
| 296 HeapListHashSet<Member<FontFace>>::iterator it = | 296 HeapListHashSet<Member<FontFace>>::iterator it = |
| 297 m_nonCSSConnectedFaces.find(fontFace); | 297 m_nonCSSConnectedFaces.find(fontFace); |
| 298 if (it != m_nonCSSConnectedFaces.end()) { | 298 if (it != m_nonCSSConnectedFaces.end()) { |
| 299 m_nonCSSConnectedFaces.erase(it); | 299 m_nonCSSConnectedFaces.erase(it); |
| 300 CSSFontSelector* fontSelector = document()->styleEngine().fontSelector(); | 300 CSSFontSelector* fontSelector = document()->styleEngine().fontSelector(); |
| 301 fontSelector->fontFaceCache()->removeFontFace(fontFace, false); | 301 fontSelector->fontFaceCache()->removeFontFace(fontFace, false); |
| 302 if (fontFace->loadStatus() == FontFace::Loading) | 302 if (fontFace->loadStatus() == FontFace::Loading) |
| 303 removeFromLoadingFonts(fontFace); | 303 removeFromLoadingFonts(fontFace); |
| 304 fontSelector->fontFaceInvalidated(); | 304 fontSelector->fontFaceInvalidated(); |
| 305 return true; | 305 return true; |
| 306 } | 306 } |
| 307 return false; | 307 return false; |
| 308 } | 308 } |
| 309 | 309 |
| 310 bool FontFaceSet::hasForBinding(ScriptState*, | 310 bool FontFaceSet::hasForBinding(ScriptState*, |
| 311 FontFace* fontFace, | 311 FontFace* fontFace, |
| 312 ExceptionState&) const { | 312 ExceptionState&) const { |
| 313 ASSERT(fontFace); | 313 DCHECK(fontFace); |
| 314 if (!inActiveDocumentContext()) | 314 if (!inActiveDocumentContext()) |
| 315 return false; | 315 return false; |
| 316 return m_nonCSSConnectedFaces.contains(fontFace) || | 316 return m_nonCSSConnectedFaces.contains(fontFace) || |
| 317 isCSSConnectedFontFace(fontFace); | 317 isCSSConnectedFontFace(fontFace); |
| 318 } | 318 } |
| 319 | 319 |
| 320 const HeapListHashSet<Member<FontFace>>& FontFaceSet::cssConnectedFontFaceList() | 320 const HeapListHashSet<Member<FontFace>>& FontFaceSet::cssConnectedFontFaceList() |
| 321 const { | 321 const { |
| 322 Document* document = this->document(); | 322 Document* document = this->document(); |
| 323 document->updateActiveStyle(); | 323 document->updateActiveStyle(); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 visitor->trace(m_failedFonts); | 569 visitor->trace(m_failedFonts); |
| 570 visitor->trace(m_nonCSSConnectedFaces); | 570 visitor->trace(m_nonCSSConnectedFaces); |
| 571 visitor->trace(m_asyncRunner); | 571 visitor->trace(m_asyncRunner); |
| 572 EventTargetWithInlineData::trace(visitor); | 572 EventTargetWithInlineData::trace(visitor); |
| 573 Supplement<Document>::trace(visitor); | 573 Supplement<Document>::trace(visitor); |
| 574 SuspendableObject::trace(visitor); | 574 SuspendableObject::trace(visitor); |
| 575 FontFace::LoadFontCallback::trace(visitor); | 575 FontFace::LoadFontCallback::trace(visitor); |
| 576 } | 576 } |
| 577 | 577 |
| 578 } // namespace blink | 578 } // namespace blink |
| OLD | NEW |