source: webkit/trunk/Source/WebCore/css/CSSUnits.h

Last change on this file was 295219, checked in by [email protected], 3 years ago

Implement CSSNumericValue.to
https://bugs.webkit.org/show_bug.cgi?id=241167

Reviewed by Chris Dumez.

  • LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssRotate.tentative-expected.txt:
  • LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/numeric-objects/cssMathValue.tentative-expected.txt:
  • LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/numeric-objects/to.tentative-expected.txt:
  • LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/numeric-objects/toSum.tentative-expected.txt:
  • Source/WebCore/css/CSSUnits.cpp:

(WebCore::canonicalUnitType): Deleted.

  • Source/WebCore/css/CSSUnits.h:
  • Source/WebCore/css/typedom/CSSNumericValue.cpp:

(WebCore::operationOnValuesOfSameUnit):
(WebCore::CSSNumericValue::multiplyInternal):
(WebCore::CSSNumericValue::min):
(WebCore::CSSNumericValue::max):
(WebCore::CSSNumericValue::to):

  • Source/WebCore/css/typedom/CSSNumericValue.h:
  • Source/WebCore/css/typedom/CSSUnitValue.cpp:

(WebCore::CSSUnitValue::parseUnit):
(WebCore::CSSUnitValue::create):
(WebCore::CSSUnitValue::CSSUnitValue):
(WebCore::conversionToCanonicalUnitsScaleFactor):
(WebCore::CSSUnitValue::convertTo const):
(WebCore::CSSUnitValue::toSumValue const):
(WebCore::numericType): Deleted.
(WebCore::parseUnit): Deleted.

  • Source/WebCore/css/typedom/CSSUnitValue.h:
  • Source/WebCore/css/typedom/numeric/CSSMathInvert.cpp:

(WebCore::CSSMathInvert::toSumValue const):

  • Source/WebCore/css/typedom/numeric/CSSMathInvert.h:
  • Source/WebCore/css/typedom/numeric/CSSMathMax.cpp:

(WebCore::CSSMathMax::create):
(WebCore::CSSMathMax::CSSMathMax):
(WebCore::CSSMathMax::toSumValue const):

  • Source/WebCore/css/typedom/numeric/CSSMathMax.h:
  • Source/WebCore/css/typedom/numeric/CSSMathMin.cpp:

(WebCore::CSSMathMin::create):
(WebCore::CSSMathMin::CSSMathMin):
(WebCore::CSSMathMin::toSumValue const):

  • Source/WebCore/css/typedom/numeric/CSSMathMin.h:
  • Source/WebCore/css/typedom/numeric/CSSMathNegate.cpp:

(WebCore::CSSMathNegate::toSumValue const):

  • Source/WebCore/css/typedom/numeric/CSSMathNegate.h:
  • Source/WebCore/css/typedom/numeric/CSSMathProduct.cpp:

(WebCore::CSSMathProduct::toSumValue const):

  • Source/WebCore/css/typedom/numeric/CSSMathProduct.h:
  • Source/WebCore/css/typedom/numeric/CSSMathSum.cpp:

(WebCore::CSSMathSum::toSumValue const):

  • Source/WebCore/css/typedom/numeric/CSSMathSum.h:
  • Source/WebCore/css/typedom/numeric/CSSNumericArray.cpp:

(WebCore::CSSNumericArray::forEach):

  • Source/WebCore/css/typedom/numeric/CSSNumericType.cpp:

(WebCore::CSSNumericType::create):
(WebCore::typeFromVector):

  • Source/WebCore/css/typedom/numeric/CSSNumericType.h:

(WebCore::CSSNumericType::operator!= const):

  • Source/WebCore/css/typedom/transform/CSSTransformValue.cpp:

(WebCore::CSSTransformValue::serialize const):

Canonical link: https://commits.webkit.org/251276@main

File size: 3.3 KB
Line 
1/*
2 * (C) 1999-2003 Lars Knoll ([email protected])
3 * Copyright (C) 2004, 2005, 2006, 2008, 2019 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <[email protected]>
5 *
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.
10 *
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.
15 *
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.
20 */
21
22#pragma once
23
24namespace WTF {
25class TextStream;
26}
27
28namespace WebCore {
29
30// FIXME: No need to use all capitals and a CSS prefix on all these names. Should fix that.
31enum 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,
59
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,
86
87 CSS_CQW,
88 CSS_CQH,
89 CSS_CQI,
90 CSS_CQB,
91 CSS_CQMIN,
92 CSS_CQMAX,
93
94 CSS_DPPX,
95 CSS_X,
96 CSS_DPI,
97 CSS_DPCM,
98 CSS_FR,
99 CSS_Q,
100 CSS_LHS,
101 CSS_RLHS,
102
103 CustomIdent,
104
105 CSS_PAIR,
106 CSS_UNICODE_RANGE,
107 CSS_TURN,
108 CSS_REMS,
109 CSS_CHS,
110 CSS_IC,
111
112 CSS_COUNTER_NAME,
113
114 CSS_SHAPE,
115
116 CSS_QUAD,
117
118 CSS_CALC,
119 CSS_CALC_PERCENTAGE_WITH_NUMBER,
120 CSS_CALC_PERCENTAGE_WITH_LENGTH,
121
122 CSS_FONT_FAMILY,
123
124 CSS_PROPERTY_ID,
125 CSS_VALUE_ID,
126
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
132
133 // Note that CSSValue allocates 7 bits for m_primitiveUnitType, so there can be no value here > 127.
134};
135
136enum class CSSUnitCategory : uint8_t {
137 Number,
138 Percent,
139 Length,
140 Angle,
141 Time,
142 Frequency,
143 Resolution,
144 Other
145};
146
147CSSUnitCategory unitCategory(CSSUnitType);
148CSSUnitType canonicalUnitTypeForCategory(CSSUnitCategory);
149
150WTF::TextStream& operator<<(WTF::TextStream&, CSSUnitCategory);
151WTF::TextStream& operator<<(WTF::TextStream&, CSSUnitType);
152
153} // namespace WebCore
Note: See TracBrowser for help on using the repository browser.