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

Unified Diff: third_party/WebKit/Source/bindings/scripts/v8_interface.py

Issue 2068053002: Rename Blink constants generated from IDL files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/scripts/v8_interface.py
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_interface.py b/third_party/WebKit/Source/bindings/scripts/v8_interface.py
index 1c577d5d14e7e46d68c823a3d082ca73ebf3780e..6f6901392d4538cb41b636a93a5a2e5195c500bc 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_interface.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_interface.py
@@ -589,6 +589,18 @@ def interface_context(interface):
return context
+def reflected_name(constant_name):
+ """Returns the name to use for the matching constant name in blink code.
+
+ Given an all-uppercase 'CONSTANT_NAME', returns a camel-case
+ 'kConstantName'.
+ """
+ # Check for SHOUTY_CASE constants
+ if constant_name.upper() != constant_name:
+ return constant_name
+ return 'k' + ''.join(part.title() for part in constant_name.split('_'))
+
+
# [DeprecateAs], [OriginTrialEnabled], [Reflect], [RuntimeEnabled]
def constant_context(constant, interface):
extended_attributes = constant.extended_attributes
@@ -602,7 +614,7 @@ def constant_context(constant, interface):
'origin_trial_enabled_function': v8_utilities.origin_trial_enabled_function_name(constant), # [OriginTrialEnabled]
'origin_trial_feature_name': v8_utilities.origin_trial_feature_name(constant), # [OriginTrialEnabled]
# FIXME: use 'reflected_name' as correct 'name'
- 'reflected_name': extended_attributes.get('Reflect', constant.name),
+ 'reflected_name': extended_attributes.get('Reflect', reflected_name(constant.name)),
'runtime_enabled_function': runtime_enabled_function_name(constant), # [RuntimeEnabled]
'runtime_feature_name': v8_utilities.runtime_feature_name(constant), # [RuntimeEnabled]
'value': constant.value,

Powered by Google App Engine
This is Rietveld 408576698