tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PostTraversalTask.cpp (1835B)


      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/. */
      6 
      7 #include "PostTraversalTask.h"
      8 
      9 #include "ServoStyleSet.h"
     10 #include "gfxPlatformFontList.h"
     11 #include "gfxTextRun.h"
     12 #include "mozilla/dom/FontFace.h"
     13 #include "mozilla/dom/FontFaceSet.h"
     14 #include "mozilla/dom/FontFaceSetImpl.h"
     15 #include "nsPresContext.h"
     16 
     17 namespace mozilla {
     18 
     19 using namespace dom;
     20 
     21 void PostTraversalTask::Run() {
     22  switch (mType) {
     23    case Type::ResolveFontFaceLoadedPromise:
     24      static_cast<FontFace*>(mTarget)->MaybeResolve();
     25      break;
     26 
     27    case Type::RejectFontFaceLoadedPromise:
     28      static_cast<FontFace*>(mTarget)->MaybeReject(mResult.extract(),
     29                                                   std::move(mMessage));
     30      break;
     31 
     32    case Type::DispatchLoadingEventAndReplaceReadyPromise:
     33      static_cast<FontFaceSet*>(mTarget)
     34          ->DispatchLoadingEventAndReplaceReadyPromise();
     35      break;
     36 
     37    case Type::DispatchFontFaceSetCheckLoadingFinishedAfterDelay:
     38      static_cast<FontFaceSetImpl*>(mTarget)
     39          ->DispatchCheckLoadingFinishedAfterDelay();
     40      break;
     41 
     42    case Type::LoadFontEntry:
     43      static_cast<gfxUserFontEntry*>(mTarget)->ContinueLoad();
     44      break;
     45 
     46    case Type::InitializeFamily:
     47      (void)gfxPlatformFontList::PlatformFontList()->InitializeFamily(
     48          static_cast<fontlist::Family*>(mTarget));
     49      break;
     50 
     51    case Type::FontInfoUpdate:
     52      if (auto* pc = static_cast<ServoStyleSet*>(mTarget)->GetPresContext()) {
     53        pc->ForceReflowForFontInfoUpdateFromStyle();
     54      }
     55      break;
     56  }
     57 }
     58 
     59 }  // namespace mozilla