1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "PostTraversalTask.h"
9 #include "mozilla/dom/FontFace.h"
10 #include "mozilla/dom/FontFaceSet.h"
11 #include "mozilla/dom/FontFaceSetImpl.h"
12 #include "gfxPlatformFontList.h"
13 #include "gfxTextRun.h"
14 #include "ServoStyleSet.h"
15 #include "nsPresContext.h"
21 void PostTraversalTask::Run() {
23 case Type::ResolveFontFaceLoadedPromise
:
24 static_cast<FontFace
*>(mTarget
)->MaybeResolve();
27 case Type::RejectFontFaceLoadedPromise
:
28 static_cast<FontFace
*>(mTarget
)->MaybeReject(mResult
);
31 case Type::DispatchLoadingEventAndReplaceReadyPromise
:
32 static_cast<FontFaceSet
*>(mTarget
)
33 ->DispatchLoadingEventAndReplaceReadyPromise();
36 case Type::DispatchFontFaceSetCheckLoadingFinishedAfterDelay
:
37 static_cast<FontFaceSetImpl
*>(mTarget
)
38 ->DispatchCheckLoadingFinishedAfterDelay();
41 case Type::LoadFontEntry
:
42 static_cast<gfxUserFontEntry
*>(mTarget
)->ContinueLoad();
45 case Type::InitializeFamily
:
46 Unused
<< gfxPlatformFontList::PlatformFontList()->InitializeFamily(
47 static_cast<fontlist::Family
*>(mTarget
));
50 case Type::FontInfoUpdate
:
51 if (auto* pc
= static_cast<ServoStyleSet
*>(mTarget
)->GetPresContext()) {
52 pc
->ForceReflowForFontInfoUpdateFromStyle();
58 } // namespace mozilla