Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/widget/headless/HeadlessLookAndFeel.h
Line
Count
Source (jump to first uncovered line)
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
#ifndef mozilla_widget_HeadlessLookAndFeel_h
8
#define mozilla_widget_HeadlessLookAndFeel_h
9
10
#include "nsXPLookAndFeel.h"
11
#include "nsLookAndFeel.h"
12
13
namespace mozilla {
14
namespace widget {
15
16
#if defined(MOZ_WIDGET_GTK)
17
18
// Our nsLookAndFeel for GTK relies on APIs that aren't available in headless
19
// mode, so we use an implementation with hardcoded values.
20
21
class HeadlessLookAndFeel: public nsXPLookAndFeel {
22
public:
23
  HeadlessLookAndFeel();
24
  virtual ~HeadlessLookAndFeel();
25
26
  virtual nsresult NativeGetColor(ColorID aID, nscolor &aResult) override;
27
0
  void NativeInit() final {};
28
  virtual nsresult GetIntImpl(IntID aID, int32_t &aResult) override;
29
  virtual nsresult GetFloatImpl(FloatID aID, float &aResult) override;
30
  virtual bool GetFontImpl(FontID aID,
31
                           nsString& aFontName,
32
                           gfxFontStyle& aFontStyle,
33
                           float aDevPixPerCSSPixel) override;
34
35
  virtual void RefreshImpl() override;
36
  virtual char16_t GetPasswordCharacterImpl() override;
37
  virtual bool GetEchoPasswordImpl() override;
38
};
39
40
#else
41
42
// When possible, we simply reuse the platform's existing nsLookAndFeel
43
// implementation in headless mode.
44
45
typedef nsLookAndFeel HeadlessLookAndFeel;
46
47
#endif
48
49
} // namespace widget
50
} // namespace mozilla
51
52
#endif