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

Unified Diff: pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart

Issue 2980853002: Registration-based approach to cross frame support. (Closed)
Patch Set: Update dart:html Created 3 years, 5 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:
Download patch
Index: pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart b/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart
index c2dc6ad20aebb10821fbff56209669d4b5d27415..4309803236d6a01f994c0cf3724f397906411422 100644
--- a/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart
+++ b/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart
@@ -63,7 +63,8 @@ import 'dart:_js_helper'
ForceInline,
findDispatchTagForInterceptorClass,
setNativeSubclassDispatchRecord,
- makeLeafDispatchRecord;
+ makeLeafDispatchRecord,
+ registerGlobalObject;
vsm 2017/07/19 15:59:02 Note, this is just a direct copy now of the dart2j
import 'dart:_interceptors'
show
Interceptor,
@@ -4301,15 +4302,11 @@ class CssStyleDeclaration extends Interceptor with CssStyleDeclarationBase {
/// Please note the property name uses camelCase, not-hyphens.
String getPropertyValue(String propertyName) {
var propValue = _getPropertyValueHelper(propertyName);
- return propValue != null ? propValue : '';
+ return propValue ?? '';
}
String _getPropertyValueHelper(String propertyName) {
- if (_supportsProperty(_camelCase(propertyName))) {
- return _getPropertyValue(propertyName);
- } else {
- return _getPropertyValue(Device.cssPrefix + propertyName);
- }
+ return _getPropertyValue(_browserPropertyName(propertyName));
}
/**
@@ -4322,7 +4319,7 @@ class CssStyleDeclaration extends Interceptor with CssStyleDeclarationBase {
*/
bool supportsProperty(String propertyName) {
return _supportsProperty(propertyName) ||
- _supportsProperty(_camelCase(Device.cssPrefix + propertyName));
+ _supportsProperty(_camelCase("${Device.cssPrefix}$propertyName"));
}
bool _supportsProperty(String propertyName) {
@@ -4338,15 +4335,23 @@ class CssStyleDeclaration extends Interceptor with CssStyleDeclarationBase {
String _browserPropertyName(String propertyName) {
String name = _readCache(propertyName);
if (name is String) return name;
- if (_supportsProperty(_camelCase(propertyName))) {
- name = propertyName;
- } else {
- name = Device.cssPrefix + propertyName;
- }
+ name = _supportedBrowserPropertyName(propertyName);
_writeCache(propertyName, name);
return name;
}
+ String _supportedBrowserPropertyName(String propertyName) {
+ if (_supportsProperty(_camelCase(propertyName))) {
+ return propertyName;
+ }
+ var prefixed = "${Device.cssPrefix}$propertyName";
+ if (_supportsProperty(prefixed)) {
+ return prefixed;
+ }
+ // May be a CSS variable, just use it as provided.
+ return propertyName;
+ }
+
static final _propertyCache = JS('', '{}');
static String _readCache(String key) =>
JS('String|Null', '#[#]', _propertyCache, key);
@@ -45868,6 +45873,7 @@ class _DOMWindowCrossFrame implements WindowBase {
return w;
} else {
// TODO(vsm): Cache or implement equality.
+ registerGlobalObject(w);
return new _DOMWindowCrossFrame(w);
}
}

Powered by Google App Engine
This is Rietveld 408576698