gfx/thebes/gfxPlatformGtk.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     2  * This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef GFX_PLATFORM_GTK_H
     7 #define GFX_PLATFORM_GTK_H
     9 #include "gfxPlatform.h"
    10 #include "nsAutoRef.h"
    11 #include "nsTArray.h"
    13 #if (MOZ_WIDGET_GTK == 2)
    14 extern "C" {
    15     typedef struct _GdkDrawable GdkDrawable;
    16 }
    17 #endif
    19 class gfxFontconfigUtils;
    21 class gfxPlatformGtk : public gfxPlatform {
    22 public:
    23     gfxPlatformGtk();
    24     virtual ~gfxPlatformGtk();
    26     static gfxPlatformGtk *GetPlatform() {
    27         return (gfxPlatformGtk*) gfxPlatform::GetPlatform();
    28     }
    30     virtual already_AddRefed<gfxASurface>
    31       CreateOffscreenSurface(const IntSize& size,
    32                              gfxContentType contentType) MOZ_OVERRIDE;
    34     mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
    35       GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont);
    37     nsresult GetFontList(nsIAtom *aLangGroup,
    38                          const nsACString& aGenericFamily,
    39                          nsTArray<nsString>& aListOfFonts);
    41     nsresult UpdateFontList();
    43     nsresult ResolveFontName(const nsAString& aFontName,
    44                              FontResolverCallback aCallback,
    45                              void *aClosure, bool& aAborted);
    47     nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
    49     gfxFontGroup *CreateFontGroup(const nsAString &aFamilies,
    50                                   const gfxFontStyle *aStyle,
    51                                   gfxUserFontSet *aUserFontSet);
    53     /**
    54      * Look up a local platform font using the full font face name (needed to
    55      * support @font-face src local() )
    56      */
    57     virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
    58                                           const nsAString& aFontName);
    60     /**
    61      * Activate a platform font (needed to support @font-face src url() )
    62      *
    63      */
    64     virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
    65                                            const uint8_t *aFontData,
    66                                            uint32_t aLength);
    68     /**
    69      * Check whether format is supported on a platform or not (if unclear,
    70      * returns true).
    71      */
    72     virtual bool IsFontFormatSupported(nsIURI *aFontURI,
    73                                          uint32_t aFormatFlags);
    75 #if (MOZ_WIDGET_GTK == 2)
    76     static void SetGdkDrawable(cairo_surface_t *target,
    77                                GdkDrawable *drawable);
    78     static GdkDrawable *GetGdkDrawable(cairo_surface_t *target);
    79 #endif
    81     static int32_t GetDPI();
    83     bool UseXRender() {
    84 #if defined(MOZ_X11)
    85         if (GetContentBackend() != mozilla::gfx::BackendType::NONE &&
    86             GetContentBackend() != mozilla::gfx::BackendType::CAIRO)
    87             return false;
    89         return sUseXRender;
    90 #else
    91         return false;
    92 #endif
    93     }
    95     virtual gfxImageFormat GetOffscreenFormat();
    97     virtual int GetScreenDepth() const;
    99 protected:
   100     static gfxFontconfigUtils *sFontconfigUtils;
   102 private:
   103     virtual void GetPlatformCMSOutputProfile(void *&mem, size_t &size);
   105     virtual bool SupportsOffMainThreadCompositing();
   106 #ifdef MOZ_X11
   107     static bool sUseXRender;
   108 #endif
   109 };
   111 #endif /* GFX_PLATFORM_GTK_H */

mercurial