Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSValueIDMappings.h

Issue 2702173002: Generate mappings between CSSValueID and ComputedStyle enums. (Closed)
Patch Set: Forgot case Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CSSValueIDMappings_h
6 #define CSSValueIDMappings_h
7
8 #include "core/CSSValueIDMappingsGenerated.h"
9
10 namespace blink {
11
12 template <class T>
13 T cssValueIDToPlatformEnum(CSSValueID v) {
14 // By default, we use the generated mappings. For special cases, we
15 // specialize.
16 return detail::cssValueIDToPlatformEnumGenerated<T>(v);
17 }
18
19 template <class T>
20 inline CSSValueID platformEnumToCSSValueID(T v) {
21 // By default, we use the generated mappings. For special cases, we overload.
22 return detail::platformEnumToCSSValueIDGenerated(v);
23 }
24
25 template <>
26 inline UnicodeBidi cssValueIDToPlatformEnum(CSSValueID v) {
27 if (v == CSSValueWebkitIsolate)
28 return UnicodeBidi::kIsolate;
29 if (v == CSSValueWebkitIsolateOverride)
30 return UnicodeBidi::kIsolateOverride;
31 if (v == CSSValueWebkitPlaintext)
32 return UnicodeBidi::kPlaintext;
33 return detail::cssValueIDToPlatformEnumGenerated<UnicodeBidi>(v);
34 }
35
36 template <>
37 inline ETextAlign cssValueIDToPlatformEnum(CSSValueID v) {
38 if (v == CSSValueWebkitAuto) // Legacy -webkit-auto. Eqiuvalent to start.
39 return ETextAlign::kStart;
40 if (v == CSSValueInternalCenter)
41 return ETextAlign::kCenter;
42 return detail::cssValueIDToPlatformEnumGenerated<ETextAlign>(v);
43 }
44
45 template <>
46 inline WritingMode cssValueIDToPlatformEnum(CSSValueID v) {
47 switch (v) {
48 case CSSValueHorizontalTb:
49 case CSSValueLr:
50 case CSSValueLrTb:
51 case CSSValueRl:
52 case CSSValueRlTb:
53 return WritingMode::kHorizontalTb;
54 case CSSValueVerticalRl:
55 case CSSValueTb:
56 case CSSValueTbRl:
57 return WritingMode::kVerticalRl;
58 case CSSValueVerticalLr:
59 return WritingMode::kVerticalLr;
60 default:
61 break;
62 }
63
64 NOTREACHED();
65 return WritingMode::kHorizontalTb;
66 }
67
68 } // namespace blink
69
70 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPrimitiveValueMappings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698