forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSSNumericFactory.h
More file actions
106 lines (83 loc) · 5.01 KB
/
CSSNumericFactory.h
File metadata and controls
106 lines (83 loc) · 5.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
* Copyright (C) 2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#if ENABLE(CSS_TYPED_OM)
#include "CSSUnitValue.h"
#include "Supplementable.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class Document;
class DOMCSSNamespace;
class CSSNumericFactory final : public Supplement<DOMCSSNamespace> {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit CSSNumericFactory(DOMCSSNamespace&) { }
static Ref<CSSUnitValue> number(double value) { return CSSUnitValue::create(value, "number"); }
static Ref<CSSUnitValue> percent(double value) { return CSSUnitValue::create(value, "percent"); }
// <length>
static Ref<CSSUnitValue> em(double value) { return CSSUnitValue::create(value, "em"); }
static Ref<CSSUnitValue> ex(double value) { return CSSUnitValue::create(value, "ex"); }
static Ref<CSSUnitValue> ch(double value) { return CSSUnitValue::create(value, "ch"); }
static Ref<CSSUnitValue> ic(double value) { return CSSUnitValue::create(value, "ic"); }
static Ref<CSSUnitValue> rem(double value) { return CSSUnitValue::create(value, "rem"); }
static Ref<CSSUnitValue> lh(double value) { return CSSUnitValue::create(value, "lh"); }
static Ref<CSSUnitValue> rlh(double value) { return CSSUnitValue::create(value, "rlh"); }
static Ref<CSSUnitValue> vw(double value) { return CSSUnitValue::create(value, "vw"); }
static Ref<CSSUnitValue> vh(double value) { return CSSUnitValue::create(value, "vh"); }
static Ref<CSSUnitValue> vi(double value) { return CSSUnitValue::create(value, "vi"); }
static Ref<CSSUnitValue> vb(double value) { return CSSUnitValue::create(value, "vb"); }
static Ref<CSSUnitValue> vmin(double value) { return CSSUnitValue::create(value, "vmin"); }
static Ref<CSSUnitValue> vmax(double value) { return CSSUnitValue::create(value, "vmax"); }
static Ref<CSSUnitValue> cm(double value) { return CSSUnitValue::create(value, "cm"); }
static Ref<CSSUnitValue> mm(double value) { return CSSUnitValue::create(value, "mm"); }
static Ref<CSSUnitValue> q(double value) { return CSSUnitValue::create(value, "q"); }
static Ref<CSSUnitValue> in(double value) { return CSSUnitValue::create(value, "in"); }
static Ref<CSSUnitValue> pt(double value) { return CSSUnitValue::create(value, "pt"); }
static Ref<CSSUnitValue> pc(double value) { return CSSUnitValue::create(value, "pc"); }
static Ref<CSSUnitValue> px(double value) { return CSSUnitValue::create(value, "px"); }
// <angle>
static Ref<CSSUnitValue> deg(double value) { return CSSUnitValue::create(value, "deg"); }
static Ref<CSSUnitValue> grad(double value) { return CSSUnitValue::create(value, "grad"); }
static Ref<CSSUnitValue> rad(double value) { return CSSUnitValue::create(value, "rad"); }
static Ref<CSSUnitValue> turn(double value) { return CSSUnitValue::create(value, "turn"); }
// <time>
static Ref<CSSUnitValue> s(double value) { return CSSUnitValue::create(value, "s"); }
static Ref<CSSUnitValue> ms(double value) { return CSSUnitValue::create(value, "ms"); }
// <frequency>
static Ref<CSSUnitValue> hz(double value) { return CSSUnitValue::create(value, "hz"); }
static Ref<CSSUnitValue> kHz(double value) { return CSSUnitValue::create(value, "khz"); }
// <resolution>
static Ref<CSSUnitValue> dpi(double value) { return CSSUnitValue::create(value, "dpi"); }
static Ref<CSSUnitValue> dpcm(double value) { return CSSUnitValue::create(value, "dpcm"); }
static Ref<CSSUnitValue> dppx(double value) { return CSSUnitValue::create(value, "dppx"); }
// <flex>
static Ref<CSSUnitValue> fr(double value) { return CSSUnitValue::create(value, "fr"); }
private:
static CSSNumericFactory* from(DOMCSSNamespace&);
static const char* supplementName();
};
} // namespace WebCore
#endif