OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
8 * * Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * * Redistributions in binary form must reproduce the above | |
11 * copyright notice, this list of conditions and the following disclaimer | |
12 * in the documentation and/or other materials provided with the | |
13 * distribution. | |
14 * * Neither the name of Google Inc. nor the names of its | |
15 * contributors may be used to endorse or promote products derived from | |
16 * this software without specific prior written permission. | |
17 * | |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 */ | |
30 | |
31 // Use this file to assert that various public API enum values continue | |
32 // matching blink defined enum values. | |
33 | |
34 | |
35 #include "sky/engine/core/dom/DocumentMarker.h" | |
36 #include "sky/engine/core/dom/ExceptionCode.h" | |
37 #include "sky/engine/core/dom/Node.h" | |
38 #include "sky/engine/core/editing/TextAffinity.h" | |
39 #include "sky/engine/core/frame/ConsoleTypes.h" | |
40 #include "sky/engine/core/frame/Settings.h" | |
41 #include "sky/engine/core/loader/FrameLoaderTypes.h" | |
42 #include "sky/engine/core/loader/NavigationPolicy.h" | |
43 #include "sky/engine/core/page/PageVisibilityState.h" | |
44 #include "sky/engine/core/rendering/style/RenderStyleConstants.h" | |
45 #include "sky/engine/platform/fonts/FontDescription.h" | |
46 #include "sky/engine/platform/fonts/FontSmoothingMode.h" | |
47 #include "sky/engine/platform/graphics/filters/FilterOperation.h" | |
48 #include "sky/engine/platform/network/ResourceLoadPriority.h" | |
49 #include "sky/engine/platform/network/ResourceResponse.h" | |
50 #include "sky/engine/platform/text/TextChecking.h" | |
51 #include "sky/engine/platform/text/TextDecoration.h" | |
52 #include "sky/engine/platform/weborigin/ReferrerPolicy.h" | |
53 #include "sky/engine/public/platform/WebClipboard.h" | |
54 #include "sky/engine/public/platform/WebInputEvent.h" | |
55 #include "sky/engine/public/platform/WebReferrerPolicy.h" | |
56 #include "sky/engine/public/platform/WebURLRequest.h" | |
57 #include "sky/engine/public/platform/WebURLResponse.h" | |
58 #include "sky/engine/public/web/WebConsoleMessage.h" | |
59 #include "sky/engine/public/web/WebFontDescription.h" | |
60 #include "sky/engine/public/web/WebNavigationPolicy.h" | |
61 #include "sky/engine/public/web/WebNavigatorContentUtilsClient.h" | |
62 #include "sky/engine/public/web/WebNode.h" | |
63 #include "sky/engine/public/web/WebSettings.h" | |
64 #include "sky/engine/public/web/WebTextAffinity.h" | |
65 #include "sky/engine/public/web/WebTextCheckingResult.h" | |
66 #include "sky/engine/public/web/WebTextCheckingType.h" | |
67 #include "sky/engine/public/web/WebTextDecorationType.h" | |
68 #include "sky/engine/public/web/WebView.h" | |
69 #include "sky/engine/wtf/Assertions.h" | |
70 #include "sky/engine/wtf/text/StringImpl.h" | |
71 | |
72 namespace blink { | |
73 | |
74 #define COMPILE_ASSERT_MATCHING_ENUM(public_name, core_name) \ | |
75 COMPILE_ASSERT(int(public_name) == int(core_name), mismatching_enums) | |
76 | |
77 #define COMPILE_ASSERT_MATCHING_UINT64(public_name, core_name) \ | |
78 COMPILE_ASSERT(public_name == core_name, mismatching_enums) | |
79 | |
80 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyNone, FontDescript
ion::NoFamily); | |
81 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyStandard, FontDesc
ription::StandardFamily); | |
82 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilySerif, FontDescrip
tion::SerifFamily); | |
83 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilySansSerif, FontDes
cription::SansSerifFamily); | |
84 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyMonospace, FontDes
cription::MonospaceFamily); | |
85 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyCursive, FontDescr
iption::CursiveFamily); | |
86 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::GenericFamilyFantasy, FontDescr
iption::FantasyFamily); | |
87 | |
88 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::SmoothingAuto, AutoSmoothing); | |
89 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::SmoothingNone, NoSmoothing); | |
90 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::SmoothingGrayscale, Antialiased
); | |
91 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::SmoothingSubpixel, SubpixelAnti
aliased); | |
92 | |
93 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight100, FontWeight100); | |
94 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight200, FontWeight200); | |
95 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight300, FontWeight300); | |
96 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight400, FontWeight400); | |
97 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight500, FontWeight500); | |
98 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight600, FontWeight600); | |
99 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight700, FontWeight700); | |
100 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight800, FontWeight800); | |
101 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::Weight900, FontWeight900); | |
102 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::WeightNormal, FontWeightNormal)
; | |
103 COMPILE_ASSERT_MATCHING_ENUM(WebFontDescription::WeightBold, FontWeightBold); | |
104 | |
105 COMPILE_ASSERT_MATCHING_ENUM(WebNode::ElementNode, Node::ELEMENT_NODE); | |
106 COMPILE_ASSERT_MATCHING_ENUM(WebNode::TextNode, Node::TEXT_NODE); | |
107 COMPILE_ASSERT_MATCHING_ENUM(WebNode::DocumentNode, Node::DOCUMENT_NODE); | |
108 COMPILE_ASSERT_MATCHING_ENUM(WebNode::DocumentFragmentNode, Node::DOCUMENT_FRAGM
ENT_NODE); | |
109 | |
110 COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityUpstream, UPSTREAM); | |
111 COMPILE_ASSERT_MATCHING_ENUM(WebTextAffinityDownstream, DOWNSTREAM); | |
112 | |
113 COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeSpelling, TextCheckingTypeSpelli
ng); | |
114 COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeGrammar, TextCheckingTypeGrammar
); | |
115 | |
116 // TODO(rouslan): Remove these comparisons between text-checking and text-decora
tion enum values after removing the | |
117 // deprecated constructor WebTextCheckingResult(WebTextCheckingType). | |
118 COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeSpelling, TextDecorationTypeSpel
ling); | |
119 COMPILE_ASSERT_MATCHING_ENUM(WebTextCheckingTypeGrammar, TextDecorationTypeGramm
ar); | |
120 | |
121 COMPILE_ASSERT_MATCHING_ENUM(WebTextDecorationTypeSpelling, TextDecorationTypeSp
elling); | |
122 COMPILE_ASSERT_MATCHING_ENUM(WebTextDecorationTypeGrammar, TextDecorationTypeGra
mmar); | |
123 COMPILE_ASSERT_MATCHING_ENUM(WebTextDecorationTypeInvisibleSpellcheck, TextDecor
ationTypeInvisibleSpellcheck); | |
124 | |
125 COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateVisible, PageVisibilityStateV
isible); | |
126 COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateHidden, PageVisibilityStateHi
dden); | |
127 | |
128 COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyAlways, ReferrerPolicyAlways); | |
129 COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyDefault, ReferrerPolicyDefault); | |
130 COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyNever, ReferrerPolicyNever); | |
131 COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyOrigin, ReferrerPolicyOrigin); | |
132 | |
133 COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::Unknown, ResourceResponse::Unknown)
; | |
134 COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::HTTP_0_9, ResourceResponse::HTTP_0_
9); | |
135 COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::HTTP_1_0, ResourceResponse::HTTP_1_
0); | |
136 COMPILE_ASSERT_MATCHING_ENUM(WebURLResponse::HTTP_1_1, ResourceResponse::HTTP_1_
1); | |
137 | |
138 COMPILE_ASSERT_MATCHING_ENUM(WebURLRequest::PriorityUnresolved, ResourceLoadPrio
rityUnresolved); | |
139 COMPILE_ASSERT_MATCHING_ENUM(WebURLRequest::PriorityVeryLow, ResourceLoadPriorit
yVeryLow); | |
140 COMPILE_ASSERT_MATCHING_ENUM(WebURLRequest::PriorityLow, ResourceLoadPriorityLow
); | |
141 COMPILE_ASSERT_MATCHING_ENUM(WebURLRequest::PriorityMedium, ResourceLoadPriority
Medium); | |
142 COMPILE_ASSERT_MATCHING_ENUM(WebURLRequest::PriorityHigh, ResourceLoadPriorityHi
gh); | |
143 COMPILE_ASSERT_MATCHING_ENUM(WebURLRequest::PriorityVeryHigh, ResourceLoadPriori
tyVeryHigh); | |
144 | |
145 COMPILE_ASSERT_MATCHING_ENUM(WebNavigationPolicyIgnore, NavigationPolicyIgnore); | |
146 COMPILE_ASSERT_MATCHING_ENUM(WebNavigationPolicyDownload, NavigationPolicyDownlo
ad); | |
147 COMPILE_ASSERT_MATCHING_ENUM(WebNavigationPolicyDownloadTo, NavigationPolicyDown
loadTo); | |
148 COMPILE_ASSERT_MATCHING_ENUM(WebNavigationPolicyCurrentTab, NavigationPolicyCurr
entTab); | |
149 COMPILE_ASSERT_MATCHING_ENUM(WebNavigationPolicyNewBackgroundTab, NavigationPoli
cyNewBackgroundTab); | |
150 COMPILE_ASSERT_MATCHING_ENUM(WebNavigationPolicyNewForegroundTab, NavigationPoli
cyNewForegroundTab); | |
151 COMPILE_ASSERT_MATCHING_ENUM(WebNavigationPolicyNewWindow, NavigationPolicyNewWi
ndow); | |
152 COMPILE_ASSERT_MATCHING_ENUM(WebNavigationPolicyNewPopup, NavigationPolicyNewPop
up); | |
153 | |
154 COMPILE_ASSERT_MATCHING_ENUM(WebConsoleMessage::LevelDebug, DebugMessageLevel); | |
155 COMPILE_ASSERT_MATCHING_ENUM(WebConsoleMessage::LevelLog, LogMessageLevel); | |
156 COMPILE_ASSERT_MATCHING_ENUM(WebConsoleMessage::LevelWarning, WarningMessageLeve
l); | |
157 COMPILE_ASSERT_MATCHING_ENUM(WebConsoleMessage::LevelError, ErrorMessageLevel); | |
158 COMPILE_ASSERT_MATCHING_ENUM(WebConsoleMessage::LevelInfo, InfoMessageLevel); | |
159 | |
160 COMPILE_ASSERT_MATCHING_ENUM(WebSettings::PointerTypeNone, PointerTypeNone); | |
161 COMPILE_ASSERT_MATCHING_ENUM(WebSettings::PointerTypeCoarse, PointerTypeCoarse); | |
162 COMPILE_ASSERT_MATCHING_ENUM(WebSettings::PointerTypeFine, PointerTypeFine); | |
163 COMPILE_ASSERT_MATCHING_ENUM(WebSettings::HoverTypeNone, HoverTypeNone); | |
164 COMPILE_ASSERT_MATCHING_ENUM(WebSettings::HoverTypeOnDemand, HoverTypeOnDemand); | |
165 COMPILE_ASSERT_MATCHING_ENUM(WebSettings::HoverTypeHover, HoverTypeHover); | |
166 | |
167 } // namespace blink | |
OLD | NEW |