Bug 1883861 - Part 1: Move visitMemoryBarrier into the common CodeGenerator file...
[gecko.git] / layout / style / PostTraversalTask.cpp
blobb6320641ff91c90ca51b34162c92c6ecb07fa4a2
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"
17 namespace mozilla {
19 using namespace dom;
21 void PostTraversalTask::Run() {
22 switch (mType) {
23 case Type::ResolveFontFaceLoadedPromise:
24 static_cast<FontFace*>(mTarget)->MaybeResolve();
25 break;
27 case Type::RejectFontFaceLoadedPromise:
28 static_cast<FontFace*>(mTarget)->MaybeReject(mResult);
29 break;
31 case Type::DispatchLoadingEventAndReplaceReadyPromise:
32 static_cast<FontFaceSet*>(mTarget)
33 ->DispatchLoadingEventAndReplaceReadyPromise();
34 break;
36 case Type::DispatchFontFaceSetCheckLoadingFinishedAfterDelay:
37 static_cast<FontFaceSetImpl*>(mTarget)
38 ->DispatchCheckLoadingFinishedAfterDelay();
39 break;
41 case Type::LoadFontEntry:
42 static_cast<gfxUserFontEntry*>(mTarget)->ContinueLoad();
43 break;
45 case Type::InitializeFamily:
46 Unused << gfxPlatformFontList::PlatformFontList()->InitializeFamily(
47 static_cast<fontlist::Family*>(mTarget));
48 break;
50 case Type::FontInfoUpdate:
51 if (auto* pc = static_cast<ServoStyleSet*>(mTarget)->GetPresContext()) {
52 pc->ForceReflowForFontInfoUpdateFromStyle();
54 break;
58 } // namespace mozilla