[CSS Container Queries] Basic support for container units
[webkit.git] / Source / WebCore / css / CSSUnits.h
blob5da0acfb1140f4ab763010e8469b735e90f52045
1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2008, 2019 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #pragma once
24 namespace WTF {
25 class TextStream;
28 namespace WebCore {
30 // FIXME: No need to use all capitals and a CSS prefix on all these names. Should fix that.
31 enum class CSSUnitType : uint8_t {
32 CSS_UNKNOWN,
33 CSS_NUMBER,
34 CSS_INTEGER,
35 CSS_PERCENTAGE,
36 CSS_EMS,
37 CSS_EXS,
38 CSS_PX,
39 CSS_CM,
40 CSS_MM,
41 CSS_IN,
42 CSS_PT,
43 CSS_PC,
44 CSS_DEG,
45 CSS_RAD,
46 CSS_GRAD,
47 CSS_MS,
48 CSS_S,
49 CSS_HZ,
50 CSS_KHZ,
51 CSS_DIMENSION,
52 CSS_STRING,
53 CSS_URI,
54 CSS_IDENT,
55 CSS_ATTR,
56 CSS_COUNTER,
57 CSS_RECT,
58 CSS_RGBCOLOR,
60 CSS_VW,
61 CSS_VH,
62 CSS_VMIN,
63 CSS_VMAX,
64 CSS_VB,
65 CSS_VI,
66 CSS_SVW,
67 CSS_SVH,
68 CSS_SVMIN,
69 CSS_SVMAX,
70 CSS_SVB,
71 CSS_SVI,
72 CSS_LVW,
73 CSS_LVH,
74 CSS_LVMIN,
75 CSS_LVMAX,
76 CSS_LVB,
77 CSS_LVI,
78 CSS_DVW,
79 CSS_DVH,
80 CSS_DVMIN,
81 CSS_DVMAX,
82 CSS_DVB,
83 CSS_DVI,
84 FirstViewportCSSUnitType = CSS_VW,
85 LastViewporCSSUnitType = CSS_DVI,
87 CSS_CQW,
88 CSS_CQH,
89 CSS_CQI,
90 CSS_CQB,
91 CSS_CQMIN,
92 CSS_CQMAX,
94 CSS_DPPX,
95 CSS_X,
96 CSS_DPI,
97 CSS_DPCM,
98 CSS_FR,
99 CSS_Q,
100 CSS_LHS,
101 CSS_RLHS,
103 CustomIdent,
105 CSS_PAIR,
106 CSS_UNICODE_RANGE,
107 CSS_TURN,
108 CSS_REMS,
109 CSS_CHS,
110 CSS_IC,
112 CSS_COUNTER_NAME,
114 CSS_SHAPE,
116 CSS_QUAD,
118 CSS_CALC,
119 CSS_CALC_PERCENTAGE_WITH_NUMBER,
120 CSS_CALC_PERCENTAGE_WITH_LENGTH,
122 CSS_FONT_FAMILY,
124 CSS_PROPERTY_ID,
125 CSS_VALUE_ID,
127 // This value is used to handle quirky margins in reflow roots (body, td, and th) like WinIE.
128 // The basic idea is that a stylesheet can use the value __qem (for quirky em) instead of em.
129 // When the quirky value is used, if you're in quirks mode, the margin will collapse away
130 // inside a table cell. This quirk is specified in the HTML spec but our impl is different.
131 CSS_QUIRKY_EMS
133 // Note that CSSValue allocates 7 bits for m_primitiveUnitType, so there can be no value here > 127.
136 enum class CSSUnitCategory : uint8_t {
137 Number,
138 Percent,
139 Length,
140 Angle,
141 Time,
142 Frequency,
143 Resolution,
144 Other
147 CSSUnitCategory unitCategory(CSSUnitType);
148 CSSUnitType canonicalUnitTypeForCategory(CSSUnitCategory);
149 CSSUnitType canonicalUnitType(CSSUnitType);
151 WTF::TextStream& operator<<(WTF::TextStream&, CSSUnitCategory);
152 WTF::TextStream& operator<<(WTF::TextStream&, CSSUnitType);
154 } // namespace WebCore