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

Side by Side Diff: third_party/WebKit/Source/build/scripts/make_css_property_names.py

Issue 1645433002: Basic implementation of @apply (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix expted.txt for failing test Created 4 years, 10 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 import subprocess 3 import subprocess
4 import sys 4 import sys
5 5
6 import css_properties 6 import css_properties
7 import in_generator 7 import in_generator
8 import license 8 import license
9 9
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 namespace WTF { 22 namespace WTF {
23 class AtomicString; 23 class AtomicString;
24 class String; 24 class String;
25 } 25 }
26 26
27 namespace blink { 27 namespace blink {
28 28
29 enum CSSPropertyID { 29 enum CSSPropertyID {
30 CSSPropertyInvalid = 0, 30 CSSPropertyInvalid = 0,
31 CSSPropertyVariable = 1, 31 // This isn't a property, but we need to know the position of @apply rules i n style rules
32 CSSPropertyApplyAtRule = 1,
33 CSSPropertyVariable = 2,
32 %(property_enums)s 34 %(property_enums)s
33 }; 35 };
34 36
35 const int firstCSSProperty = %(first_property_id)s; 37 const int firstCSSProperty = %(first_property_id)s;
36 const int numCSSProperties = %(properties_count)s; 38 const int numCSSProperties = %(properties_count)s;
37 const int lastCSSProperty = %(last_property_id)d; 39 const int lastCSSProperty = %(last_property_id)d;
38 const int lastUnresolvedCSSProperty = %(last_unresolved_property_id)d; 40 const int lastUnresolvedCSSProperty = %(last_unresolved_property_id)d;
39 const size_t maxCSSPropertyNameLength = %(max_name_length)d; 41 const size_t maxCSSPropertyNameLength = %(max_name_length)d;
40 42
41 const char* getPropertyName(CSSPropertyID); 43 const char* getPropertyName(CSSPropertyID);
42 const WTF::AtomicString& getPropertyNameAtomicString(CSSPropertyID); 44 const WTF::AtomicString& getPropertyNameAtomicString(CSSPropertyID);
43 WTF::String getPropertyNameString(CSSPropertyID); 45 WTF::String getPropertyNameString(CSSPropertyID);
44 WTF::String getJSPropertyName(CSSPropertyID); 46 WTF::String getJSPropertyName(CSSPropertyID);
45 47
46 inline CSSPropertyID convertToCSSPropertyID(int value) 48 inline CSSPropertyID convertToCSSPropertyID(int value)
47 { 49 {
48 ASSERT((value >= firstCSSProperty && value <= lastCSSProperty) || value == C SSPropertyInvalid || value == CSSPropertyVariable); 50 ASSERT(value >= CSSPropertyInvalid && value <= lastCSSProperty);
49 return static_cast<CSSPropertyID>(value); 51 return static_cast<CSSPropertyID>(value);
50 } 52 }
51 53
52 inline CSSPropertyID resolveCSSPropertyID(CSSPropertyID id) 54 inline CSSPropertyID resolveCSSPropertyID(CSSPropertyID id)
53 { 55 {
54 return convertToCSSPropertyID(id & ~512); 56 return convertToCSSPropertyID(id & ~512);
55 } 57 }
56 58
57 inline bool isPropertyAlias(CSSPropertyID id) { return id & 512; } 59 inline bool isPropertyAlias(CSSPropertyID id) { return id & 512; }
58 60
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 # FIXME: If we could depend on Python 2.7, we would use subprocess.check _output 231 # FIXME: If we could depend on Python 2.7, we would use subprocess.check _output
230 gperf_args = [self.gperf_path, '--key-positions=*', '-P', '-n'] 232 gperf_args = [self.gperf_path, '--key-positions=*', '-P', '-n']
231 gperf_args.extend(['-m', '50']) # Pick best of 50 attempts. 233 gperf_args.extend(['-m', '50']) # Pick best of 50 attempts.
232 gperf_args.append('-D') # Allow duplicate hashes -> More compact code. 234 gperf_args.append('-D') # Allow duplicate hashes -> More compact code.
233 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subpr ocess.PIPE, universal_newlines=True) 235 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subpr ocess.PIPE, universal_newlines=True)
234 return gperf.communicate(gperf_input)[0] 236 return gperf.communicate(gperf_input)[0]
235 237
236 238
237 if __name__ == "__main__": 239 if __name__ == "__main__":
238 in_generator.Maker(CSSPropertyNamesWriter).main(sys.argv) 240 in_generator.Maker(CSSPropertyNamesWriter).main(sys.argv)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698