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

Unified Diff: Source/bindings/scripts/v8_utilities.py

Issue 21006006: Add forEach() to CSSVariablesMap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased onto callback change Created 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/scripts/v8_utilities.py
diff --git a/Source/bindings/scripts/v8_utilities.py b/Source/bindings/scripts/v8_utilities.py
index 93b85ab2d05d7fd043ebc4e01e86cab1b3244395..1bd258e42c05546bc8b5beb85cc72fa8001cc89d 100644
--- a/Source/bindings/scripts/v8_utilities.py
+++ b/Source/bindings/scripts/v8_utilities.py
@@ -28,6 +28,7 @@
# FIXME: eliminate this file if possible
+import re
import v8_types
ACRONYMS = ['CSS', 'HTML', 'IME', 'JS', 'SVG', 'URL', 'WOFF', 'XML', 'XSLT']
@@ -81,3 +82,16 @@ def uncapitalize(name):
def v8_class_name(interface):
return v8_types.v8_type(interface.name)
+
+
+def has_extended_attribute_value(extended_attributes, key, value):
+ return key in extended_attributes and value in extended_attribute_values(extended_attributes, key)
+
+
+def extended_attribute_values(extended_attributes, key):
+ if key not in extended_attributes:
+ return None
+ values_string = extended_attributes[key]
+ if not values_string:
+ return []
+ return re.split('[|&]', values_string)

Powered by Google App Engine
This is Rietveld 408576698