Chromium Code Reviews| 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 | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 && fontFace->setPropertyFromStyle(properties, CSSPropertyFontDisplay) | 131 && fontFace->setPropertyFromStyle(properties, CSSPropertyFontDisplay) |
| 132 && !fontFace->family().isEmpty() | 132 && !fontFace->family().isEmpty() |
| 133 && fontFace->traits().bitfield()) { | 133 && fontFace->traits().bitfield()) { |
| 134 fontFace->initCSSFontFace(document, src); | 134 fontFace->initCSSFontFace(document, src); |
| 135 return fontFace.release(); | 135 return fontFace.release(); |
| 136 } | 136 } |
| 137 return nullptr; | 137 return nullptr; |
| 138 } | 138 } |
| 139 | 139 |
| 140 FontFace::FontFace(ExecutionContext* context) | 140 FontFace::FontFace(ExecutionContext* context) |
| 141 : ActiveDOMObject(context) | 141 : ContextLifecycleObserver(context) |
| 142 , m_status(Unloaded) | 142 , m_status(Unloaded) |
| 143 { | 143 { |
| 144 suspendIfNeeded(); | |
| 145 } | 144 } |
| 146 | 145 |
| 147 FontFace::FontFace(ExecutionContext* context, const AtomicString& family, const FontFaceDescriptors& descriptors) | 146 FontFace::FontFace(ExecutionContext* context, const AtomicString& family, const FontFaceDescriptors& descriptors) |
| 148 : ActiveDOMObject(context) | 147 : ContextLifecycleObserver(context) |
| 149 , m_family(family) | 148 , m_family(family) |
| 150 , m_status(Unloaded) | 149 , m_status(Unloaded) |
| 151 { | 150 { |
| 152 Document* document = toDocument(context); | 151 Document* document = toDocument(context); |
| 153 setPropertyFromString(document, descriptors.style(), CSSPropertyFontStyle); | 152 setPropertyFromString(document, descriptors.style(), CSSPropertyFontStyle); |
| 154 setPropertyFromString(document, descriptors.weight(), CSSPropertyFontWeight) ; | 153 setPropertyFromString(document, descriptors.weight(), CSSPropertyFontWeight) ; |
| 155 setPropertyFromString(document, descriptors.stretch(), CSSPropertyFontStretc h); | 154 setPropertyFromString(document, descriptors.stretch(), CSSPropertyFontStretc h); |
| 156 setPropertyFromString(document, descriptors.unicodeRange(), CSSPropertyUnico deRange); | 155 setPropertyFromString(document, descriptors.unicodeRange(), CSSPropertyUnico deRange); |
| 157 setPropertyFromString(document, descriptors.variant(), CSSPropertyFontVarian t); | 156 setPropertyFromString(document, descriptors.variant(), CSSPropertyFontVarian t); |
| 158 setPropertyFromString(document, descriptors.featureSettings(), CSSPropertyFo ntFeatureSettings); | 157 setPropertyFromString(document, descriptors.featureSettings(), CSSPropertyFo ntFeatureSettings); |
| 159 | |
| 160 suspendIfNeeded(); | |
| 161 } | 158 } |
| 162 | 159 |
| 163 FontFace::~FontFace() | 160 FontFace::~FontFace() |
| 164 { | 161 { |
| 165 } | 162 } |
| 166 | 163 |
| 167 String FontFace::style() const | 164 String FontFace::style() const |
| 168 { | 165 { |
| 169 return m_style ? m_style->cssText() : "normal"; | 166 return m_style ? m_style->cssText() : "normal"; |
| 170 } | 167 } |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 visitor->trace(m_weight); | 626 visitor->trace(m_weight); |
| 630 visitor->trace(m_stretch); | 627 visitor->trace(m_stretch); |
| 631 visitor->trace(m_unicodeRange); | 628 visitor->trace(m_unicodeRange); |
| 632 visitor->trace(m_variant); | 629 visitor->trace(m_variant); |
| 633 visitor->trace(m_featureSettings); | 630 visitor->trace(m_featureSettings); |
| 634 visitor->trace(m_display); | 631 visitor->trace(m_display); |
| 635 visitor->trace(m_error); | 632 visitor->trace(m_error); |
| 636 visitor->trace(m_loadedProperty); | 633 visitor->trace(m_loadedProperty); |
| 637 visitor->trace(m_cssFontFace); | 634 visitor->trace(m_cssFontFace); |
| 638 visitor->trace(m_callbacks); | 635 visitor->trace(m_callbacks); |
| 639 ActiveDOMObject::trace(visitor); | 636 ContextLifecycleObserver::trace(visitor); |
| 640 } | 637 } |
| 641 | 638 |
| 642 bool FontFace::hadBlankText() const | 639 bool FontFace::hadBlankText() const |
| 643 { | 640 { |
| 644 return m_cssFontFace->hadBlankText(); | 641 return m_cssFontFace->hadBlankText(); |
| 645 } | 642 } |
| 646 | 643 |
| 647 bool FontFace::hasPendingActivity() const | 644 bool FontFace::hasPendingActivity() const |
| 648 { | 645 { |
| 649 return m_status == Loading && executionContext() && !executionContext()->act iveDOMObjectsAreStopped(); | 646 return m_status == Loading && executionContext() && !executionContext()->act iveDOMObjectsAreStopped(); |
|
sof
2016/02/29 08:38:51
So FontFace is only a ContextLifecycleObserver to
haraken
2016/02/29 08:58:00
Good point. At the very least, we shouldn't need t
sof
2016/02/29 09:02:23
Thanks, good plan.
| |
| 650 } | 647 } |
| 651 | 648 |
| 652 } // namespace blink | 649 } // namespace blink |
| OLD | NEW |