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

Side by Side Diff: fpdfsdk/src/javascript/Consts.cpp

Issue 1332973002: Remove some abstractions in fxjs_v8.h. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Remove implicit cast operator from CJS_Runtime. Created 5 years, 3 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 | « fpdfsdk/include/jsapi/fxjs_v8.h ('k') | fpdfsdk/src/javascript/Document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../include/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 #include "../../include/javascript/JS_Define.h" 9 #include "../../include/javascript/JS_Define.h"
10 #include "../../include/javascript/JS_Object.h" 10 #include "../../include/javascript/JS_Object.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 JS_STATIC_CONST_ENTRY_STRING(L"fitV", L"FitVisibleWidth") 123 JS_STATIC_CONST_ENTRY_STRING(L"fitV", L"FitVisibleWidth")
124 JS_STATIC_CONST_ENTRY_STRING(L"pref", L"Preferred") 124 JS_STATIC_CONST_ENTRY_STRING(L"pref", L"Preferred")
125 JS_STATIC_CONST_ENTRY_STRING(L"refW", L"ReflowWidth") 125 JS_STATIC_CONST_ENTRY_STRING(L"refW", L"ReflowWidth")
126 END_JS_STATIC_CONST() 126 END_JS_STATIC_CONST()
127 127
128 IMPLEMENT_JS_CLASS_CONST(CJS_Zoomtype, zoomtype) 128 IMPLEMENT_JS_CLASS_CONST(CJS_Zoomtype, zoomtype)
129 129
130 /* ------------------------------ CJS_GlobalConsts 130 /* ------------------------------ CJS_GlobalConsts
131 * ------------------------------ */ 131 * ------------------------------ */
132 132
133 int CJS_GlobalConsts::Init(IJS_Runtime* pRuntime) { 133 int CJS_GlobalConsts::Init(v8::Isolate* pIsolate) {
134 DEFINE_GLOBAL_CONST(pRuntime, IDS_GREATER_THAN, Invalid value 134 DEFINE_GLOBAL_CONST(pIsolate, IDS_GREATER_THAN, Invalid value
135 : must be greater than or equal to % s.); 135 : must be greater than or equal to % s.);
136 DEFINE_GLOBAL_CONST( 136 DEFINE_GLOBAL_CONST(
137 pRuntime, IDS_GT_AND_LT, Invalid value 137 pIsolate, IDS_GT_AND_LT, Invalid value
138 : must be greater than or equal to % s and less than or equal to % s.); 138 : must be greater than or equal to % s and less than or equal to % s.);
139 DEFINE_GLOBAL_CONST(pRuntime, IDS_LESS_THAN, Invalid value 139 DEFINE_GLOBAL_CONST(pIsolate, IDS_LESS_THAN, Invalid value
140 : must be less than or equal to % s.); 140 : must be less than or equal to % s.);
141 DEFINE_GLOBAL_CONST(pRuntime, IDS_INVALID_MONTH, **Invalid**); 141 DEFINE_GLOBAL_CONST(pIsolate, IDS_INVALID_MONTH, **Invalid**);
142 DEFINE_GLOBAL_CONST(pRuntime, IDS_INVALID_DATE, Invalid date / time 142 DEFINE_GLOBAL_CONST(pIsolate, IDS_INVALID_DATE, Invalid date / time
143 : please ensure that the date / time exists.Field); 143 : please ensure that the date / time exists.Field);
144 DEFINE_GLOBAL_CONST(pRuntime, IDS_INVALID_VALUE, 144 DEFINE_GLOBAL_CONST(pIsolate, IDS_INVALID_VALUE,
145 The value entered does not match the format of the field); 145 The value entered does not match the format of the field);
146 DEFINE_GLOBAL_CONST(pRuntime, IDS_AM, am); 146 DEFINE_GLOBAL_CONST(pIsolate, IDS_AM, am);
147 DEFINE_GLOBAL_CONST(pRuntime, IDS_PM, pm); 147 DEFINE_GLOBAL_CONST(pIsolate, IDS_PM, pm);
148 DEFINE_GLOBAL_CONST( 148 DEFINE_GLOBAL_CONST(
149 pRuntime, IDS_MONTH_INFO, 149 pIsolate, IDS_MONTH_INFO,
150 January[1] February[2] March[3] April[4] May[5] June[6] July[7] August 150 January[1] February[2] March[3] April[4] May[5] June[6] July[7] August
151 [8] September[9] October[10] November[11] December[12] Sept[9] Jan 151 [8] September[9] October[10] November[11] December[12] Sept[9] Jan
152 [1] Feb[2] Mar[3] Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] Nov 152 [1] Feb[2] Mar[3] Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] Nov
153 [11] Dec[12]); 153 [11] Dec[12]);
154 DEFINE_GLOBAL_CONST(pRuntime, IDS_STARTUP_CONSOLE_MSG, ** ^ _ ^ **); 154 DEFINE_GLOBAL_CONST(pIsolate, IDS_STARTUP_CONSOLE_MSG, ** ^ _ ^ **);
155 155
156 return 0; 156 return 0;
157 } 157 }
158 158
159 /* ------------------------------ CJS_GlobalArrays 159 /* ------------------------------ CJS_GlobalArrays
160 * ------------------------------ */ 160 * ------------------------------ */
161 161
162 int CJS_GlobalArrays::Init(IJS_Runtime* pRuntime) { 162 int CJS_GlobalArrays::Init(v8::Isolate* pIsolate) {
163 { 163 {
164 const FX_WCHAR* ArrayName = L"RE_NUMBER_ENTRY_DOT_SEP"; 164 const FX_WCHAR* ArrayName = L"RE_NUMBER_ENTRY_DOT_SEP";
165 const FX_WCHAR* ArrayContent[] = {L"[+-]?\\d*\\.?\\d*"}; 165 const FX_WCHAR* ArrayContent[] = {L"[+-]?\\d*\\.?\\d*"};
166 DEFINE_GLOBAL_ARRAY(pRuntime); 166 DEFINE_GLOBAL_ARRAY(pIsolate);
167 } 167 }
168 168
169 { 169 {
170 const FX_WCHAR* ArrayName = L"RE_NUMBER_COMMIT_DOT_SEP"; 170 const FX_WCHAR* ArrayName = L"RE_NUMBER_COMMIT_DOT_SEP";
171 const FX_WCHAR* ArrayContent[] = { 171 const FX_WCHAR* ArrayContent[] = {
172 L"[+-]?\\d+(\\.\\d+)?", /* -1.0 or -1 */ 172 L"[+-]?\\d+(\\.\\d+)?", /* -1.0 or -1 */
173 L"[+-]?\\.\\d+", /* -.1 */ 173 L"[+-]?\\.\\d+", /* -.1 */
174 L"[+-]?\\d+\\." /* -1. */ 174 L"[+-]?\\d+\\." /* -1. */
175 }; 175 };
176 DEFINE_GLOBAL_ARRAY(pRuntime); 176 DEFINE_GLOBAL_ARRAY(pIsolate);
177 } 177 }
178 178
179 { 179 {
180 const FX_WCHAR* ArrayName = L"RE_NUMBER_ENTRY_COMMA_SEP"; 180 const FX_WCHAR* ArrayName = L"RE_NUMBER_ENTRY_COMMA_SEP";
181 const FX_WCHAR* ArrayContent[] = {L"[+-]?\\d*,?\\d*"}; 181 const FX_WCHAR* ArrayContent[] = {L"[+-]?\\d*,?\\d*"};
182 182
183 DEFINE_GLOBAL_ARRAY(pRuntime); 183 DEFINE_GLOBAL_ARRAY(pIsolate);
184 } 184 }
185 185
186 { 186 {
187 const FX_WCHAR* ArrayName = L"RE_NUMBER_COMMIT_COMMA_SEP"; 187 const FX_WCHAR* ArrayName = L"RE_NUMBER_COMMIT_COMMA_SEP";
188 const FX_WCHAR* ArrayContent[] = { 188 const FX_WCHAR* ArrayContent[] = {
189 L"[+-]?\\d+([.,]\\d+)?", /* -1,0 or -1 */ 189 L"[+-]?\\d+([.,]\\d+)?", /* -1,0 or -1 */
190 L"[+-]?[.,]\\d+", /* -,1 */ 190 L"[+-]?[.,]\\d+", /* -,1 */
191 L"[+-]?\\d+[.,]" /* -1, */ 191 L"[+-]?\\d+[.,]" /* -1, */
192 }; 192 };
193 DEFINE_GLOBAL_ARRAY(pRuntime); 193 DEFINE_GLOBAL_ARRAY(pIsolate);
194 } 194 }
195 195
196 { 196 {
197 const FX_WCHAR* ArrayName = L"RE_ZIP_ENTRY"; 197 const FX_WCHAR* ArrayName = L"RE_ZIP_ENTRY";
198 const FX_WCHAR* ArrayContent[] = {L"\\d{0,5}"}; 198 const FX_WCHAR* ArrayContent[] = {L"\\d{0,5}"};
199 DEFINE_GLOBAL_ARRAY(pRuntime); 199 DEFINE_GLOBAL_ARRAY(pIsolate);
200 } 200 }
201 201
202 { 202 {
203 const FX_WCHAR* ArrayName = L"RE_ZIP_COMMIT"; 203 const FX_WCHAR* ArrayName = L"RE_ZIP_COMMIT";
204 const FX_WCHAR* ArrayContent[] = {L"\\d{5}"}; 204 const FX_WCHAR* ArrayContent[] = {L"\\d{5}"};
205 DEFINE_GLOBAL_ARRAY(pRuntime); 205 DEFINE_GLOBAL_ARRAY(pIsolate);
206 } 206 }
207 207
208 { 208 {
209 const FX_WCHAR* ArrayName = L"RE_ZIP4_ENTRY"; 209 const FX_WCHAR* ArrayName = L"RE_ZIP4_ENTRY";
210 const FX_WCHAR* ArrayContent[] = {L"\\d{0,5}(\\.|[- ])?\\d{0,4}"}; 210 const FX_WCHAR* ArrayContent[] = {L"\\d{0,5}(\\.|[- ])?\\d{0,4}"};
211 DEFINE_GLOBAL_ARRAY(pRuntime); 211 DEFINE_GLOBAL_ARRAY(pIsolate);
212 } 212 }
213 213
214 { 214 {
215 const FX_WCHAR* ArrayName = L"RE_ZIP4_COMMIT"; 215 const FX_WCHAR* ArrayName = L"RE_ZIP4_COMMIT";
216 const FX_WCHAR* ArrayContent[] = {L"\\d{5}(\\.|[- ])?\\d{4}"}; 216 const FX_WCHAR* ArrayContent[] = {L"\\d{5}(\\.|[- ])?\\d{4}"};
217 DEFINE_GLOBAL_ARRAY(pRuntime); 217 DEFINE_GLOBAL_ARRAY(pIsolate);
218 } 218 }
219 219
220 { 220 {
221 const FX_WCHAR* ArrayName = L"RE_PHONE_ENTRY"; 221 const FX_WCHAR* ArrayName = L"RE_PHONE_ENTRY";
222 const FX_WCHAR* ArrayContent[] = { 222 const FX_WCHAR* ArrayContent[] = {
223 L"\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* 555-1234 or 408 223 L"\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* 555-1234 or 408
224 555-1234 */ 224 555-1234 */
225 L"\\(\\d{0,3}", /* (408 */ 225 L"\\(\\d{0,3}", /* (408 */
226 L"\\(\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* (408) 226 L"\\(\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* (408)
227 555-1234 */ 227 555-1234 */
228 /* (allow the addition of parens as an afterthought) */ 228 /* (allow the addition of parens as an afterthought) */
229 L"\\(\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* (408 555-1234 229 L"\\(\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* (408 555-1234
230 */ 230 */
231 L"\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* 408) 555-1234 231 L"\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}", /* 408) 555-1234
232 */ 232 */
233 L"011(\\.|[- \\d])*" /* international */ 233 L"011(\\.|[- \\d])*" /* international */
234 }; 234 };
235 DEFINE_GLOBAL_ARRAY(pRuntime); 235 DEFINE_GLOBAL_ARRAY(pIsolate);
236 } 236 }
237 237
238 { 238 {
239 const FX_WCHAR* ArrayName = L"RE_PHONE_COMMIT"; 239 const FX_WCHAR* ArrayName = L"RE_PHONE_COMMIT";
240 const FX_WCHAR* ArrayContent[] = { 240 const FX_WCHAR* ArrayContent[] = {
241 L"\\d{3}(\\.|[- ])?\\d{4}", /* 555-1234 */ 241 L"\\d{3}(\\.|[- ])?\\d{4}", /* 555-1234 */
242 L"\\d{3}(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", /* 408 555-1234 */ 242 L"\\d{3}(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", /* 408 555-1234 */
243 L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", /* (408) 555-1234 */ 243 L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", /* (408) 555-1234 */
244 L"011(\\.|[- \\d])*" /* international */ 244 L"011(\\.|[- \\d])*" /* international */
245 }; 245 };
246 DEFINE_GLOBAL_ARRAY(pRuntime); 246 DEFINE_GLOBAL_ARRAY(pIsolate);
247 } 247 }
248 248
249 { 249 {
250 const FX_WCHAR* ArrayName = L"RE_SSN_ENTRY"; 250 const FX_WCHAR* ArrayName = L"RE_SSN_ENTRY";
251 const FX_WCHAR* ArrayContent[] = { 251 const FX_WCHAR* ArrayContent[] = {
252 L"\\d{0,3}(\\.|[- ])?\\d{0,2}(\\.|[- ])?\\d{0,4}"}; 252 L"\\d{0,3}(\\.|[- ])?\\d{0,2}(\\.|[- ])?\\d{0,4}"};
253 DEFINE_GLOBAL_ARRAY(pRuntime); 253 DEFINE_GLOBAL_ARRAY(pIsolate);
254 } 254 }
255 255
256 { 256 {
257 const FX_WCHAR* ArrayName = L"RE_SSN_COMMIT"; 257 const FX_WCHAR* ArrayName = L"RE_SSN_COMMIT";
258 const FX_WCHAR* ArrayContent[] = { 258 const FX_WCHAR* ArrayContent[] = {
259 L"\\d{3}(\\.|[- ])?\\d{2}(\\.|[- ])?\\d{4}"}; 259 L"\\d{3}(\\.|[- ])?\\d{2}(\\.|[- ])?\\d{4}"};
260 DEFINE_GLOBAL_ARRAY(pRuntime); 260 DEFINE_GLOBAL_ARRAY(pIsolate);
261 } 261 }
262 262
263 return 0; 263 return 0;
264 } 264 }
OLDNEW
« no previous file with comments | « fpdfsdk/include/jsapi/fxjs_v8.h ('k') | fpdfsdk/src/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698