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 #ifndef mozilla_widget_HeadlessLookAndFeel_h
8 #define mozilla_widget_HeadlessLookAndFeel_h
10 #include "nsXPLookAndFeel.h"
11 #include "nsLookAndFeel.h"
16 #if defined(MOZ_WIDGET_GTK)
18 // Our nsLookAndFeel for Gtk relies on APIs that aren't available in headless
19 // mode, so for processes that are unable to connect to a display server, we use
20 // an implementation with hardcoded values.
22 // HeadlessLookAndFeel is used:
24 // * in the parent process, when full headless mode (MOZ_HEADLESS=1) is
27 // The result of this is that when headless content mode is enabled, content
28 // processes use values derived from the parent's nsLookAndFeel (i.e., values
29 // derived from Gtk APIs) while still refraining from making any display server
32 class HeadlessLookAndFeel
: public nsXPLookAndFeel
{
34 explicit HeadlessLookAndFeel();
35 virtual ~HeadlessLookAndFeel();
37 void NativeInit() final
{};
38 nsresult
NativeGetInt(IntID
, int32_t& aResult
) override
;
39 nsresult
NativeGetFloat(FloatID
, float& aResult
) override
;
40 nsresult
NativeGetColor(ColorID
, ColorScheme
, nscolor
& aResult
) override
;
41 bool NativeGetFont(FontID
, nsString
& aFontName
, gfxFontStyle
&) override
;
43 char16_t
GetPasswordCharacterImpl() override
;
48 // When possible, we simply reuse the platform's existing nsLookAndFeel
49 // implementation in headless mode.
51 typedef nsLookAndFeel HeadlessLookAndFeel
;
56 } // namespace mozilla