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

Unified Diff: third_party/WebKit/Source/build/scripts/make_cssom_types.py

Issue 2121913002: [Typed OM] Add CSSValue -> CSSNumberValue conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/build/scripts/make_cssom_types.py
diff --git a/third_party/WebKit/Source/build/scripts/make_cssom_types.py b/third_party/WebKit/Source/build/scripts/make_cssom_types.py
index ee57c747ad5afd23d0b43b66c68b4b95296a3db4..d62cbcb759972a2053c30142c2dc4e319ff18c02 100755
--- a/third_party/WebKit/Source/build/scripts/make_cssom_types.py
+++ b/third_party/WebKit/Source/build/scripts/make_cssom_types.py
@@ -11,6 +11,18 @@ from name_utilities import enum_for_css_keyword
import template_expander
+def number_metadata(number_type):
+ result = {}
+ result['integer'] = 'false'
+ result['allow_negative'] = 'true'
+ if number_type == 'Integer' or number_type == 'PositiveInteger':
+ result['integer'] = 'true'
+ if (number_type == 'PositiveInteger' or
+ number_type == 'PositiveNumber'):
+ result['allow_negative'] = 'false'
+ return result
+
+
class CSSOMTypesWriter(css_properties.CSSProperties):
def __init__(self, in_file_path):
super(CSSOMTypesWriter, self).__init__(in_file_path)
@@ -24,6 +36,13 @@ class CSSOMTypesWriter(css_properties.CSSProperties):
types.append('CalcLength')
elif singleType == 'Image':
types.append('URLImage')
+ elif (singleType == 'Integer' or
+ singleType == 'PositiveInteger' or
+ singleType == 'PositiveNumber' or
+ singleType == 'Number'):
+ # Numbers are a special case since they
+ # require further validation.
+ property['number_metadata'] = number_metadata(singleType)
else:
types.append(singleType)
property['typedom_types'] = types

Powered by Google App Engine
This is Rietveld 408576698