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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 f = f->next()) { | 387 f = f->next()) { |
388 CSSSegmentedFontFace* segmentedFontFace = | 388 CSSSegmentedFontFace* segmentedFontFace = |
389 fontFaceCache->get(font.getFontDescription(), f->family()); | 389 fontFaceCache->get(font.getFontDescription(), f->family()); |
390 if (segmentedFontFace) | 390 if (segmentedFontFace) |
391 segmentedFontFace->match(text, faces); | 391 segmentedFontFace->match(text, faces); |
392 } | 392 } |
393 | 393 |
394 LoadFontPromiseResolver* resolver = | 394 LoadFontPromiseResolver* resolver = |
395 LoadFontPromiseResolver::create(faces, scriptState); | 395 LoadFontPromiseResolver::create(faces, scriptState); |
396 ScriptPromise promise = resolver->promise(); | 396 ScriptPromise promise = resolver->promise(); |
397 resolver->loadFonts( | 397 // After this, resolver->promise() may return null. |
398 getExecutionContext()); // After this, resolver->promise() may return nul
l. | 398 resolver->loadFonts(getExecutionContext()); |
399 return promise; | 399 return promise; |
400 } | 400 } |
401 | 401 |
402 bool FontFaceSet::check(const String& fontString, | 402 bool FontFaceSet::check(const String& fontString, |
403 const String& text, | 403 const String& text, |
404 ExceptionState& exceptionState) { | 404 ExceptionState& exceptionState) { |
405 if (!inActiveDocumentContext()) | 405 if (!inActiveDocumentContext()) |
406 return false; | 406 return false; |
407 | 407 |
408 Font font; | 408 Font font; |
(...skipping 25 matching lines...) Expand all Loading... |
434 f->family())) | 434 f->family())) |
435 return true; | 435 return true; |
436 } | 436 } |
437 return false; | 437 return false; |
438 } | 438 } |
439 | 439 |
440 bool FontFaceSet::resolveFontStyle(const String& fontString, Font& font) { | 440 bool FontFaceSet::resolveFontStyle(const String& fontString, Font& font) { |
441 if (fontString.isEmpty()) | 441 if (fontString.isEmpty()) |
442 return false; | 442 return false; |
443 | 443 |
444 // Interpret fontString in the same way as the 'font' attribute of CanvasRende
ringContext2D. | 444 // Interpret fontString in the same way as the 'font' attribute of |
| 445 // CanvasRenderingContext2D. |
445 MutableStylePropertySet* parsedStyle = | 446 MutableStylePropertySet* parsedStyle = |
446 MutableStylePropertySet::create(HTMLStandardMode); | 447 MutableStylePropertySet::create(HTMLStandardMode); |
447 CSSParser::parseValue(parsedStyle, CSSPropertyFont, fontString, true, 0); | 448 CSSParser::parseValue(parsedStyle, CSSPropertyFont, fontString, true, 0); |
448 if (parsedStyle->isEmpty()) | 449 if (parsedStyle->isEmpty()) |
449 return false; | 450 return false; |
450 | 451 |
451 String fontValue = parsedStyle->getPropertyValue(CSSPropertyFont); | 452 String fontValue = parsedStyle->getPropertyValue(CSSPropertyFont); |
452 if (fontValue == "inherit" || fontValue == "initial") | 453 if (fontValue == "inherit" || fontValue == "initial") |
453 return false; | 454 return false; |
454 | 455 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 visitor->trace(m_failedFonts); | 559 visitor->trace(m_failedFonts); |
559 visitor->trace(m_nonCSSConnectedFaces); | 560 visitor->trace(m_nonCSSConnectedFaces); |
560 visitor->trace(m_asyncRunner); | 561 visitor->trace(m_asyncRunner); |
561 EventTargetWithInlineData::trace(visitor); | 562 EventTargetWithInlineData::trace(visitor); |
562 Supplement<Document>::trace(visitor); | 563 Supplement<Document>::trace(visitor); |
563 ActiveDOMObject::trace(visitor); | 564 ActiveDOMObject::trace(visitor); |
564 FontFace::LoadFontCallback::trace(visitor); | 565 FontFace::LoadFontCallback::trace(visitor); |
565 } | 566 } |
566 | 567 |
567 } // namespace blink | 568 } // namespace blink |
OLD | NEW |