Bug 1700051: part 48) Slightly simplify `mozInlineSpellWordUtil::FindRealWordContaini...
[gecko.git] / layout / style / PostTraversalTask.cpp
blob22a4b7b40abe0cc146529cdc5f746e57e9a92d09
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 "gfxPlatformFontList.h"
12 #include "gfxTextRun.h"
13 #include "ServoStyleSet.h"
14 #include "nsPresContext.h"
16 namespace mozilla {
18 using namespace dom;
20 void PostTraversalTask::Run() {
21 switch (mType) {
22 case Type::ResolveFontFaceLoadedPromise:
23 static_cast<FontFace*>(mTarget)->DoResolve();
24 break;
26 case Type::RejectFontFaceLoadedPromise:
27 static_cast<FontFace*>(mTarget)->DoReject(mResult);
28 break;
30 case Type::DispatchLoadingEventAndReplaceReadyPromise:
31 static_cast<FontFaceSet*>(mTarget)
32 ->DispatchLoadingEventAndReplaceReadyPromise();
33 break;
35 case Type::DispatchFontFaceSetCheckLoadingFinishedAfterDelay:
36 static_cast<FontFaceSet*>(mTarget)
37 ->DispatchCheckLoadingFinishedAfterDelay();
38 break;
40 case Type::LoadFontEntry:
41 static_cast<gfxUserFontEntry*>(mTarget)->ContinueLoad();
42 break;
44 case Type::InitializeFamily:
45 Unused << gfxPlatformFontList::PlatformFontList()->InitializeFamily(
46 static_cast<fontlist::Family*>(mTarget));
47 break;
49 case Type::FontInfoUpdate:
50 nsPresContext* pc =
51 static_cast<ServoStyleSet*>(mTarget)->GetPresContext();
52 if (pc) {
53 pc->ForceReflowForFontInfoUpdate();
55 break;
59 } // namespace mozilla