Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/MediaFeatureChange.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
/* A struct defining a media feature change. */
8
9
#ifndef mozilla_MediaFeatureChange_h__
10
#define mozilla_MediaFeatureChange_h__
11
12
#include "nsChangeHint.h"
13
#include "mozilla/Attributes.h"
14
#include "mozilla/TypedEnumBits.h"
15
16
namespace mozilla {
17
18
enum class MediaFeatureChangeReason
19
{
20
  // The viewport size the document has used has changed.
21
  //
22
  // This affects size media queries like min-width.
23
  ViewportChange = 1 << 0,
24
  // The effective text zoom has changed. This affects the meaning of em units,
25
  // and thus affects any media query that uses a Length.
26
  ZoomChange = 1 << 1,
27
  // The base min font size has changed. This can affect the meaning of em
28
  // units, if the previous default font-size has changed, and also zoom.
29
  MinFontSizeChange = 1 << 2,
30
  // The resolution has changed. This can affect device-pixel-ratio media
31
  // queries, for example.
32
  ResolutionChange = 1 << 3,
33
  // The medium has changed.
34
  MediumChange = 1 << 4,
35
  // The size-mode has changed.
36
  SizeModeChange = 1 << 5,
37
  // A system metric or multiple have changed. This affects all the media
38
  // features that expose the presence of a system metric directly.
39
  SystemMetricsChange = 1 << 6,
40
  // The fact of whether the device size is the page size has changed, thus
41
  // resolution media queries can change.
42
  DeviceSizeIsPageSizeChange = 1 << 7,
43
  // display-mode changed on the document, thus the display-mode media queries
44
  // may have changed.
45
  DisplayModeChange = 1 << 8,
46
};
47
48
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(MediaFeatureChangeReason)
49
50
struct MediaFeatureChange
51
{
52
  nsRestyleHint mRestyleHint;
53
  nsChangeHint mChangeHint;
54
  MediaFeatureChangeReason mReason;
55
56
  MOZ_IMPLICIT MediaFeatureChange(MediaFeatureChangeReason aReason)
57
    : MediaFeatureChange(nsRestyleHint(0), nsChangeHint(0), aReason)
58
0
  {
59
0
  }
60
61
  MediaFeatureChange(nsRestyleHint aRestyleHint,
62
                     nsChangeHint aChangeHint,
63
                     MediaFeatureChangeReason aReason)
64
    : mRestyleHint(aRestyleHint)
65
    , mChangeHint(aChangeHint)
66
    , mReason(aReason)
67
0
  {
68
0
  }
69
70
  inline MediaFeatureChange& operator|=(const MediaFeatureChange& aOther)
71
0
  {
72
0
    mRestyleHint |= aOther.mRestyleHint;
73
0
    mChangeHint |= aOther.mChangeHint;
74
0
    mReason |= aOther.mReason;
75
0
    return *this;
76
0
  }
77
};
78
79
} // namespace mozilla
80
81
#endif