1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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/. */
10 #include "mozilla/TypedEnumBits.h"
13 enum class StyleGenericFontFamily
: uint32_t;
16 typedef struct _cairo_surface cairo_surface_t
;
17 typedef struct _cairo_user_data_key cairo_user_data_key_t
;
19 typedef void (*thebes_destroy_func_t
)(void* data
);
22 * Currently needs to be 'double' for Cairo compatibility. Could
23 * become 'float', perhaps, in some configurations.
25 typedef double gfxFloat
;
28 * Priority of a line break opportunity.
30 * eNoBreak The line has no break opportunities
31 * eWordWrapBreak The line has a break opportunity only within a word. With
32 * overflow-wrap|word-wrap: break-word we will break at this
33 * point only if there are no other break opportunities in the
35 * eNormalBreak The line has a break opportunity determined by the standard
36 * line-breaking algorithm.
38 * Future expansion: split eNormalBreak into multiple priorities, e.g.
39 * punctuation break and whitespace break (bug 389710).
40 * As and when we implement it, text-wrap: unrestricted will
41 * mean that priorities are ignored and all line-break
42 * opportunities are equal.
44 * @see gfxTextRun::BreakAndMeasureText
45 * @see nsLineLayout::NotifyOptionalBreakPosition
47 enum class gfxBreakPriority
{ eNoBreak
= 0, eWordWrapBreak
, eNormalBreak
};
49 enum class gfxSurfaceType
{
55 Glitz
, // unused, but needed for cairo parity
59 DirectFB
, // unused, but needed for cairo parity
77 enum class gfxContentType
{
84 enum class gfxAlphaType
{
91 * Type used to record how a particular font is selected during the font-
92 * matching process, so that this can be exposed to the Inspector.
94 struct FontMatchType
{
95 enum class Kind
: uint8_t {
98 kPrefsFallback
= 1 << 1,
99 kSystemFallback
= 1 << 2,
102 inline FontMatchType
& operator|=(const FontMatchType
& aOther
);
104 bool operator==(const FontMatchType
& aOther
) const {
105 return kind
== aOther
.kind
&& generic
== aOther
.generic
;
108 bool operator!=(const FontMatchType
& aOther
) const {
109 return !(*this == aOther
);
112 MOZ_IMPLICIT
FontMatchType() = default;
113 MOZ_IMPLICIT
FontMatchType(Kind aKind
) : kind(aKind
) {}
114 FontMatchType(Kind aKind
, mozilla::StyleGenericFontFamily aGeneric
)
115 : kind(aKind
), generic(aGeneric
) {}
117 Kind kind
= static_cast<Kind
>(0);
118 // Using 0 to avoid pulling ServoStyleConsts.h everywhere.
119 mozilla::StyleGenericFontFamily generic
= mozilla::StyleGenericFontFamily(0);
122 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(FontMatchType::Kind
)
124 FontMatchType
& FontMatchType::operator|=(const FontMatchType
& aOther
) {
126 // We only keep track of one generic.
127 if (generic
!= aOther
.generic
) {
128 generic
= mozilla::StyleGenericFontFamily(0);
133 // Installation status (base system / langpack / user-installed) may determine
134 // whether the font is visible to CSS font-family or src:local() lookups.
135 // (Exactly what these mean and how accurate they are may be vary across
136 // platforms -- e.g. on Linux there is no clear "base" set of fonts.)
137 enum class FontVisibility
: uint8_t {
138 Unknown
= 0, // No categorization of families available on this system
139 Base
= 1, // Standard part of the base OS installation
140 LangPack
= 2, // From an optional OS component such as language support
141 User
= 3, // User-installed font (or installed by another app, etc)
142 Hidden
= 4, // Internal system font, should never exposed to users
143 Webfont
= 5, // Webfont defined by @font-face
144 Count
= 6, // Count of values, for IPC serialization
147 struct HwStretchingSupport
{
149 uint32_t mWindowOnly
;
150 uint32_t mFullScreenOnly
;
154 HwStretchingSupport()
155 : mBoth(0), mWindowOnly(0), mFullScreenOnly(0), mNone(0), mError(0) {}
157 bool IsFullySupported() const {
158 return mBoth
> 0 && mWindowOnly
== 0 && mFullScreenOnly
== 0 &&
159 mNone
== 0 && mError
== 0;
163 #endif /* GFX_TYPES_H */