mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 08:07:11 +00:00
Removed DARTIUM codegen for IDLS (sdk/lib/dartium)
TBR=alanknight@google.com Review-Url: https://codereview.chromium.org/2978213002 .
This commit is contained in:
parent
657daa96a8
commit
621b12f324
82 changed files with 3 additions and 2705 deletions
|
@ -140,22 +140,9 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME $EXTENDS with
|
|||
}
|
||||
|
||||
bool _supportsProperty(String propertyName) {
|
||||
$if DART2JS
|
||||
return JS('bool', '# in #', propertyName, this);
|
||||
$else
|
||||
// You can't just check the value of a property, because there is no way
|
||||
// to distinguish between property not being present in the browser and
|
||||
// not having a value at all. (Ultimately we'll want the native method to
|
||||
// return null if the property doesn't exist and empty string if it's
|
||||
// defined but just doesn't have a value.
|
||||
return _hasProperty(propertyName);
|
||||
$endif
|
||||
}
|
||||
|
||||
$if DARTIUM
|
||||
bool _hasProperty(String propertyName) =>
|
||||
_blink.BlinkCSSStyleDeclaration.instance.$__get___propertyIsEnumerable_Callback_1_(this, propertyName);
|
||||
$endif
|
||||
|
||||
@DomName('CSSStyleDeclaration.setProperty')
|
||||
void setProperty(String propertyName, String value, [String priority]) {
|
||||
|
@ -183,35 +170,22 @@ $endif
|
|||
return propertyName;
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
static final _propertyCache = JS('', '{}');
|
||||
static String _readCache(String key) =>
|
||||
JS('String|Null', '#[#]', _propertyCache, key);
|
||||
static void _writeCache(String key, String value) {
|
||||
JS('void', '#[#] = #', _propertyCache, key, value);
|
||||
}
|
||||
$else
|
||||
static String _readCache(String key) => null;
|
||||
static void _writeCache(String key, value) {}
|
||||
$endif
|
||||
|
||||
static String _camelCase(String hyphenated) {
|
||||
$if DART2JS
|
||||
var replacedMs = JS('String', r'#.replace(/^-ms-/, "ms-")', hyphenated);
|
||||
return JS(
|
||||
'String',
|
||||
r'#.replace(/-([\da-z])/ig,'
|
||||
r'function(_, letter) { return letter.toUpperCase();})',
|
||||
replacedMs);
|
||||
$else
|
||||
// The "ms" prefix is always lowercased.
|
||||
return hyphenated.replaceFirst(new RegExp('^-ms-'), 'ms-').replaceAllMapped(
|
||||
new RegExp('-([a-z]+)', caseSensitive: false),
|
||||
(match) => match[0][1].toUpperCase() + match[0].substring(2));
|
||||
$endif
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
void _setPropertyHelper(String propertyName, String value, [String priority]) {
|
||||
if (value == null) value = '';
|
||||
if (priority == null) priority = '';
|
||||
|
@ -224,21 +198,7 @@ $if DART2JS
|
|||
static bool get supportsTransitions {
|
||||
return document.body.style.supportsProperty('transition');
|
||||
}
|
||||
$else
|
||||
void _setPropertyHelper(String propertyName, String value, [String priority]) {
|
||||
if (priority == null) {
|
||||
priority = '';
|
||||
}
|
||||
_setProperty(propertyName, value, priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if CSS Transitions are supported.
|
||||
*/
|
||||
static bool get supportsTransitions => true;
|
||||
$endif
|
||||
$!MEMBERS
|
||||
$if DART2JS
|
||||
""")
|
||||
|
||||
for camelName in sorted(universal_properties):
|
||||
|
@ -259,7 +219,6 @@ $if DART2JS
|
|||
camelName, camelName))
|
||||
|
||||
class_file.write("""
|
||||
$endif
|
||||
}
|
||||
|
||||
class _CssStyleDeclarationSet extends Object with CssStyleDeclarationBase {
|
||||
|
@ -283,7 +242,6 @@ class _CssStyleDeclarationSet extends Object with CssStyleDeclarationBase {
|
|||
""")
|
||||
|
||||
class_file.write("""
|
||||
$if DART2JS
|
||||
void _setAll(String propertyName, String value) {
|
||||
value = value == null ? '' : value;
|
||||
for (Element element in _elementIterable) {
|
||||
|
@ -303,7 +261,6 @@ $if DART2JS
|
|||
""" % (property, camelName, camelName))
|
||||
|
||||
class_file.write("""
|
||||
$endif
|
||||
|
||||
// Important note: CssStyleDeclarationSet does NOT implement every method
|
||||
// available in CssStyleDeclaration. Some of the methods don't make so much
|
||||
|
@ -312,23 +269,9 @@ $endif
|
|||
// items in the MEMBERS set if you want that functionality.
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
abstract class CssStyleDeclarationBase {
|
||||
String getPropertyValue(String propertyName);
|
||||
void setProperty(String propertyName, String value, [String priority]);
|
||||
$else
|
||||
$if JSINTEROP
|
||||
class CssStyleDeclarationBase {
|
||||
String getPropertyValue(String propertyName) =>
|
||||
throw new StateError('getProperty not overridden in dart:html');
|
||||
void setProperty(String propertyName, String value, [String priority]) =>
|
||||
throw new StateError('setProperty not overridden in dart:html');
|
||||
$else
|
||||
abstract class CssStyleDeclarationBase {
|
||||
String getPropertyValue(String propertyName);
|
||||
void setProperty(String propertyName, String value, [String priority]);
|
||||
$endif
|
||||
$endif
|
||||
""")
|
||||
|
||||
class_lines = [];
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
part of html;
|
||||
|
||||
/**
|
||||
* A set (union) of the CSS classes that are present in a set of elements.
|
||||
* Implemented separately from _ElementCssClassSet for performance.
|
||||
*/
|
||||
class _MultiElementCssClassSet extends CssClassSetImpl {
|
||||
final Iterable<Element> _elementIterable;
|
||||
Iterable<_ElementCssClassSet> _elementCssClassSetIterable;
|
||||
|
||||
_MultiElementCssClassSet(this._elementIterable) {
|
||||
_elementCssClassSetIterable =
|
||||
new List.from(_elementIterable).map((e) => new _ElementCssClassSet(e));
|
||||
}
|
||||
|
||||
Set<String> readClasses() {
|
||||
var s = new LinkedHashSet<String>();
|
||||
_elementCssClassSetIterable
|
||||
.forEach((_ElementCssClassSet e) => s.addAll(e.readClasses()));
|
||||
return s;
|
||||
}
|
||||
|
||||
void writeClasses(Set<String> s) {
|
||||
var classes = s.join(' ');
|
||||
for (Element e in _elementIterable) {
|
||||
e.className = classes;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method used to modify the set of css classes on this element.
|
||||
*
|
||||
* f - callback with:
|
||||
* s - a Set of all the css class name currently on this element.
|
||||
*
|
||||
* After f returns, the modified set is written to the
|
||||
* className property of this element.
|
||||
*/
|
||||
modify(f(Set<String> s)) {
|
||||
_elementCssClassSetIterable.forEach((_ElementCssClassSet e) => e.modify(f));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the class [value] to the element if it is not on it, removes it if it
|
||||
* is.
|
||||
*/
|
||||
bool toggle(String value, [bool shouldAdd]) =>
|
||||
_elementCssClassSetIterable.fold(
|
||||
false,
|
||||
(bool changed, _ElementCssClassSet e) =>
|
||||
e.toggle(value, shouldAdd) || changed);
|
||||
|
||||
/**
|
||||
* Remove the class [value] from element, and return true on successful
|
||||
* removal.
|
||||
*
|
||||
* This is the Dart equivalent of jQuery's
|
||||
* [removeClass](http://api.jquery.com/removeClass/).
|
||||
*/
|
||||
bool remove(Object value) => _elementCssClassSetIterable.fold(false,
|
||||
(bool changed, _ElementCssClassSet e) => e.remove(value) || changed);
|
||||
}
|
||||
|
||||
class _ElementCssClassSet extends CssClassSetImpl {
|
||||
final Element _element;
|
||||
|
||||
_ElementCssClassSet(this._element);
|
||||
|
||||
Set<String> readClasses() {
|
||||
var s = new LinkedHashSet<String>();
|
||||
var classname = _element.className;
|
||||
if (classname is svg.AnimatedString) {
|
||||
classname = classname.baseVal;
|
||||
}
|
||||
|
||||
for (String name in classname.split(' ')) {
|
||||
String trimmed = name.trim();
|
||||
if (!trimmed.isEmpty) {
|
||||
s.add(trimmed);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void writeClasses(Set<String> s) {
|
||||
_element.className = s.join(' ');
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
part of dart.dom.html;
|
||||
|
||||
/// Dartium ElementUpgrader implementation.
|
||||
class _VMElementUpgrader implements ElementUpgrader {
|
||||
final Type _type;
|
||||
final Type _nativeType;
|
||||
final String _extendsTag;
|
||||
|
||||
_VMElementUpgrader(Document document, Type type, String extendsTag)
|
||||
: _type = type,
|
||||
_extendsTag = extendsTag,
|
||||
_nativeType = _validateCustomType(type).reflectedType {
|
||||
if (extendsTag == null) {
|
||||
if (_nativeType != HtmlElement) {
|
||||
throw new UnsupportedError('Class must provide extendsTag if base '
|
||||
'native class is not HtmlElement');
|
||||
}
|
||||
} else {
|
||||
if (document.createElement(extendsTag).runtimeType != _nativeType) {
|
||||
throw new UnsupportedError(
|
||||
'extendsTag does not match base native class');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Element upgrade(element) {
|
||||
// Only exact type matches are supported- cannot be a subclass.
|
||||
if (element.runtimeType != _nativeType) {
|
||||
throw new ArgumentError('element is not subclass of $_nativeType');
|
||||
}
|
||||
return _createCustomUpgrader(_type, element);
|
||||
}
|
||||
}
|
||||
|
||||
/// Validates that the custom type is properly formed-
|
||||
///
|
||||
/// * Is a user-defined class.
|
||||
/// * Has a created constructor with zero args.
|
||||
/// * Derives from an Element subclass.
|
||||
///
|
||||
/// Then returns the native base class.
|
||||
ClassMirror _validateCustomType(Type type) {
|
||||
ClassMirror cls = reflectClass(type);
|
||||
if (_isBuiltinType(cls)) {
|
||||
throw new UnsupportedError('Invalid custom element from '
|
||||
'${(cls.owner as LibraryMirror).uri}.');
|
||||
}
|
||||
|
||||
var className = MirrorSystem.getName(cls.simpleName);
|
||||
if (cls.isAbstract) {
|
||||
throw new UnsupportedError('Invalid custom element '
|
||||
'class $className is abstract.');
|
||||
}
|
||||
|
||||
var createdConstructor = cls.declarations[new Symbol('$className.created')];
|
||||
if (createdConstructor == null ||
|
||||
createdConstructor is! MethodMirror ||
|
||||
!createdConstructor.isConstructor) {
|
||||
throw new UnsupportedError(
|
||||
'Class is missing constructor $className.created');
|
||||
}
|
||||
|
||||
if (createdConstructor.parameters.length > 0) {
|
||||
throw new UnsupportedError(
|
||||
'Constructor $className.created must take zero arguments');
|
||||
}
|
||||
|
||||
Symbol objectName = reflectClass(Object).qualifiedName;
|
||||
bool isRoot(ClassMirror cls) =>
|
||||
cls == null || cls.qualifiedName == objectName;
|
||||
Symbol elementName = reflectClass(HtmlElement).qualifiedName;
|
||||
bool isElement(ClassMirror cls) =>
|
||||
cls != null && cls.qualifiedName == elementName;
|
||||
ClassMirror superClass = cls.superclass;
|
||||
ClassMirror nativeClass = _isBuiltinType(superClass) ? superClass : null;
|
||||
while (!isRoot(superClass) && !isElement(superClass)) {
|
||||
superClass = superClass.superclass;
|
||||
if (nativeClass == null && _isBuiltinType(superClass)) {
|
||||
nativeClass = superClass;
|
||||
}
|
||||
}
|
||||
return nativeClass;
|
||||
}
|
||||
|
||||
bool _isBuiltinType(ClassMirror cls) {
|
||||
// TODO(vsm): Find a less hackish way to do this.
|
||||
LibraryMirror lib = cls.owner;
|
||||
String libName = lib.uri.toString();
|
||||
return libName.startsWith('dart:');
|
||||
}
|
|
@ -1,175 +0,0 @@
|
|||
/**
|
||||
* A custom KeyboardEvent that attempts to eliminate cross-browser
|
||||
* inconsistencies, and also provide both keyCode and charCode information
|
||||
* for all key events (when such information can be determined).
|
||||
*
|
||||
* KeyEvent tries to provide a higher level, more polished keyboard event
|
||||
* information on top of the "raw" [KeyboardEvent].
|
||||
*
|
||||
* The mechanics of using KeyEvents is a little different from the underlying
|
||||
* [KeyboardEvent]. To use KeyEvents, you need to create a stream and then add
|
||||
* KeyEvents to the stream, rather than using the [EventTarget.dispatchEvent].
|
||||
* Here's an example usage:
|
||||
*
|
||||
* // Initialize a stream for the KeyEvents:
|
||||
* var stream = KeyEvent.keyPressEvent.forTarget(document.body);
|
||||
* // Start listening to the stream of KeyEvents.
|
||||
* stream.listen((keyEvent) =>
|
||||
* window.console.log('KeyPress event detected ${keyEvent.charCode}'));
|
||||
* ...
|
||||
* // Add a new KeyEvent of someone pressing the 'A' key to the stream so
|
||||
* // listeners can know a KeyEvent happened.
|
||||
* stream.add(new KeyEvent('keypress', keyCode: 65, charCode: 97));
|
||||
*
|
||||
* This class is very much a work in progress, and we'd love to get information
|
||||
* on how we can make this class work with as many international keyboards as
|
||||
* possible. Bugs welcome!
|
||||
*/
|
||||
part of html;
|
||||
|
||||
@Experimental()
|
||||
class KeyEvent extends _WrappedEvent implements KeyboardEvent {
|
||||
/** Needed because KeyboardEvent is implements.
|
||||
*/
|
||||
/** The parent KeyboardEvent that this KeyEvent is wrapping and "fixing". */
|
||||
KeyboardEvent _parent;
|
||||
|
||||
/** The "fixed" value of whether the alt key is being pressed. */
|
||||
bool _shadowAltKey;
|
||||
|
||||
/** Calculated value of what the estimated charCode is for this event. */
|
||||
int _shadowCharCode;
|
||||
|
||||
/** Calculated value of what the estimated keyCode is for this event. */
|
||||
int _shadowKeyCode;
|
||||
|
||||
/** Calculated value of what the estimated keyCode is for this event. */
|
||||
int get keyCode => _shadowKeyCode;
|
||||
|
||||
/** Calculated value of what the estimated charCode is for this event. */
|
||||
int get charCode => this.type == 'keypress' ? _shadowCharCode : 0;
|
||||
|
||||
/** Calculated value of whether the alt key is pressed is for this event. */
|
||||
bool get altKey => _shadowAltKey;
|
||||
|
||||
/** Calculated value of what the estimated keyCode is for this event. */
|
||||
int get which => keyCode;
|
||||
|
||||
/** Accessor to the underlying keyCode value is the parent event. */
|
||||
int get _realKeyCode => _parent.keyCode;
|
||||
|
||||
/** Accessor to the underlying charCode value is the parent event. */
|
||||
int get _realCharCode => _parent.charCode;
|
||||
|
||||
/** Accessor to the underlying altKey value is the parent event. */
|
||||
bool get _realAltKey => _parent.altKey;
|
||||
|
||||
/** Shadows on top of the parent's currentTarget. */
|
||||
EventTarget _currentTarget;
|
||||
|
||||
final InputDeviceCapabilities sourceCapabilities;
|
||||
|
||||
/** Construct a KeyEvent with [parent] as the event we're emulating. */
|
||||
KeyEvent.wrap(KeyboardEvent parent) : super(parent) {
|
||||
_parent = parent;
|
||||
_shadowAltKey = _realAltKey;
|
||||
_shadowCharCode = _realCharCode;
|
||||
_shadowKeyCode = _realKeyCode;
|
||||
_currentTarget =
|
||||
_parent.currentTarget == null ? window : _parent.currentTarget;
|
||||
}
|
||||
|
||||
/** Programmatically create a new KeyEvent (and KeyboardEvent). */
|
||||
factory KeyEvent(String type,
|
||||
{Window view,
|
||||
bool canBubble: true,
|
||||
bool cancelable: true,
|
||||
int keyCode: 0,
|
||||
int charCode: 0,
|
||||
int keyLocation: 1,
|
||||
bool ctrlKey: false,
|
||||
bool altKey: false,
|
||||
bool shiftKey: false,
|
||||
bool metaKey: false,
|
||||
EventTarget currentTarget}) {
|
||||
var parent = new KeyboardEvent(type,
|
||||
view: view,
|
||||
canBubble: canBubble,
|
||||
cancelable: cancelable,
|
||||
keyLocation: keyLocation,
|
||||
ctrlKey: ctrlKey,
|
||||
altKey: altKey,
|
||||
shiftKey: shiftKey,
|
||||
metaKey: metaKey);
|
||||
var keyEvent = new KeyEvent.wrap(parent);
|
||||
keyEvent._shadowAltKey = altKey;
|
||||
keyEvent._shadowCharCode = charCode;
|
||||
keyEvent._shadowKeyCode = keyCode;
|
||||
keyEvent._currentTarget = currentTarget == null ? window : currentTarget;
|
||||
return keyEvent;
|
||||
}
|
||||
|
||||
/** Accessor to provide a stream of KeyEvents on the desired target. */
|
||||
static EventStreamProvider<KeyEvent> keyDownEvent =
|
||||
new _KeyboardEventHandler('keydown');
|
||||
/** Accessor to provide a stream of KeyEvents on the desired target. */
|
||||
static EventStreamProvider<KeyEvent> keyUpEvent =
|
||||
new _KeyboardEventHandler('keyup');
|
||||
/** Accessor to provide a stream of KeyEvents on the desired target. */
|
||||
static EventStreamProvider<KeyEvent> keyPressEvent =
|
||||
new _KeyboardEventHandler('keypress');
|
||||
|
||||
/** The currently registered target for this event. */
|
||||
EventTarget get currentTarget => _currentTarget;
|
||||
|
||||
/** True if the ctrl key is pressed during this event. */
|
||||
bool get ctrlKey => _parent.ctrlKey;
|
||||
int get detail => _parent.detail;
|
||||
/**
|
||||
* Accessor to the part of the keyboard that the key was pressed from (one of
|
||||
* KeyLocation.STANDARD, KeyLocation.RIGHT, KeyLocation.LEFT,
|
||||
* KeyLocation.NUMPAD, KeyLocation.MOBILE, KeyLocation.JOYSTICK).
|
||||
*/
|
||||
int get keyLocation => _parent.keyLocation;
|
||||
/** True if the Meta (or Mac command) key is pressed during this event. */
|
||||
bool get metaKey => _parent.metaKey;
|
||||
/** True if the shift key was pressed during this event. */
|
||||
bool get shiftKey => _parent.shiftKey;
|
||||
Window get view => _parent.view;
|
||||
void _initUIEvent(
|
||||
String type, bool canBubble, bool cancelable, Window view, int detail) {
|
||||
throw new UnsupportedError("Cannot initialize a UI Event from a KeyEvent.");
|
||||
}
|
||||
|
||||
String get _shadowKeyIdentifier => _parent._keyIdentifier;
|
||||
|
||||
int get _charCode => charCode;
|
||||
int get _keyCode => keyCode;
|
||||
int get _which => which;
|
||||
String get _keyIdentifier {
|
||||
throw new UnsupportedError("keyIdentifier is unsupported.");
|
||||
}
|
||||
|
||||
void _initKeyboardEvent(
|
||||
String type,
|
||||
bool canBubble,
|
||||
bool cancelable,
|
||||
Window view,
|
||||
String keyIdentifier,
|
||||
int keyLocation,
|
||||
bool ctrlKey,
|
||||
bool altKey,
|
||||
bool shiftKey,
|
||||
bool metaKey) {
|
||||
throw new UnsupportedError(
|
||||
"Cannot initialize a KeyboardEvent from a KeyEvent.");
|
||||
}
|
||||
|
||||
@Experimental() // untriaged
|
||||
bool getModifierState(String keyArgument) => throw new UnimplementedError();
|
||||
@Experimental() // untriaged
|
||||
int get location => throw new UnimplementedError();
|
||||
@Experimental() // untriaged
|
||||
bool get repeat => throw new UnimplementedError();
|
||||
dynamic get _get_view => throw new UnimplementedError();
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
part of html;
|
||||
|
||||
class Platform {
|
||||
/**
|
||||
* Returns true if dart:typed_data types are supported on this
|
||||
* browser. If false, using these types will generate a runtime
|
||||
* error.
|
||||
*/
|
||||
static final supportsTypedData = true;
|
||||
|
||||
/**
|
||||
* Returns true if SIMD types in dart:typed_data types are supported
|
||||
* on this browser. If false, using these types will generate a runtime
|
||||
* error.
|
||||
*/
|
||||
static final supportsSimd = true;
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
part of dart.html;
|
||||
|
||||
/**
|
||||
* Helper class to implement custom events which wrap DOM events.
|
||||
* TODO(jacobr): consider using dart JsNative.$setInstanceInterceptor
|
||||
* instead of using wrappers as that would allow passing these wrappers
|
||||
* back through dispatchEvent unlike the current implementation.
|
||||
* See https://github.com/dart-lang/sdk/issues/16869
|
||||
*/
|
||||
class _WrappedEvent implements Event {
|
||||
/** Needed because KeyboardEvent is implements.
|
||||
*/
|
||||
final Event wrapped;
|
||||
|
||||
/** The CSS selector involved with event delegation. */
|
||||
String _selector;
|
||||
|
||||
_WrappedEvent(this.wrapped);
|
||||
|
||||
bool get bubbles => wrapped.bubbles;
|
||||
|
||||
bool get cancelable => wrapped.cancelable;
|
||||
|
||||
EventTarget get currentTarget => wrapped.currentTarget;
|
||||
|
||||
List<EventTarget> deepPath() {
|
||||
return wrapped.deepPath();
|
||||
}
|
||||
|
||||
bool get defaultPrevented => wrapped.defaultPrevented;
|
||||
|
||||
int get eventPhase => wrapped.eventPhase;
|
||||
|
||||
bool get isTrusted => wrapped.isTrusted;
|
||||
|
||||
bool get scoped => wrapped.scoped;
|
||||
|
||||
EventTarget get target => wrapped.target;
|
||||
|
||||
double get timeStamp => wrapped.timeStamp;
|
||||
|
||||
String get type => wrapped.type;
|
||||
|
||||
void _initEvent(String eventTypeArg, bool canBubbleArg, bool cancelableArg) {
|
||||
throw new UnsupportedError('Cannot initialize this Event.');
|
||||
}
|
||||
|
||||
void preventDefault() {
|
||||
wrapped.preventDefault();
|
||||
}
|
||||
|
||||
void stopImmediatePropagation() {
|
||||
wrapped.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
void stopPropagation() {
|
||||
wrapped.stopPropagation();
|
||||
}
|
||||
|
||||
/**
|
||||
* A pointer to the element whose CSS selector matched within which an event
|
||||
* was fired. If this Event was not associated with any Event delegation,
|
||||
* accessing this value will throw an [UnsupportedError].
|
||||
*/
|
||||
Element get matchingTarget {
|
||||
if (_selector == null) {
|
||||
throw new UnsupportedError('Cannot call matchingTarget if this Event did'
|
||||
' not arise as a result of event delegation.');
|
||||
}
|
||||
var currentTarget = this.currentTarget;
|
||||
var target = this.target;
|
||||
var matchedTarget;
|
||||
do {
|
||||
if (target.matches(_selector)) return target;
|
||||
target = target.parent;
|
||||
} while (target != null && target != currentTarget.parent);
|
||||
throw new StateError('No selector matched for populating matchedTarget.');
|
||||
}
|
||||
|
||||
/**
|
||||
* This event's path, taking into account shadow DOM.
|
||||
*
|
||||
* ## Other resources
|
||||
*
|
||||
* * [Shadow DOM extensions to
|
||||
* Event](http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-event)
|
||||
* from W3C.
|
||||
*/
|
||||
// https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#extensions-to-event
|
||||
@Experimental()
|
||||
List<Node> get path => wrapped.path;
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// DO NOT EDIT
|
||||
// Auto-generated dart:_chrome library.
|
||||
|
||||
/// Native wrappers for the Chrome Packaged App APIs.
|
||||
///
|
||||
/// These functions allow direct access to the Packaged App APIs, allowing
|
||||
/// Chrome Packaged Apps to be written using Dart.
|
||||
///
|
||||
/// For more information on these APIs, see the
|
||||
/// [Chrome APIs Documentation](http://developer.chrome.com/extensions/api_index.html)
|
||||
library _chrome;
|
||||
|
||||
import 'dart:_blink' as _blink;
|
|
@ -1,61 +0,0 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
#ifndef Dart$(INTERFACE)_h
|
||||
#define Dart$(INTERFACE)_h
|
||||
|
||||
#include "bindings/v8/ActiveDOMCallback.h"
|
||||
#include "bindings/dart/DartCallback.h"
|
||||
#include "bindings/dart/DartDOMWrapper.h"
|
||||
#include "$(INTERFACE).h"
|
||||
|
||||
namespace WebCore {
|
||||
|
||||
class Dart$(INTERFACE) : public $(INTERFACE), public ActiveDOMCallback {
|
||||
public:
|
||||
typedef Dart$(INTERFACE) NativeType;
|
||||
|
||||
static PassOwnPtr<NativeType> create(Dart_Handle object, Dart_Handle& exception)
|
||||
{
|
||||
return adoptPtr(new Dart$(INTERFACE)(object, exception, DartUtilities::scriptExecutionContext()));
|
||||
}
|
||||
|
||||
static PassOwnPtr<NativeType> createWithNullCheck(Dart_Handle object, Dart_Handle& exception)
|
||||
{
|
||||
if (Dart_IsNull(object))
|
||||
return PassOwnPtr<NativeType>();
|
||||
return create(object, exception);
|
||||
}
|
||||
|
||||
static PassOwnPtr<NativeType> create(Dart_NativeArguments args, int idx, Dart_Handle& exception)
|
||||
{
|
||||
Dart_Handle object = Dart_GetNativeArgument(args, idx);
|
||||
return create(object, exception);
|
||||
}
|
||||
|
||||
static PassOwnPtr<NativeType> createWithNullCheck(Dart_NativeArguments args, int idx, Dart_Handle& exception)
|
||||
{
|
||||
Dart_Handle object = Dart_GetNativeArgument(args, idx);
|
||||
if (Dart_IsNull(object))
|
||||
return PassOwnPtr<NativeType>();
|
||||
return create(object, exception);
|
||||
}
|
||||
|
||||
$HANDLERS
|
||||
|
||||
private:
|
||||
Dart$(INTERFACE)(Dart_Handle object, Dart_Handle& exception, ExecutionContext* context)
|
||||
: ActiveDOMCallback(context)
|
||||
, m_callback(object, exception)
|
||||
{
|
||||
}
|
||||
|
||||
DartCallback m_callback;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // Dart$(INTERFACE)_h
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
#include "config.h"
|
||||
#include "Dart$(INTERFACE).h"
|
||||
|
||||
#include "bindings/dart/DartBindingsCommonIncludes.h"
|
||||
$INCLUDES
|
||||
namespace WebCore {
|
||||
$HANDLERS
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
#define NO_IMPLICIT_ATOMICSTRING
|
||||
|
||||
$!INCLUDES
|
|
@ -1,74 +0,0 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
#ifndef Dart$(INTERFACE)_h
|
||||
#define Dart$(INTERFACE)_h
|
||||
|
||||
#include "bindings/dart/DartDOMWrapper.h"
|
||||
$WEBCORE_INCLUDES
|
||||
|
||||
// FIXME: We need this to access the WrapperTypeInfo.
|
||||
$V8_INTERFACE_INCLUDE
|
||||
|
||||
#include <dart_api.h>
|
||||
|
||||
namespace WebCore {
|
||||
|
||||
struct Dart$INTERFACE {
|
||||
static const int dartClassId = $(INTERFACE)ClassId;
|
||||
typedef $WEBCORE_CLASS_NAME NativeType;
|
||||
static const bool isNode = $IS_NODE;
|
||||
static const bool isActive = $IS_ACTIVE;
|
||||
static const bool isEventTarget = $IS_EVENT_TARGET;
|
||||
|
||||
static ActiveDOMObject* toActiveDOMObject(void* value)
|
||||
{
|
||||
$TO_ACTIVE
|
||||
}
|
||||
static EventTarget* toEventTarget(void* value)
|
||||
{
|
||||
$TO_EVENT_TARGET
|
||||
}
|
||||
static Node* toNode(void* value)
|
||||
{
|
||||
$TO_NODE
|
||||
}
|
||||
static $WEBCORE_CLASS_NAME* toNative(void* value)
|
||||
{
|
||||
return static_cast<$WEBCORE_CLASS_NAME*>(value);
|
||||
}
|
||||
|
||||
$TO_NATIVE
|
||||
$TO_DART
|
||||
static Dart_Handle toDart(PassRefPtr< $WEBCORE_CLASS_NAME > value)
|
||||
{
|
||||
return toDart(value.get());
|
||||
}
|
||||
static Dart_Handle createWrapper(PassRefPtr< $WEBCORE_CLASS_NAME > value)
|
||||
{
|
||||
return createWrapper(value.get());
|
||||
}
|
||||
static void returnToDart(Dart_NativeArguments args,
|
||||
PassRefPtr< $WEBCORE_CLASS_NAME > value,
|
||||
bool autoDartScope = true)
|
||||
{
|
||||
return returnToDart(args, value.get(), autoDartScope);
|
||||
}
|
||||
|
||||
static Dart_NativeFunction resolver(Dart_Handle name,
|
||||
int argumentCount,
|
||||
bool* autoSetupScope);
|
||||
};
|
||||
|
||||
Dart_Handle $(WEBCORE_CLASS_NAME_ESCAPED)_toDart(PassRefPtr< $WEBCORE_CLASS_NAME > value);
|
||||
|
||||
namespace Dart$(INTERFACE)Internal {
|
||||
$DECLARATIONS
|
||||
}
|
||||
|
||||
} // namespace WebCore
|
||||
|
||||
#endif // Dart$(INTERFACE)_h
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
#include "config.h"
|
||||
#include "DartWebkitClassIds.h"
|
||||
#include "Dart$(INTERFACE).h"
|
||||
|
||||
$INCLUDES
|
||||
namespace WebCore {
|
||||
|
||||
Dart_Handle $(WEBCORE_CLASS_NAME_ESCAPED)_toDart(PassRefPtr< $WEBCORE_CLASS_NAME > value) {
|
||||
return Dart$INTERFACE::toDart(value);
|
||||
}
|
||||
|
||||
namespace Dart$(INTERFACE)Internal {
|
||||
$CALLBACKS
|
||||
}
|
||||
|
||||
Dart_NativeFunction Dart$(INTERFACE)::resolver(Dart_Handle nameHandle, int argumentCount, bool* autoSetupScope)
|
||||
{
|
||||
String name = DartUtilities::toString(nameHandle);
|
||||
|
||||
$RESOLVER
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace WebCore
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
#include "config.h"
|
||||
$!INCLUDES
|
||||
#include <dart_api.h>
|
||||
|
||||
namespace WebCore {
|
||||
|
||||
Dart_NativeFunction $(LIBRARY_NAME)SnapshotResolver(Dart_Handle name, int argumentCount, bool* autoSetupScope)
|
||||
{
|
||||
$!RESOLVER_BODY
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
part of $LIBRARYNAME;
|
||||
|
||||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$MIXINS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
}
|
|
@ -1,389 +0,0 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// DO NOT EDIT
|
||||
// Auto-generated dart:html library.
|
||||
|
||||
/**
|
||||
* HTML elements and other resources for web-based applications that need to
|
||||
* interact with the browser and the DOM (Document Object Model).
|
||||
*
|
||||
* This library includes DOM element types, CSS styling, local storage,
|
||||
* media, speech, events, and more.
|
||||
* To get started,
|
||||
* check out the [Element] class, the base class for many of the HTML
|
||||
* DOM types.
|
||||
*
|
||||
* ## Other resources
|
||||
*
|
||||
* * If you've never written a web app before, try our
|
||||
* tutorials—[A Game of Darts](http://dartlang.org/docs/tutorials).
|
||||
*
|
||||
* * To see some web-based Dart apps in action and to play with the code,
|
||||
* download
|
||||
* [Dart Editor](http://www.dartlang.org/#get-started)
|
||||
* and run its built-in examples.
|
||||
*
|
||||
* * For even more examples, see
|
||||
* [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
|
||||
* on Github.
|
||||
*/
|
||||
library dart.dom.html;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'dart:_internal' hide Symbol;
|
||||
import 'dart:html_common';
|
||||
import 'dart:indexed_db';
|
||||
import 'dart:indexed_db' show indexed_dbBlinkMap;
|
||||
import 'dart:isolate';
|
||||
import 'dart:js' as js;
|
||||
import "dart:convert";
|
||||
import 'dart:math';
|
||||
// TODO(vsm): Remove this when we can do the proper checking in
|
||||
// native code for custom elements.
|
||||
import 'dart:mirrors';
|
||||
import 'dart:nativewrappers';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:web_gl' as gl;
|
||||
import 'dart:web_gl' show web_glBlinkMap;
|
||||
import 'dart:web_sql';
|
||||
// Not actually used, but imported since dart:html can generate these objects.
|
||||
import 'dart:svg' as svg;
|
||||
import 'dart:svg' show svgBlinkMap;
|
||||
import 'dart:svg' show Matrix;
|
||||
import 'dart:svg' show SvgSvgElement;
|
||||
import 'dart:web_audio' as web_audio;
|
||||
import 'dart:web_audio' show web_audioBlinkMap;
|
||||
import 'dart:_blink' as _blink;
|
||||
import 'dart:developer';
|
||||
|
||||
export 'dart:math' show Rectangle, Point;
|
||||
|
||||
$!GENERATED_DART_FILES
|
||||
|
||||
// Issue 14721, order important for WrappedEvent.
|
||||
part '$AUXILIARY_DIR/AttributeMap.dart';
|
||||
part '$AUXILIARY_DIR/CanvasImageSource.dart';
|
||||
part '$AUXILIARY_DIR/CrossFrameTypes.dart';
|
||||
part '$AUXILIARY_DIR/CssClassSet.dart';
|
||||
part '$AUXILIARY_DIR/dartium_CssClassSet.dart';
|
||||
part '$AUXILIARY_DIR/CssRectangle.dart';
|
||||
part '$AUXILIARY_DIR/Dimension.dart';
|
||||
part '$AUXILIARY_DIR/EventListener.dart';
|
||||
part '$AUXILIARY_DIR/EventStreamProvider.dart';
|
||||
part '$AUXILIARY_DIR/Html5NodeValidator.dart';
|
||||
part '$AUXILIARY_DIR/ImmutableListMixin.dart';
|
||||
part '$AUXILIARY_DIR/KeyCode.dart';
|
||||
part '$AUXILIARY_DIR/KeyLocation.dart';
|
||||
part '$AUXILIARY_DIR/KeyName.dart';
|
||||
part '$AUXILIARY_DIR/KeyboardEventStream.dart';
|
||||
part '$AUXILIARY_DIR/NodeValidatorBuilder.dart';
|
||||
part '$AUXILIARY_DIR/ReadyState.dart';
|
||||
part '$AUXILIARY_DIR/Validators.dart';
|
||||
part '$AUXILIARY_DIR/WrappedList.dart';
|
||||
part '$AUXILIARY_DIR/_HttpRequestUtils.dart';
|
||||
part '$AUXILIARY_DIR/_ListIterators.dart';
|
||||
part '$AUXILIARY_DIR/dartium_CustomElementSupport.dart';
|
||||
part '$AUXILIARY_DIR/dartium_KeyEvent.dart';
|
||||
part '$AUXILIARY_DIR/dartium_Platform.dart';
|
||||
part '$AUXILIARY_DIR/dartium_WrappedEvent.dart';
|
||||
part '$AUXILIARY_DIR/shared_html.dart';
|
||||
|
||||
part '$AUXILIARY_DIR/native_DOMImplementation.dart';
|
||||
|
||||
Window _window;
|
||||
|
||||
/**
|
||||
* Top-level container for a web page, which is usually a browser tab or window.
|
||||
*
|
||||
* Each web page loaded in the browser has its own [Window], which is a
|
||||
* container for the web page.
|
||||
*
|
||||
* If the web page has any `<iframe>` elements, then each `<iframe>` has its own
|
||||
* [Window] object, which is accessible only to that `<iframe>`.
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* * [Window](https://developer.mozilla.org/en-US/docs/Web/API/window) from MDN.
|
||||
*/
|
||||
Window get window {
|
||||
if (_window != null) {
|
||||
return _window;
|
||||
}
|
||||
$if DARTIUM
|
||||
$if JSINTEROP
|
||||
_window = js.JsNative.toTypedObject(js.context);
|
||||
$else
|
||||
_window = _Utils.window();
|
||||
$endif
|
||||
$endif
|
||||
return _window;
|
||||
}
|
||||
|
||||
HtmlDocument _document;
|
||||
|
||||
/**
|
||||
* Root node for all content in a web page.
|
||||
*/
|
||||
HtmlDocument get document {
|
||||
if (_document != null) {
|
||||
return _document;
|
||||
}
|
||||
_document = window.document;
|
||||
return _document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn a DOM isolate using the given URI in the same window.
|
||||
* This isolate is not concurrent. It runs on the browser thread
|
||||
* with full access to the DOM.
|
||||
* Note: this API is still evolving and may move to dart:isolate.
|
||||
*/
|
||||
@Experimental()
|
||||
Future<Isolate> spawnDomUri(Uri uri, List<String> args, message) {
|
||||
// TODO(17738): Plumb arguments and return value through.
|
||||
return _Utils.spawnDomUri(uri.toString());
|
||||
}
|
||||
// FIXME: Can we make this private?
|
||||
@Deprecated("Internal Use Only")
|
||||
final htmlBlinkMap = {
|
||||
'_HistoryCrossFrame': () => _HistoryCrossFrame,
|
||||
'_LocationCrossFrame': () => _LocationCrossFrame,
|
||||
'_DOMWindowCrossFrame': () => _DOMWindowCrossFrame,
|
||||
// FIXME: Move these to better locations.
|
||||
'DateTime': () => DateTime,
|
||||
'JsObject': () => js.JsObject,
|
||||
'JsFunction': () => js.JsFunction,
|
||||
'JsArray': () => js.JsArray,
|
||||
// We have to call .instanceRuntimeType as these classes have a private
|
||||
// implementation class defined dynamically at runtime via a patch file.
|
||||
'JSObject': () => js.JSObject.instanceRuntimeType,
|
||||
'JSFunction': () => js.JSFunction.instanceRuntimeType,
|
||||
'JSArray': () => js.JSArray.instanceRuntimeType,
|
||||
$!TYPE_MAP
|
||||
};
|
||||
|
||||
// TODO(leafp): We may want to move this elsewhere if html becomes
|
||||
// a package to avoid dartium depending on pkg:html.
|
||||
@Deprecated("Internal Use Only")
|
||||
getHtmlCreateType(String key) => _getType(key);
|
||||
|
||||
Type _getType(String key) {
|
||||
var result;
|
||||
|
||||
// TODO(vsm): Add Cross Frame and JS types here as well.
|
||||
|
||||
// Check the html library.
|
||||
result = _getHtmlType(key);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check the web gl library.
|
||||
result = _getWebGlType(key);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check the indexed db library.
|
||||
result = _getIndexDbType(key);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check the web audio library.
|
||||
result = _getWebAudioType(key);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check the web sql library.
|
||||
result = _getWebSqlType(key);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check the svg library.
|
||||
result = _getSvgType(key);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Type _getHtmlType(String key) {
|
||||
if (htmlBlinkMap.containsKey(key)) {
|
||||
return htmlBlinkMap[key]();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Type _getWebGlType(String key) {
|
||||
if (web_glBlinkMap.containsKey(key)) {
|
||||
return web_glBlinkMap[key]();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Type _getIndexDbType(String key) {
|
||||
if (indexed_dbBlinkMap.containsKey(key)) {
|
||||
return indexed_dbBlinkMap[key]();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Type _getWebAudioType(String key) {
|
||||
if (web_audioBlinkMap.containsKey(key)) {
|
||||
return web_audioBlinkMap[key]();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Type _getWebSqlType(String key) {
|
||||
if (web_sqlBlinkMap.containsKey(key)) {
|
||||
return web_sqlBlinkMap[key]();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Type _getSvgType(String key) {
|
||||
if (svgBlinkMap.containsKey(key)) {
|
||||
return svgBlinkMap[key]();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO(jacobr): it would be nice to place these conversion methods in a consistent place for dart2js and dartium.
|
||||
|
||||
WindowBase _convertNativeToDart_Window(win) {
|
||||
if (win == null) return null;
|
||||
return _DOMWindowCrossFrame._createSafe(win);
|
||||
}
|
||||
|
||||
EventTarget _convertNativeToDart_EventTarget(e) {
|
||||
if (e == null) {
|
||||
return null;
|
||||
}
|
||||
// Assume it's a Window if it contains the postMessage property. It may be
|
||||
// from a different frame - without a patched prototype - so we cannot
|
||||
// rely on Dart type checking.
|
||||
try {
|
||||
if (js.JsNative.hasProperty(e, "postMessage")) {
|
||||
var window = _DOMWindowCrossFrame._createSafe(e);
|
||||
// If it's a native window.
|
||||
if (window is EventTarget) {
|
||||
return window;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
} catch (err) {
|
||||
print("Error calling _convertNativeToDart_EventTarget... $err");
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
EventTarget _convertDartToNative_EventTarget(e) {
|
||||
// _DOMWindowCrossFrame uses an interceptor so we don't need to do anything unlike Dart2Js.
|
||||
return e;
|
||||
}
|
||||
|
||||
_convertNativeToDart_XHR_Response(o) {
|
||||
if (o is Document) {
|
||||
return o;
|
||||
}
|
||||
return convertNativeToDart_SerializedScriptValue(o);
|
||||
}
|
||||
|
||||
$if JSINTEROP
|
||||
|
||||
/******************************************************************************
|
||||
********** **********
|
||||
********** JS Interop Support **********
|
||||
********** **********
|
||||
******************************************************************************/
|
||||
|
||||
String _getCustomElementExtends(object) {
|
||||
var entry = getCustomElementEntry(object);
|
||||
if (entry != null) {
|
||||
return entry['extends'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return the tag name or is attribute of the custom element or data binding.
|
||||
String _getCustomElementName(element) {
|
||||
var jsObject;
|
||||
var tag = "";
|
||||
var runtimeType = element.runtimeType;
|
||||
if (runtimeType == TemplateElement) {
|
||||
// Data binding with a Dart class.
|
||||
tag = element.attributes['is'];
|
||||
} else if (element is HtmlElement) {
|
||||
tag = element.attributes['is'];
|
||||
if (tag == null) {
|
||||
// It's a custom element we want the local name.
|
||||
tag = element.localName;
|
||||
}
|
||||
} else {
|
||||
throw new UnsupportedError('Element is incorrect type. Got ${runtimeType}, expected HtmlElement/HtmlTemplate/JsObject.');
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
/// An abstract class for all DOM objects we wrap in dart:html and related
|
||||
/// libraries.
|
||||
@Deprecated("Internal Use Only")
|
||||
class DartHtmlDomObject extends js.JSObject {
|
||||
DartHtmlDomObject() : super.internal();
|
||||
}
|
||||
|
||||
@Deprecated("Internal Use Only")
|
||||
class DebugAssertException implements Exception {
|
||||
String message;
|
||||
DebugAssertException(this.message);
|
||||
}
|
||||
|
||||
@Deprecated("Internal Use Only")
|
||||
debug_or_assert(message, expression) {
|
||||
if (!expression) {
|
||||
throw new DebugAssertException("$message");
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Internal Use Only")
|
||||
Map<String, dynamic> convertNativeObjectToDartMap(js.JsObject jsObject) {
|
||||
var result = new Map();
|
||||
var keys = js.JsNative.callMethod(js.JsNative.getProperty(js.context, 'Object'), 'keys', [jsObject]);
|
||||
for (var key in keys) {
|
||||
result[key] = js.JsNative.getProperty(jsObject, key);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade the JS HTMLElement to the Dart class. Used by Dart's Polymer.
|
||||
*/
|
||||
_createCustomUpgrader(Type customElementClass, $this) {
|
||||
return _blink.Blink_Utils.setInstanceInterceptor($this, customElementClass, customElement: true);
|
||||
}
|
||||
|
||||
$else
|
||||
class DartHtmlDomObject extends NativeFieldWrapperClass2 {}
|
||||
|
||||
_createCustomUpgrader(Type customElementClass, $this) => $this;
|
||||
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Emitted for any setlike IDL entry needs a callback signature.
|
||||
* Today there is only one.
|
||||
*/
|
||||
@DomName('FontFaceSetForEachCallback')
|
||||
@Experimental() // untriaged
|
||||
typedef void FontFaceSetForEachCallback(
|
||||
FontFace fontFace, FontFace fontFaceAgain, FontFaceSet set);
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
part of $LIBRARYNAME;
|
||||
|
||||
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
|
||||
factory $CLASSNAME(String type, {
|
||||
Window view,
|
||||
bool canBubble: true,
|
||||
bool cancelable: true,
|
||||
int location,
|
||||
int keyLocation, // Legacy alias for location
|
||||
bool ctrlKey: false,
|
||||
bool altKey: false,
|
||||
bool shiftKey: false,
|
||||
bool metaKey: false}) {
|
||||
if (view == null) {
|
||||
view = window;
|
||||
}
|
||||
location ??= keyLocation ?? 1;
|
||||
final e = document._createEvent("KeyboardEvent");
|
||||
e._initKeyboardEvent(type, canBubble, cancelable, view, "",
|
||||
location, ctrlKey, altKey, shiftKey, metaKey);
|
||||
return e;
|
||||
}
|
||||
|
||||
@DomName('KeyboardEvent.keyCode')
|
||||
int get keyCode => _keyCode;
|
||||
|
||||
@DomName('KeyboardEvent.charCode')
|
||||
int get charCode => _charCode;
|
||||
|
||||
@DomName('KeyboardEvent.which')
|
||||
int get which => _which;
|
||||
$!MEMBERS
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// WARNING: Do not edit - generated code.
|
||||
|
||||
part of $LIBRARYNAME;
|
||||
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
factory $CLASSNAME(String type,
|
||||
{Window view, int detail: 0, int screenX: 0, int screenY: 0,
|
||||
int clientX: 0, int clientY: 0, int button: 0, bool canBubble: true,
|
||||
bool cancelable: true, bool ctrlKey: false, bool altKey: false,
|
||||
bool shiftKey: false, bool metaKey: false, EventTarget relatedTarget}) {
|
||||
|
||||
if (view == null) {
|
||||
view = window;
|
||||
}
|
||||
var event = document._createEvent('MouseEvent');
|
||||
event._initMouseEvent(type, canBubble, cancelable, view, detail,
|
||||
screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey,
|
||||
button, relatedTarget);
|
||||
return event;
|
||||
}
|
||||
$!MEMBERS
|
||||
|
||||
@deprecated
|
||||
int get clientX => client.x;
|
||||
@deprecated
|
||||
int get clientY => client.y;
|
||||
@deprecated
|
||||
int get offsetX => offset.x;
|
||||
@deprecated
|
||||
int get offsetY => offset.y;
|
||||
@deprecated
|
||||
int get movementX => movement.x;
|
||||
@deprecated
|
||||
int get movementY => movement.y;
|
||||
@deprecated
|
||||
int get screenX => screen.x;
|
||||
@deprecated
|
||||
int get screenY => screen.y;
|
||||
|
||||
@DomName('MouseEvent.clientX')
|
||||
@DomName('MouseEvent.clientY')
|
||||
Point get client => new Point/*<num>*/(_clientX, _clientY);
|
||||
|
||||
@DomName('MouseEvent.movementX')
|
||||
@DomName('MouseEvent.movementY')
|
||||
@SupportedBrowser(SupportedBrowser.CHROME)
|
||||
@SupportedBrowser(SupportedBrowser.FIREFOX)
|
||||
@Experimental()
|
||||
Point get movement => new Point/*<num>*/(_movementX, _movementY);
|
||||
|
||||
/**
|
||||
* The coordinates of the mouse pointer in target node coordinates.
|
||||
*
|
||||
* This value may vary between platforms if the target node moves
|
||||
* after the event has fired or if the element has CSS transforms affecting
|
||||
* it.
|
||||
*/
|
||||
Point get offset => new Point/*<num>*/(_offsetX, _offsetY);
|
||||
|
||||
@DomName('MouseEvent.screenX')
|
||||
@DomName('MouseEvent.screenY')
|
||||
Point get screen => new Point/*<num>*/(_screenX, _screenY);
|
||||
|
||||
@DomName('MouseEvent.layerX')
|
||||
@DomName('MouseEvent.layerY')
|
||||
Point get layer => new Point/*<num>*/(_layerX, _layerY);
|
||||
|
||||
@DomName('MouseEvent.pageX')
|
||||
@DomName('MouseEvent.pageY')
|
||||
Point get page => new Point/*<num>*/(_pageX, _pageY);
|
||||
|
||||
@DomName('MouseEvent.dataTransfer')
|
||||
DataTransfer get dataTransfer => js.JsNative.getProperty(this, 'dataTransfer');
|
||||
|
||||
}
|
|
@ -1,177 +0,0 @@
|
|||
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// DO NOT EDIT
|
||||
// Auto-generated dart:indexed_db library.
|
||||
|
||||
/**
|
||||
* A client-side key-value store with support for indexes.
|
||||
*
|
||||
* Many browsers support IndexedDB—a web standard for
|
||||
* an indexed database.
|
||||
* By storing data on the client in an IndexedDB,
|
||||
* a web app gets some advantages, such as faster performance and persistence.
|
||||
* To find out which browsers support IndexedDB,
|
||||
* refer to [Can I Use?](http://caniuse.com/#feat=indexeddb)
|
||||
*
|
||||
* In IndexedDB, each record is identified by a unique index or key,
|
||||
* making data retrieval speedy.
|
||||
* You can store structured data,
|
||||
* such as images, arrays, and maps using IndexedDB.
|
||||
* The standard does not specify size limits for individual data items
|
||||
* or for the database itself, but browsers may impose storage limits.
|
||||
*
|
||||
* ## Using indexed_db
|
||||
*
|
||||
* The classes in this library provide an interface
|
||||
* to the browser's IndexedDB, if it has one.
|
||||
* To use this library in your code:
|
||||
*
|
||||
* import 'dart:indexed_db';
|
||||
*
|
||||
* A web app can determine if the browser supports
|
||||
* IndexedDB with [IdbFactory.supported]:
|
||||
*
|
||||
* if (IdbFactory.supported)
|
||||
* // Use indexeddb.
|
||||
* else
|
||||
* // Find an alternative.
|
||||
*
|
||||
* Access to the browser's IndexedDB is provided by the app's top-level
|
||||
* [Window] object, which your code can refer to with `window.indexedDB`.
|
||||
* So, for example,
|
||||
* here's how to use window.indexedDB to open a database:
|
||||
*
|
||||
* Future open() {
|
||||
* return window.indexedDB.open('myIndexedDB',
|
||||
* version: 1,
|
||||
* onUpgradeNeeded: _initializeDatabase)
|
||||
* .then(_loadFromDB);
|
||||
* }
|
||||
* void _initializeDatabase(VersionChangeEvent e) {
|
||||
* ...
|
||||
* }
|
||||
* Future _loadFromDB(Database db) {
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
*
|
||||
* All data in an IndexedDB is stored within an [ObjectStore].
|
||||
* To manipulate the database use [Transaction]s.
|
||||
*
|
||||
* ## Other resources
|
||||
*
|
||||
* Other options for client-side data storage include:
|
||||
*
|
||||
* * [Window.localStorage]—a
|
||||
* basic mechanism that stores data as a [Map],
|
||||
* and where both the keys and the values are strings.
|
||||
*
|
||||
* * [dart:web_sql]—a database that can be queried with SQL.
|
||||
*
|
||||
* For a tutorial about using the indexed_db library with Dart,
|
||||
* check out
|
||||
* [Use IndexedDB](http://www.dartlang.org/docs/tutorials/indexeddb/).
|
||||
*
|
||||
* [IndexedDB reference](http://docs.webplatform.org/wiki/apis/indexeddb)
|
||||
* provides wiki-style docs about indexedDB
|
||||
*/
|
||||
library dart.dom.indexed_db;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:html';
|
||||
import 'dart:html_common';
|
||||
import 'dart:nativewrappers';
|
||||
import 'dart:_blink' as _blink;
|
||||
import 'dart:js' as js;
|
||||
|
||||
$!GENERATED_DART_FILES
|
||||
|
||||
class _KeyRangeFactoryProvider {
|
||||
|
||||
static KeyRange createKeyRange_only(/*IDBKey*/ value) =>
|
||||
KeyRange.only_(value);
|
||||
|
||||
static KeyRange createKeyRange_lowerBound(
|
||||
/*IDBKey*/ bound, [bool open = false]) =>
|
||||
KeyRange.lowerBound_(bound, open);
|
||||
|
||||
static KeyRange createKeyRange_upperBound(
|
||||
/*IDBKey*/ bound, [bool open = false]) =>
|
||||
KeyRange.upperBound_(bound, open);
|
||||
|
||||
static KeyRange createKeyRange_bound(
|
||||
/*IDBKey*/ lower, /*IDBKey*/ upper,
|
||||
[bool lowerOpen = false, bool upperOpen = false]) =>
|
||||
KeyRange.bound_(lower, upper, lowerOpen, upperOpen);
|
||||
}
|
||||
// FIXME: Can we make this private?
|
||||
@Deprecated("Internal Use Only")
|
||||
final indexed_dbBlinkMap = {
|
||||
$!TYPE_MAP
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Per http://www.w3.org/TR/IndexedDB/#key-construct
|
||||
//
|
||||
// "A value is said to be a valid key if it is one of the following types: Array
|
||||
// JavaScript objects [ECMA-262], DOMString [WEBIDL], Date [ECMA-262] or float
|
||||
// [WEBIDL]. However Arrays are only valid keys if every item in the array is
|
||||
// defined and is a valid key (i.e. sparse arrays can not be valid keys) and if
|
||||
// the Array doesn't directly or indirectly contain itself. Any non-numeric
|
||||
// properties are ignored, and thus does not affect whether the Array is a valid
|
||||
// key. Additionally, if the value is of type float, it is only a valid key if
|
||||
// it is not NaN, and if the value is of type Date it is only a valid key if its
|
||||
// [[PrimitiveValue]] internal property, as defined by [ECMA-262], is not NaN."
|
||||
|
||||
// What is required is to ensure that an Lists in the key are actually
|
||||
// JavaScript arrays, and any Dates are JavaScript Dates.
|
||||
|
||||
|
||||
/**
|
||||
* Converts a native IDBKey into a Dart object.
|
||||
*
|
||||
* May return the original input. May mutate the original input (but will be
|
||||
* idempotent if mutation occurs). It is assumed that this conversion happens
|
||||
* on native IDBKeys on all paths that return IDBKeys from native DOM calls.
|
||||
*
|
||||
* If necessary, JavaScript Dates are converted into Dart Dates.
|
||||
*/
|
||||
_convertNativeToDart_IDBKey(nativeKey) {
|
||||
containsDate(object) {
|
||||
if (object is DateTime) return true;
|
||||
if (object is List) {
|
||||
for (int i = 0; i < object.length; i++) {
|
||||
if (containsDate(object[i])) return true;
|
||||
}
|
||||
}
|
||||
return false; // number, string.
|
||||
}
|
||||
if (nativeKey is DateTime) {
|
||||
throw new UnimplementedError('Key containing DateTime');
|
||||
}
|
||||
// TODO: Cache conversion somewhere?
|
||||
return nativeKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Dart object into a valid IDBKey.
|
||||
*
|
||||
* May return the original input. Does not mutate input.
|
||||
*
|
||||
* If necessary, [dartKey] may be copied to ensure all lists are converted into
|
||||
* JavaScript Arrays and Dart Dates into JavaScript Dates.
|
||||
*/
|
||||
_convertDartToNative_IDBKey(dartKey) {
|
||||
// TODO: Implement.
|
||||
return dartKey;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// May modify original. If so, action is idempotent.
|
||||
_convertNativeToDart_IDBAny(object) {
|
||||
return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false);
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// DO NOT EDIT
|
||||
// Auto-generated dart:svg library.
|
||||
|
||||
/**
|
||||
* Scalable Vector Graphics:
|
||||
* Two-dimensional vector graphics with support for events and animation.
|
||||
*
|
||||
* For details about the features and syntax of SVG, a W3C standard,
|
||||
* refer to the
|
||||
* [Scalable Vector Graphics Specification](http://www.w3.org/TR/SVG/).
|
||||
*/
|
||||
library dart.dom.svg;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'dart:_internal';
|
||||
import 'dart:html';
|
||||
import 'dart:html_common';
|
||||
import 'dart:nativewrappers';
|
||||
import 'dart:_blink' as _blink;
|
||||
import 'dart:js' as js;
|
||||
|
||||
part '$AUXILIARY_DIR/shared_SVGFactoryProviders.dart';
|
||||
|
||||
$!GENERATED_DART_FILES
|
||||
// FIXME: Can we make this private?
|
||||
@Deprecated("Internal Use Only")
|
||||
final svgBlinkMap = {
|
||||
$!TYPE_MAP
|
||||
};
|
|
@ -1,24 +0,0 @@
|
|||
// DO NOT EDIT
|
||||
// Auto-generated dart:audio library.
|
||||
|
||||
/**
|
||||
* High-fidelity audio programming in the browser.
|
||||
*/
|
||||
library dart.dom.web_audio;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'dart:_internal';
|
||||
import 'dart:html';
|
||||
import 'dart:html_common';
|
||||
import 'dart:nativewrappers';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:_blink' as _blink;
|
||||
import 'dart:js' as js;
|
||||
|
||||
$!GENERATED_DART_FILES
|
||||
// FIXME: Can we make this private?
|
||||
@Deprecated("Internal Use Only")
|
||||
final web_audioBlinkMap = {
|
||||
$!TYPE_MAP
|
||||
};
|
|
@ -1,26 +0,0 @@
|
|||
// DO NOT EDIT
|
||||
// Auto-generated dart:web_gl library.
|
||||
|
||||
/**
|
||||
* 3D programming in the browser.
|
||||
*/
|
||||
library dart.dom.web_gl;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'dart:_internal';
|
||||
import 'dart:html';
|
||||
import 'dart:html_common';
|
||||
import 'dart:nativewrappers';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:_blink' as _blink;
|
||||
import 'dart:js' as js;
|
||||
|
||||
part '$AUXILIARY_DIR/WebGLConstants.dart';
|
||||
|
||||
$!GENERATED_DART_FILES
|
||||
// FIXME: Can we make this private?
|
||||
@Deprecated("Internal Use Only")
|
||||
final web_glBlinkMap = {
|
||||
$!TYPE_MAP
|
||||
};
|
|
@ -1,32 +0,0 @@
|
|||
|
||||
// DO NOT EDIT - unless you are editing documentation as per:
|
||||
// https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
|
||||
// Auto-generated dart:audio library.
|
||||
|
||||
/**
|
||||
* An API for storing data in the browser that can be queried with SQL.
|
||||
*
|
||||
* **Caution:** this specification is no longer actively maintained by the Web
|
||||
* Applications Working Group and may be removed at any time.
|
||||
* See [the W3C Web SQL Database specification](http://www.w3.org/TR/webdatabase/)
|
||||
* for more information.
|
||||
*
|
||||
* The [dart:indexed_db] APIs is a recommended alternatives.
|
||||
*/
|
||||
library dart.dom.web_sql;
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'dart:_internal';
|
||||
import 'dart:html';
|
||||
import 'dart:html_common';
|
||||
import 'dart:nativewrappers';
|
||||
import 'dart:_blink' as _blink;
|
||||
import 'dart:js' as js;
|
||||
|
||||
$!GENERATED_DART_FILES
|
||||
// FIXME: Can we make this private?
|
||||
@Deprecated("Internal Use Only")
|
||||
final web_sqlBlinkMap = {
|
||||
$!TYPE_MAP
|
||||
};
|
|
@ -6,7 +6,6 @@ part of web_audio;
|
|||
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DART2JS
|
||||
factory AudioContext() => JS('AudioContext',
|
||||
'new (window.AudioContext || window.webkitAudioContext)()');
|
||||
|
||||
|
@ -33,9 +32,7 @@ $if DART2JS
|
|||
bufferSize);
|
||||
}
|
||||
}
|
||||
$endif
|
||||
|
||||
$if DART2JS
|
||||
@JSName('decodeAudioData')
|
||||
@DomName('AudioContext.decodeAudioData')
|
||||
@DocsEditable()
|
||||
|
@ -57,21 +54,4 @@ $if DART2JS
|
|||
});
|
||||
return completer.future;
|
||||
}
|
||||
$else
|
||||
@DomName('AudioContext.decodeAudioData')
|
||||
Future<AudioBuffer> decodeAudioData(ByteBuffer audioData,
|
||||
[AudioBufferCallback successCallback,
|
||||
AudioBufferCallback errorCallback]) {
|
||||
if (errorCallback != null) {
|
||||
return convertNativePromiseToDartFuture(_blink.BlinkAudioContext.instance.decodeAudioData_Callback_3_(
|
||||
this, audioData, successCallback, errorCallback));
|
||||
}
|
||||
if (successCallback != null) {
|
||||
return convertNativePromiseToDartFuture(_blink.BlinkAudioContext.instance
|
||||
.decodeAudioData_Callback_2_(this, audioData, successCallback));
|
||||
}
|
||||
return convertNativePromiseToDartFuture(_blink.BlinkAudioContext.instance
|
||||
.decodeAudioData_Callback_1_(this, audioData));
|
||||
}
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ part of $LIBRARYNAME;
|
|||
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DART2JS
|
||||
factory Blob(List blobParts, [String type, String endings]) {
|
||||
// TODO: validate that blobParts is a JS Array and convert if not.
|
||||
// TODO: any coercions on the elements of blobParts, e.g. coerce a typed
|
||||
|
@ -25,22 +24,4 @@ $if DART2JS
|
|||
|
||||
static _create_bag() => JS('var', '{}');
|
||||
static _bag_set(bag, key, value) { JS('void', '#[#] = #', bag, key, value); }
|
||||
$else
|
||||
$if JSINTEROP
|
||||
factory Blob(List blobParts, [String type, String endings]) {
|
||||
// TODO: any coercions on the elements of blobParts, e.g. coerce a typed
|
||||
// array to ArrayBuffer if it is a total view.
|
||||
|
||||
var parts = convertDartToNative_List(blobParts);
|
||||
if (type == null && endings == null) {
|
||||
return _blink.BlinkBlob.instance.constructorCallback_1_(parts);
|
||||
}
|
||||
var bag = {};
|
||||
if (type != null) bag['type'] = type;
|
||||
if (endings != null) bag['endings'] = endings;
|
||||
return _blink.BlinkBlob.instance.constructorCallback_2_(parts,
|
||||
convertDartToNative_Dictionary(bag));
|
||||
}
|
||||
$endif
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -49,22 +49,9 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME $EXTENDS with
|
|||
}
|
||||
|
||||
bool _supportsProperty(String propertyName) {
|
||||
$if DART2JS
|
||||
return JS('bool', '# in #', propertyName, this);
|
||||
$else
|
||||
// You can't just check the value of a property, because there is no way
|
||||
// to distinguish between property not being present in the browser and
|
||||
// not having a value at all. (Ultimately we'll want the native method to
|
||||
// return null if the property doesn't exist and empty string if it's
|
||||
// defined but just doesn't have a value.
|
||||
return _hasProperty(propertyName);
|
||||
$endif
|
||||
}
|
||||
|
||||
$if DARTIUM
|
||||
bool _hasProperty(String propertyName) =>
|
||||
_blink.BlinkCSSStyleDeclaration.instance.$__get___propertyIsEnumerable_Callback_1_(this, propertyName);
|
||||
$endif
|
||||
|
||||
@DomName('CSSStyleDeclaration.setProperty')
|
||||
void setProperty(String propertyName, String value, [String priority]) {
|
||||
|
@ -92,35 +79,22 @@ $endif
|
|||
return propertyName;
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
static final _propertyCache = JS('', '{}');
|
||||
static String _readCache(String key) =>
|
||||
JS('String|Null', '#[#]', _propertyCache, key);
|
||||
static void _writeCache(String key, String value) {
|
||||
JS('void', '#[#] = #', _propertyCache, key, value);
|
||||
}
|
||||
$else
|
||||
static String _readCache(String key) => null;
|
||||
static void _writeCache(String key, value) {}
|
||||
$endif
|
||||
|
||||
static String _camelCase(String hyphenated) {
|
||||
$if DART2JS
|
||||
var replacedMs = JS('String', r'#.replace(/^-ms-/, "ms-")', hyphenated);
|
||||
return JS(
|
||||
'String',
|
||||
r'#.replace(/-([\da-z])/ig,'
|
||||
r'function(_, letter) { return letter.toUpperCase();})',
|
||||
replacedMs);
|
||||
$else
|
||||
// The "ms" prefix is always lowercased.
|
||||
return hyphenated.replaceFirst(new RegExp('^-ms-'), 'ms-').replaceAllMapped(
|
||||
new RegExp('-([a-z]+)', caseSensitive: false),
|
||||
(match) => match[0][1].toUpperCase() + match[0].substring(2));
|
||||
$endif
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
void _setPropertyHelper(String propertyName, String value, [String priority]) {
|
||||
if (value == null) value = '';
|
||||
if (priority == null) priority = '';
|
||||
|
@ -133,21 +107,7 @@ $if DART2JS
|
|||
static bool get supportsTransitions {
|
||||
return document.body.style.supportsProperty('transition');
|
||||
}
|
||||
$else
|
||||
void _setPropertyHelper(String propertyName, String value, [String priority]) {
|
||||
if (priority == null) {
|
||||
priority = '';
|
||||
}
|
||||
_setProperty(propertyName, value, priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if CSS Transitions are supported.
|
||||
*/
|
||||
static bool get supportsTransitions => true;
|
||||
$endif
|
||||
$!MEMBERS
|
||||
$if DART2JS
|
||||
|
||||
/** Gets the value of "background" */
|
||||
String get background => this._background;
|
||||
|
@ -1139,7 +1099,6 @@ $if DART2JS
|
|||
@JSName('zIndex')
|
||||
String _zIndex;
|
||||
|
||||
$endif
|
||||
}
|
||||
|
||||
class _CssStyleDeclarationSet extends Object with CssStyleDeclarationBase {
|
||||
|
@ -1161,7 +1120,6 @@ class _CssStyleDeclarationSet extends Object with CssStyleDeclarationBase {
|
|||
}
|
||||
|
||||
|
||||
$if DART2JS
|
||||
void _setAll(String propertyName, String value) {
|
||||
value = value == null ? '' : value;
|
||||
for (Element element in _elementIterable) {
|
||||
|
@ -1619,7 +1577,6 @@ $if DART2JS
|
|||
_setAll('zIndex', value);
|
||||
}
|
||||
|
||||
$endif
|
||||
|
||||
// Important note: CssStyleDeclarationSet does NOT implement every method
|
||||
// available in CssStyleDeclaration. Some of the methods don't make so much
|
||||
|
@ -1628,23 +1585,9 @@ $endif
|
|||
// items in the MEMBERS set if you want that functionality.
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
abstract class CssStyleDeclarationBase {
|
||||
String getPropertyValue(String propertyName);
|
||||
void setProperty(String propertyName, String value, [String priority]);
|
||||
$else
|
||||
$if JSINTEROP
|
||||
class CssStyleDeclarationBase {
|
||||
String getPropertyValue(String propertyName) =>
|
||||
throw new StateError('getProperty not overridden in dart:html');
|
||||
void setProperty(String propertyName, String value, [String priority]) =>
|
||||
throw new StateError('setProperty not overridden in dart:html');
|
||||
$else
|
||||
abstract class CssStyleDeclarationBase {
|
||||
String getPropertyValue(String propertyName);
|
||||
void setProperty(String propertyName, String value, [String priority]);
|
||||
$endif
|
||||
$endif
|
||||
|
||||
/** Gets the value of "align-content" */
|
||||
String get alignContent =>
|
||||
|
|
|
@ -14,11 +14,7 @@ $!MEMBERS
|
|||
@DomName('CanvasRenderingContext2D.createImageDataFromImageData')
|
||||
@DocsEditable()
|
||||
ImageData createImageDataFromImageData(ImageData imagedata) =>
|
||||
$if DART2JS
|
||||
JS('ImageData', '#.createImageData(#)', this, imagedata);
|
||||
$else
|
||||
this.createImageData(imagedata);
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Sets the color used inside shapes.
|
||||
|
@ -60,21 +56,13 @@ $endif
|
|||
void arc(num x, num y, num radius, num startAngle, num endAngle,
|
||||
[bool anticlockwise = false]) {
|
||||
// TODO(terry): This should not be needed: dartbug.com/20939.
|
||||
$if DART2JS
|
||||
JS('void', '#.arc(#, #, #, #, #, #)', this, x, y, radius, startAngle,
|
||||
endAngle, anticlockwise);
|
||||
$else
|
||||
_arc(x, y, radius, startAngle, endAngle, anticlockwise);
|
||||
$endif
|
||||
}
|
||||
|
||||
@DomName('CanvasRenderingContext2D.createPatternFromImage')
|
||||
CanvasPattern createPatternFromImage(ImageElement image, String repetitionType) =>
|
||||
$if DART2JS
|
||||
JS('CanvasPattern', '#.createPattern(#, #)', this, image, repetitionType);
|
||||
$else
|
||||
createPattern(image, repetitionType);
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Draws an image from a CanvasImageSource to an area of this canvas.
|
||||
|
@ -119,7 +107,6 @@ $endif
|
|||
@DomName('CanvasRenderingContext2D.drawImage')
|
||||
void drawImageToRect(CanvasImageSource source, Rectangle destRect,
|
||||
{Rectangle sourceRect}) {
|
||||
$if DART2JS
|
||||
if (sourceRect == null) {
|
||||
drawImageScaled(source,
|
||||
destRect.left,
|
||||
|
@ -137,25 +124,6 @@ $if DART2JS
|
|||
destRect.width,
|
||||
destRect.height);
|
||||
}
|
||||
$else
|
||||
if (sourceRect == null) {
|
||||
_drawImage(source,
|
||||
destRect.left,
|
||||
destRect.top,
|
||||
destRect.width,
|
||||
destRect.height);
|
||||
} else {
|
||||
_drawImage(source,
|
||||
sourceRect.left,
|
||||
sourceRect.top,
|
||||
sourceRect.width,
|
||||
sourceRect.height,
|
||||
destRect.left,
|
||||
destRect.top,
|
||||
destRect.width,
|
||||
destRect.height);
|
||||
}
|
||||
$endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -188,14 +156,8 @@ $endif
|
|||
* from the WHATWG.
|
||||
*/
|
||||
@DomName('CanvasRenderingContext2D.drawImage')
|
||||
$if DART2JS
|
||||
@JSName('drawImage')
|
||||
void drawImage(CanvasImageSource source, num destX, num destY) native;
|
||||
$else
|
||||
void drawImage(CanvasImageSource source, num destX, num destY) {
|
||||
_drawImage(source, destX, destY);
|
||||
}
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Draws an image from a CanvasImageSource to an area of this canvas.
|
||||
|
@ -224,16 +186,9 @@ $endif
|
|||
* from the WHATWG.
|
||||
*/
|
||||
@DomName('CanvasRenderingContext2D.drawImage')
|
||||
$if DART2JS
|
||||
@JSName('drawImage')
|
||||
void drawImageScaled(CanvasImageSource source,
|
||||
num destX, num destY, num destWidth, num destHeight) native;
|
||||
$else
|
||||
void drawImageScaled(CanvasImageSource source,
|
||||
num destX, num destY, num destWidth, num destHeight) {
|
||||
_drawImage(source, destX, destY, destWidth, destHeight);
|
||||
}
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Draws an image from a CanvasImageSource to an area of this canvas.
|
||||
|
@ -265,21 +220,11 @@ $endif
|
|||
* from the WHATWG.
|
||||
*/
|
||||
@DomName('CanvasRenderingContext2D.drawImage')
|
||||
$if DART2JS
|
||||
@JSName('drawImage')
|
||||
void drawImageScaledFromSource(CanvasImageSource source,
|
||||
num sourceX, num sourceY, num sourceWidth, num sourceHeight,
|
||||
num destX, num destY, num destWidth, num destHeight) native;
|
||||
$else
|
||||
void drawImageScaledFromSource(CanvasImageSource source,
|
||||
num sourceX, num sourceY, num sourceWidth, num sourceHeight,
|
||||
num destX, num destY, num destWidth, num destHeight) {
|
||||
_drawImage(source, sourceX, sourceY, sourceWidth, sourceHeight,
|
||||
destX, destY, destWidth, destHeight);
|
||||
}
|
||||
$endif
|
||||
|
||||
$if DART2JS
|
||||
@SupportedBrowser(SupportedBrowser.CHROME)
|
||||
@SupportedBrowser(SupportedBrowser.SAFARI)
|
||||
@SupportedBrowser(SupportedBrowser.IE, '11')
|
||||
|
@ -302,10 +247,6 @@ $if DART2JS
|
|||
'typeof #.lineDashOffset != "undefined" ? #.lineDashOffset = # : '
|
||||
'#.webkitLineDashOffset = #', this, this, value, this, value);
|
||||
}
|
||||
$else
|
||||
// TODO(amouravski): Add Dartium native methods for drawImage once we figure
|
||||
// out how to not break native bindings.
|
||||
$endif
|
||||
|
||||
@SupportedBrowser(SupportedBrowser.CHROME)
|
||||
@SupportedBrowser(SupportedBrowser.SAFARI)
|
||||
|
@ -315,22 +256,13 @@ $endif
|
|||
List<num> getLineDash() {
|
||||
// TODO(14316): Firefox has this functionality with mozDash, but it's a bit
|
||||
// different.
|
||||
$if DART2JS
|
||||
if (JS('bool', '!!#.getLineDash', this)) {
|
||||
return JS('List<num>', '#.getLineDash()', this);
|
||||
} else if (JS('bool', '!!#.webkitLineDash', this)) {
|
||||
return JS('List<num>', '#.webkitLineDash', this);
|
||||
}
|
||||
$else
|
||||
var result = _getLineDash();
|
||||
if (result == null) {
|
||||
result = [];
|
||||
}
|
||||
return result;
|
||||
$endif
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
@SupportedBrowser(SupportedBrowser.CHROME)
|
||||
@SupportedBrowser(SupportedBrowser.SAFARI)
|
||||
@SupportedBrowser(SupportedBrowser.IE, '11')
|
||||
|
@ -345,9 +277,7 @@ $if DART2JS
|
|||
JS('void', '#.webkitLineDash = #', this, dash);
|
||||
}
|
||||
}
|
||||
$endif
|
||||
|
||||
$if DART2JS
|
||||
|
||||
/**
|
||||
* Draws text to the canvas.
|
||||
|
@ -376,7 +306,6 @@ $if DART2JS
|
|||
void fill([String winding = 'nonzero']) {
|
||||
JS('void', '#.fill(#)', this, winding);
|
||||
}
|
||||
$endif
|
||||
|
||||
/** Deprecated always returns 1.0 */
|
||||
@DomName('CanvasRenderingContext2D.webkitBackingStorePixelRation')
|
||||
|
|
|
@ -6,10 +6,8 @@ part of $LIBRARYNAME;
|
|||
|
||||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$MIXINS$IMPLEMENTS {
|
||||
$if DART2JS
|
||||
factory Comment([String data]) {
|
||||
return JS('returns:Comment;depends:none;effects:none;new:true',
|
||||
'#.createComment(#)', document, data == null ? "" : data);
|
||||
}
|
||||
$endif
|
||||
$!MEMBERS}
|
||||
|
|
|
@ -15,7 +15,6 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
}
|
||||
CompositionEvent e = document._createEvent("CompositionEvent");
|
||||
|
||||
$if DART2JS
|
||||
if (Device.isFirefox) {
|
||||
// Firefox requires the locale parameter that isn't supported elsewhere.
|
||||
JS('void', '#.initCompositionEvent(#, #, #, #, #, #)',
|
||||
|
@ -23,9 +22,6 @@ $if DART2JS
|
|||
} else {
|
||||
e._initCompositionEvent(type, canBubble, cancelable, view, data);
|
||||
}
|
||||
$else
|
||||
e._initCompositionEvent(type, canBubble, cancelable, view, data);
|
||||
$endif
|
||||
|
||||
return e;
|
||||
}
|
||||
|
|
|
@ -7,19 +7,7 @@ part of $LIBRARYNAME;
|
|||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
|
||||
TypedData getRandomValues(TypedData array) {
|
||||
$if DART2JS
|
||||
return _getRandomValues(array);
|
||||
$else
|
||||
var random = _getRandomValues(array);
|
||||
// The semantics of the operation are that it modifies the argument, but we
|
||||
// have no way of making a Dart typed data created initially in Dart reference
|
||||
// externalized storage. So we copy the values back from the returned copy.
|
||||
// TODO(alanknight): Make this less ridiculously slow.
|
||||
for (var i = 0; i < random.length; i++) {
|
||||
array[i] = random[i];
|
||||
}
|
||||
return array;
|
||||
$endif
|
||||
}
|
||||
|
||||
$!MEMBERS
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
part of $LIBRARYNAME;
|
||||
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$if DART2JS
|
||||
@Creates('Null') // Set from Dart code; does not instantiate a native type.
|
||||
$endif
|
||||
var _dartDetail;
|
||||
|
||||
factory $CLASSNAME(String type,
|
||||
|
|
|
@ -30,7 +30,6 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
// Is TypeError class derived from DomException but name is 'TypeError'
|
||||
static const String TYPE_ERROR = 'TypeError';
|
||||
|
||||
$if DART2JS
|
||||
String get name {
|
||||
var errorName = JS('String', '#.name', this);
|
||||
// Although Safari nightly has updated the name to SecurityError, Safari 5
|
||||
|
@ -41,49 +40,8 @@ $if DART2JS
|
|||
if (Device.isWebKit && errorName == 'SYNTAX_ERR') return 'SyntaxError';
|
||||
return errorName;
|
||||
}
|
||||
$endif
|
||||
$if JSINTEROP
|
||||
String _name;
|
||||
String _message;
|
||||
|
||||
// To suppress missing implicit constructor warnings.
|
||||
factory DomException._() { throw new UnsupportedError("Not supported"); }
|
||||
|
||||
@Deprecated("Internal Use Only")
|
||||
DomException.internal_() { }
|
||||
|
||||
@Deprecated("Internal Use Only")
|
||||
DomException.jsInterop(String m) {
|
||||
var name_index = m.indexOf(': ');
|
||||
if (name_index < 0) {
|
||||
_name = "";
|
||||
_message = m;
|
||||
} else {
|
||||
_name = m.substring(0, name_index);
|
||||
_message = m.substring(name_index + 1).trim();
|
||||
}
|
||||
}
|
||||
|
||||
@DomName('DOMException.message')
|
||||
@DocsEditable()
|
||||
String get message => _message ??
|
||||
(_message = _blink.BlinkDOMException.instance.message_Getter_(this));
|
||||
|
||||
@DomName('DOMException.name')
|
||||
@DocsEditable()
|
||||
String get name => _name ??
|
||||
(_name = _blink.BlinkDOMException.instance.name_Getter_(this));
|
||||
|
||||
@DomName('DOMException.toString')
|
||||
@DocsEditable()
|
||||
String toString() => "$name: $message";
|
||||
|
||||
$else
|
||||
$!MEMBERS
|
||||
$endif
|
||||
$if DART2JS
|
||||
@DomName('DOMException.toString')
|
||||
@DocsEditable()
|
||||
String toString() => JS('String', 'String(#)', this);
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -9,14 +9,7 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$MIXINS$IMP
|
|||
$!MEMBERS
|
||||
|
||||
DataTransferItem operator[] (int index) {
|
||||
$if DART2JS
|
||||
return JS('DataTransferItem', '#[#]', this, index);
|
||||
$else
|
||||
// TODO(alanknight): I think that all the __getter__ generators should just
|
||||
// do property access, but that's major surgery. This one is a problem, so
|
||||
// just hard-code it for now.
|
||||
return _blink.Blink_JsNative_DomException.getProperty(this, index.toString());
|
||||
$endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,11 +49,7 @@ $!MEMBERS
|
|||
|
||||
/// Checks if [registerElement] is supported on the current platform.
|
||||
bool get supportsRegisterElement {
|
||||
$if DART2JS
|
||||
return JS('bool', '("registerElement" in #)', this);
|
||||
$else
|
||||
return true;
|
||||
$endif
|
||||
}
|
||||
|
||||
/// *Deprecated*: use [supportsRegisterElement] instead.
|
||||
|
@ -62,18 +58,11 @@ $endif
|
|||
|
||||
@DomName('Document.createElement')
|
||||
Element createElement(String tagName, [String typeExtension]) {
|
||||
$if DART2JS
|
||||
return (typeExtension == null)
|
||||
? _createElement_2(tagName)
|
||||
: _createElement(tagName, typeExtension);
|
||||
$else
|
||||
return (typeExtension == null) ?
|
||||
_blink.BlinkDocument.instance.createElement_Callback_1_(this, tagName) :
|
||||
_blink.BlinkDocument.instance.createElement_Callback_2_(this, tagName, typeExtension);
|
||||
$endif
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
// The two-argument version of this is automatically generated, but we need to
|
||||
// omit the typeExtension if it's null on Firefox or we get an is="null" attribute.
|
||||
@DomName('Document.createElement')
|
||||
|
@ -86,22 +75,14 @@ $if DART2JS
|
|||
_createElementNS_2(String namespaceURI, String qualifiedName) =>
|
||||
JS('Element', '#.createElementNS(#, #)', this, namespaceURI, qualifiedName);
|
||||
|
||||
$endif
|
||||
@DomName('Document.createElementNS')
|
||||
@DocsEditable()
|
||||
Element createElementNS(String namespaceURI, String qualifiedName, [String typeExtension]) {
|
||||
$if DART2JS
|
||||
return (typeExtension == null)
|
||||
? _createElementNS_2(namespaceURI, qualifiedName)
|
||||
: _createElementNS(namespaceURI, qualifiedName, typeExtension);
|
||||
$else
|
||||
return (typeExtension == null) ?
|
||||
_blink.BlinkDocument.instance.createElementNS_Callback_2_(this, namespaceURI, qualifiedName) :
|
||||
_blink.BlinkDocument.instance.createElementNS_Callback_3_(this, namespaceURI, qualifiedName, typeExtension);
|
||||
$endif
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
@DomName('Document.createNodeIterator')
|
||||
NodeIterator _createNodeIterator(Node root,
|
||||
[int whatToShow, NodeFilter filter])
|
||||
|
@ -113,18 +94,13 @@ $if DART2JS
|
|||
[int whatToShow, NodeFilter filter])
|
||||
=> JS('TreeWalker', '#.createTreeWalker(#, #, #, false)',
|
||||
this, root, whatToShow, filter);
|
||||
$endif
|
||||
|
||||
@DomName('Document.visibilityState')
|
||||
@SupportedBrowser(SupportedBrowser.CHROME)
|
||||
@SupportedBrowser(SupportedBrowser.FIREFOX)
|
||||
@SupportedBrowser(SupportedBrowser.IE, '10')
|
||||
@Experimental()
|
||||
$if DART2JS
|
||||
String get visibilityState => JS('String',
|
||||
'(#.visibilityState || #.mozVisibilityState || #.msVisibilityState ||'
|
||||
'#.webkitVisibilityState)', this, this, this, this);
|
||||
$else
|
||||
String get visibilityState => _visibilityState;
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -24,11 +24,9 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
HtmlCollection get _children => throw new UnimplementedError(
|
||||
'Use _docChildren instead');
|
||||
|
||||
$if DART2JS
|
||||
// Native field is used only by Dart code so does not lead to instantiation
|
||||
// of native classes
|
||||
@Creates('Null')
|
||||
$endif
|
||||
List<Element> _docChildren;
|
||||
|
||||
List<Element> get children {
|
||||
|
|
|
@ -7,10 +7,5 @@ part of $LIBRARYNAME;
|
|||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DARTIUM
|
||||
// Override this methods for Dartium _DocumentType can't be abstract.
|
||||
Element get nextElementSibling => _blink.BlinkDocumentType.instance.nextElementSibling_Getter_(this);
|
||||
Element get previousElementSibling => _blink.BlinkDocumentType.instance.previousElementSibling_Getter_(this);
|
||||
$endif
|
||||
}
|
||||
|
||||
|
|
|
@ -101,12 +101,7 @@ class _ChildrenElementList extends ListBase<Element>
|
|||
bool remove(Object object) {
|
||||
if (object is Element) {
|
||||
Element element = object;
|
||||
$if JSINTEROP
|
||||
// We aren't preserving identity of nodes in JSINTEROP mode
|
||||
if (element.parentNode == _element) {
|
||||
$else
|
||||
if (identical(element.parentNode, _element)) {
|
||||
$endif
|
||||
_element._removeChild(element);
|
||||
return true;
|
||||
}
|
||||
|
@ -272,15 +267,7 @@ class _FrozenElementList<E extends Element> extends ListBase<E>
|
|||
implements ElementList<E>, NodeListWrapper {
|
||||
final List<Node> _nodeList;
|
||||
|
||||
$if JSINTEROP
|
||||
var dartClass_instance;
|
||||
|
||||
_FrozenElementList._wrap(this._nodeList) {
|
||||
this.dartClass_instance = this._nodeList;
|
||||
}
|
||||
$else
|
||||
_FrozenElementList._wrap(this._nodeList);
|
||||
$endif
|
||||
|
||||
int get length => _nodeList.length;
|
||||
|
||||
|
@ -384,15 +371,7 @@ $(ANNOTATIONS)$(NATIVESPEC)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
|||
* }
|
||||
* document.registerElement('x-custom', CustomElement);
|
||||
*/
|
||||
$if DART2JS
|
||||
Element.created() : super._created();
|
||||
$else
|
||||
Element.created() : super._created() {
|
||||
// Validate that this is a custom element & possibly perform additional
|
||||
// initialization.
|
||||
_blink.Blink_Utils.initializeCustomElement(this);
|
||||
}
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Creates the HTML element specified by the tag name.
|
||||
|
@ -839,12 +818,7 @@ $endif
|
|||
}
|
||||
var convertedFrames;
|
||||
if (frames is Iterable) {
|
||||
$if DART2JS
|
||||
convertedFrames = frames.map(convertDartToNative_Dictionary).toList();
|
||||
$else
|
||||
convertedFrames = convertDartToNative_List(
|
||||
frames.map(convertDartToNative_Dictionary).toList());
|
||||
$endif
|
||||
} else {
|
||||
convertedFrames = frames;
|
||||
}
|
||||
|
@ -854,12 +828,10 @@ $endif
|
|||
: _animate(convertedFrames, convertedTiming);
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
@DomName('Element.animate')
|
||||
@JSName('animate')
|
||||
@Experimental() // untriaged
|
||||
Animation _animate(Object effect, [timing]) native;
|
||||
$endif
|
||||
/**
|
||||
* Called by the DOM whenever an attribute on this has been changed.
|
||||
*/
|
||||
|
@ -867,9 +839,7 @@ $endif
|
|||
|
||||
// Hooks to support custom WebComponents.
|
||||
|
||||
$if DART2JS
|
||||
@Creates('Null') // Set from Dart code; does not instantiate a native type.
|
||||
$endif
|
||||
Element _xtag;
|
||||
|
||||
/**
|
||||
|
@ -894,13 +864,9 @@ $endif
|
|||
|
||||
@DomName('Element.localName')
|
||||
@DocsEditable()
|
||||
$if DART2JS
|
||||
@Returns('String')
|
||||
// Non-null for Elements.
|
||||
String get localName => JS('String', '#', _localName);
|
||||
$else
|
||||
String get localName => _localName;
|
||||
$endif
|
||||
|
||||
/**
|
||||
* A URI that identifies the XML namespace of this element.
|
||||
|
@ -941,10 +907,8 @@ $endif
|
|||
*/
|
||||
void scrollIntoView([ScrollAlignment alignment]) {
|
||||
var hasScrollIntoViewIfNeeded = true;
|
||||
$if DART2JS
|
||||
hasScrollIntoViewIfNeeded =
|
||||
JS('bool', '!!(#.scrollIntoViewIfNeeded)', this);
|
||||
$endif
|
||||
if (alignment == ScrollAlignment.TOP) {
|
||||
this._scrollIntoView(true);
|
||||
} else if (alignment == ScrollAlignment.BOTTOM) {
|
||||
|
@ -960,7 +924,6 @@ $endif
|
|||
}
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
/**
|
||||
* Static factory designed to expose `mousewheel` events to event
|
||||
* handlers that are not necessarily instances of [Element].
|
||||
|
@ -1015,8 +978,6 @@ $if DART2JS
|
|||
@JSName('insertAdjacentText')
|
||||
void _insertAdjacentText(String where, String text) native;
|
||||
|
||||
$else
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Parses text as an HTML fragment and inserts it into the DOM at the
|
||||
|
@ -1050,7 +1011,6 @@ $endif
|
|||
}
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
|
||||
@JSName('insertAdjacentHTML')
|
||||
void _insertAdjacentHtml(String where, String text) native;
|
||||
|
@ -1076,8 +1036,6 @@ $if DART2JS
|
|||
|
||||
@JSName('insertAdjacentElement')
|
||||
void _insertAdjacentElement(String where, Element element) native;
|
||||
$else
|
||||
$endif
|
||||
|
||||
void _insertAdjacentNode(String where, Node node) {
|
||||
switch (where.toLowerCase()) {
|
||||
|
@ -1099,7 +1057,6 @@ $endif
|
|||
}
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
/**
|
||||
* Checks if this element matches the CSS selectors.
|
||||
*/
|
||||
|
@ -1119,8 +1076,6 @@ $if DART2JS
|
|||
throw new UnsupportedError("Not supported on this platform");
|
||||
}
|
||||
}
|
||||
$else
|
||||
$endif
|
||||
|
||||
/** Checks if this element or any of its parents match the CSS selectors. */
|
||||
@Experimental()
|
||||
|
@ -1133,7 +1088,6 @@ $endif
|
|||
return false;
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
/**
|
||||
* Creates a new shadow root for this shadow host.
|
||||
*
|
||||
|
@ -1167,7 +1121,6 @@ $if DART2JS
|
|||
@Experimental()
|
||||
ShadowRoot get shadowRoot =>
|
||||
JS('ShadowRoot|Null', '#.shadowRoot || #.webkitShadowRoot', this, this);
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Access this element's content position.
|
||||
|
@ -1274,11 +1227,7 @@ $endif
|
|||
// offsetParent, "tops out" at BODY. But people could conceivably pass in
|
||||
// the document.documentElement and I want it to return an absolute offset,
|
||||
// so we have the special case checking for HTML.
|
||||
$if JSINTEROP
|
||||
bool sameAsParent = current == parent;
|
||||
$else
|
||||
bool sameAsParent = identical(current, parent);
|
||||
$endif
|
||||
bool foundAsParent = sameAsParent || parent.tagName == 'HTML';
|
||||
if (current == null || sameAsParent) {
|
||||
if (foundAsParent) return new Point/*<num>*/(0, 0);
|
||||
|
@ -1455,7 +1404,6 @@ $endif
|
|||
*
|
||||
* Those attributes are: attributes, lastChild, children, previousNode and tagName.
|
||||
*/
|
||||
$if DART2JS
|
||||
static bool _hasCorruptedAttributes(Element element) {
|
||||
return JS('bool', r'''
|
||||
(function(element) {
|
||||
|
@ -1499,35 +1447,7 @@ $if DART2JS
|
|||
static bool _hasCorruptedAttributesAdditionalCheck(Element element) {
|
||||
return JS('bool', r'!(#.attributes instanceof NamedNodeMap)', element);
|
||||
}
|
||||
$else
|
||||
|
||||
static var _namedNodeMap = js.context["NamedNodeMap"];
|
||||
static var _htmlCollection = js.context["HTMLCollection"];
|
||||
static var _nodeList = js.context["NodeList"];
|
||||
|
||||
static const _evilAttributeNames =
|
||||
const ['attributes', 'lastChild', 'children', 'childNodes'];
|
||||
|
||||
static bool _hasCorruptedAttributes(Element element) {
|
||||
// We have trusted access to children and to attributes of objects,
|
||||
// so we can inspect directly for attempts at DOM clobbering.
|
||||
var child = element.firstChild;
|
||||
while( child != null) {
|
||||
if (child is Element) {
|
||||
for (var attributeName in ["id", "name"]) {
|
||||
var childAttribute = child.getAttribute(attributeName);
|
||||
if (_evilAttributeNames.contains(childAttribute)) return true;
|
||||
}}
|
||||
child = child.nextNode;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// A secondary check for corruption, needed on IE
|
||||
static bool _hasCorruptedAttributesAdditionalCheck(Element element) => false;
|
||||
$endif
|
||||
|
||||
$if DART2JS
|
||||
static String _safeTagName(element) {
|
||||
String result = 'element tag unavailable';
|
||||
try {
|
||||
|
@ -1537,17 +1457,7 @@ $if DART2JS
|
|||
} catch (e) {}
|
||||
return result;
|
||||
}
|
||||
$else
|
||||
static String _safeTagName(element) {
|
||||
try {
|
||||
// Safe as we plumb directly to a C++ native method.
|
||||
return element.tagName;
|
||||
} catch (e) {}
|
||||
return 'element tag unavailable';
|
||||
}
|
||||
$endif
|
||||
|
||||
$if DART2JS
|
||||
@DomName('Element.offsetParent')
|
||||
@DocsEditable()
|
||||
final Element offsetParent;
|
||||
|
@ -1596,56 +1506,6 @@ $if DART2JS
|
|||
@DocsEditable()
|
||||
int get scrollWidth => JS('num', '#.scrollWidth', this).round();
|
||||
|
||||
$else
|
||||
// Need to explicitly delegate because Element is no longer abstract for Dartium.
|
||||
bool get isContentEditable => _blink.BlinkHTMLElement.instance.isContentEditable_Getter_(this);
|
||||
void click() => _blink.BlinkHTMLElement.instance.click_Callback_0_(this);
|
||||
|
||||
@DomName('Element.offsetParent')
|
||||
@DocsEditable()
|
||||
Element get offsetParent => _blink.BlinkHTMLElement.instance.offsetParent_Getter_(this);
|
||||
|
||||
@DomName('Element.offsetHeight')
|
||||
@DocsEditable()
|
||||
int get offsetHeight => _blink.BlinkHTMLElement.instance.offsetHeight_Getter_(this);
|
||||
|
||||
@DomName('Element.offsetLeft')
|
||||
@DocsEditable()
|
||||
int get offsetLeft => _blink.BlinkHTMLElement.instance.offsetLeft_Getter_(this);
|
||||
|
||||
@DomName('Element.offsetTop')
|
||||
@DocsEditable()
|
||||
int get offsetTop => _blink.BlinkHTMLElement.instance.offsetTop_Getter_(this);
|
||||
|
||||
@DomName('Element.offsetWidth')
|
||||
@DocsEditable()
|
||||
int get offsetWidth => _blink.BlinkHTMLElement.instance.offsetWidth_Getter_(this);
|
||||
|
||||
@DomName('Element.scrollHeight')
|
||||
@DocsEditable()
|
||||
int get scrollHeight => _blink.BlinkElement.instance.scrollHeight_Getter_(this).round();
|
||||
|
||||
@DomName('Element.scrollLeft')
|
||||
@DocsEditable()
|
||||
int get scrollLeft => _blink.BlinkElement.instance.scrollLeft_Getter_(this).round();
|
||||
|
||||
@DomName('Element.scrollLeft')
|
||||
@DocsEditable()
|
||||
set scrollLeft(int value) => _blink.BlinkElement.instance.scrollLeft_Setter_(this, value.round());
|
||||
|
||||
@DomName('Element.scrollTop')
|
||||
@DocsEditable()
|
||||
int get scrollTop => _blink.BlinkElement.instance.scrollTop_Getter_(this).round();
|
||||
|
||||
@DomName('Element.scrollTop')
|
||||
@DocsEditable()
|
||||
set scrollTop(int value) => _blink.BlinkElement.instance.scrollTop_Setter_(this, value.round());
|
||||
|
||||
@DomName('Element.scrollWidth')
|
||||
@DocsEditable()
|
||||
int get scrollWidth => _blink.BlinkElement.instance.scrollWidth_Getter_(this).round();
|
||||
$endif
|
||||
|
||||
$!MEMBERS
|
||||
}
|
||||
|
||||
|
@ -1653,7 +1513,6 @@ $!MEMBERS
|
|||
class _ElementFactoryProvider {
|
||||
|
||||
@DomName('Document.createElement')
|
||||
$if DART2JS
|
||||
// Optimization to improve performance until the dart2js compiler inlines this
|
||||
// method.
|
||||
static dynamic createElement_tag(String tag, String typeExtension) {
|
||||
|
@ -1669,10 +1528,6 @@ $if DART2JS
|
|||
return JS('Element|=Object', 'document.createElement(#)', tag);
|
||||
}
|
||||
|
||||
$else
|
||||
static Element createElement_tag(String tag, String typeExtension) =>
|
||||
document.createElement(tag, typeExtension);
|
||||
$endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -90,12 +90,6 @@ class ElementEvents extends Events {
|
|||
*/
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
|
||||
$if DARTIUM
|
||||
// Default constructor to allow other classes e.g. GlobalEventHandlers to be
|
||||
// constructed using _internalWrap when mapping Blink object to Dart class.
|
||||
EventTarget();
|
||||
|
||||
$endif
|
||||
// Custom element created callback.
|
||||
EventTarget._created();
|
||||
|
||||
|
|
|
@ -10,11 +10,7 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
@DomName('FileReader.result')
|
||||
@DocsEditable()
|
||||
Object get result {
|
||||
$if DART2JS
|
||||
var res = JS('Null|String|NativeByteBuffer', '#.result', this);
|
||||
$else
|
||||
var res = _blink.BlinkFileReader.instance.result_Getter_(this);
|
||||
$endif
|
||||
if (res is ByteBuffer) {
|
||||
return new Uint8List.view(res);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,6 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
}
|
||||
|
||||
Geoposition _ensurePosition(domPosition) {
|
||||
$if DART2JS
|
||||
try {
|
||||
// Firefox may throw on this.
|
||||
if (domPosition is Geoposition) {
|
||||
|
@ -85,14 +84,10 @@ $if DART2JS
|
|||
}
|
||||
} catch(e) {}
|
||||
return new _GeopositionWrapper(domPosition);
|
||||
$else
|
||||
return domPosition;
|
||||
$endif
|
||||
}
|
||||
|
||||
$!MEMBERS}
|
||||
|
||||
$if DART2JS
|
||||
/**
|
||||
* Wrapper for Firefox- it returns an object which we cannot map correctly.
|
||||
* Basically Firefox was returning a [xpconnect wrapped nsIDOMGeoPosition] but
|
||||
|
@ -105,4 +100,3 @@ class _GeopositionWrapper implements Geoposition {
|
|||
Coordinates get coords => JS('Coordinates', '#.coords', _ptr);
|
||||
int get timestamp => JS('int', '#.timestamp', _ptr);
|
||||
}
|
||||
$endif
|
||||
|
|
|
@ -7,14 +7,5 @@ part of $LIBRARYNAME;
|
|||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if JSINTEROP
|
||||
factory AudioElement([String src]) {
|
||||
if (src == null)
|
||||
return _blink.BlinkHTMLAudioElement.instance.constructorCallback_0_();
|
||||
else
|
||||
return _blink.BlinkHTMLAudioElement.instance.constructorCallback_1_(src);
|
||||
}
|
||||
$else
|
||||
factory AudioElement([String src]) => new AudioElement._(src);
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -7,12 +7,8 @@ part of $LIBRARYNAME;
|
|||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS implements CanvasImageSource$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
/** An API for drawing on this canvas. */
|
||||
$if DART2JS
|
||||
CanvasRenderingContext2D get context2D =>
|
||||
JS('Null|CanvasRenderingContext2D', '#.getContext(#)', this, '2d');
|
||||
$else
|
||||
CanvasRenderingContext2D get context2D => getContext('2d');
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Returns a new Web GL context for this canvas.
|
||||
|
|
|
@ -9,18 +9,8 @@ part of $LIBRARYNAME;
|
|||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
|
||||
$if DART2JS
|
||||
@DomName('Document.body')
|
||||
BodyElement body;
|
||||
$else
|
||||
@DomName('Document.body')
|
||||
BodyElement get body => _body;
|
||||
|
||||
@DomName('Document.body')
|
||||
set body(BodyElement value) {
|
||||
_body = value;
|
||||
}
|
||||
$endif
|
||||
|
||||
/// UNSTABLE: Chrome-only - create a Range from the given point.
|
||||
@DomName('Document.caretRangeFromPoint')
|
||||
|
@ -41,12 +31,8 @@ $endif
|
|||
*
|
||||
* * [getCssCanvasContext]
|
||||
*/
|
||||
$if DART2JS
|
||||
static bool get supportsCssCanvasContext =>
|
||||
JS('bool', '!!(document.getCSSCanvasContext)');
|
||||
$else
|
||||
static bool get supportsCssCanvasContext => false;
|
||||
$endif
|
||||
|
||||
|
||||
/**
|
||||
|
@ -75,10 +61,8 @@ $endif
|
|||
@DomName('Document.getCSSCanvasContext')
|
||||
CanvasRenderingContext getCssCanvasContext(String contextId, String name,
|
||||
int width, int height) {
|
||||
$if DART2JS
|
||||
if (HtmlDocument.supportsCssCanvasContext)
|
||||
return JS('CanvasRenderingContext', '#.getCSSCanvasContext(#, #, #, #)', this, contextId, name, width, height);
|
||||
$endif
|
||||
throw new UnsupportedError("Not supported");
|
||||
}
|
||||
|
||||
|
@ -131,133 +115,6 @@ $endif
|
|||
_webkitExitFullscreen();
|
||||
}
|
||||
|
||||
$if DARTIUM
|
||||
|
||||
/**
|
||||
* Internal routine to find the DOM JS class name being extended for custom
|
||||
* elements.
|
||||
*/
|
||||
String _getJSClassName(ClassMirror classMirror) {
|
||||
var jsClassName = null;
|
||||
var isElement = false;
|
||||
|
||||
while (classMirror.superclass != null) {
|
||||
var fullName = classMirror.superclass.qualifiedName;
|
||||
isElement = isElement ||
|
||||
(fullName == #dart.dom.html.Element || fullName == #dart.dom.svg.Element);
|
||||
|
||||
var domLibrary = MirrorSystem.getName(fullName).startsWith('dart.dom.');
|
||||
if (jsClassName == null && domLibrary) {
|
||||
// Lookup JS class name (if not found).
|
||||
var metadatas = classMirror.metadata;
|
||||
for (var metadata in metadatas) {
|
||||
var metaDataMirror = metadata.reflectee;
|
||||
var metaType = reflectClass(metaDataMirror.runtimeType);
|
||||
if (MirrorSystem.getName(metaType.simpleName) == 'DomName' &&
|
||||
(metaDataMirror.name.startsWith('HTML') || metaDataMirror.name.startsWith('SVG'))) {
|
||||
jsClassName = metadata.reflectee.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
classMirror = classMirror.superclass;
|
||||
}
|
||||
|
||||
// If we're an element then everything is okay.
|
||||
return isElement ? jsClassName : null;
|
||||
}
|
||||
|
||||
// Get the first class that's a super of a dart.dom library.
|
||||
ClassMirror _getDartHtmlClassName(ClassMirror classMirror) {
|
||||
while (classMirror.superclass != null) {
|
||||
var fullName = classMirror.superclass.qualifiedName;
|
||||
var domLibrary = MirrorSystem.getName(fullName).startsWith('dart.dom.');
|
||||
if (domLibrary) {
|
||||
return classMirror.superclass;
|
||||
}
|
||||
|
||||
classMirror = classMirror.superclass;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class that immediately derived from a class in dart:html or
|
||||
* dart:svg (has an attribute DomName of either HTML* or SVG*).
|
||||
*/
|
||||
ClassMirror _getDomSuperClass(ClassMirror classMirror) {
|
||||
var isElement = false;
|
||||
var foundSuperElement = null;
|
||||
|
||||
while (classMirror.superclass != null) {
|
||||
var fullName = classMirror.superclass.qualifiedName;
|
||||
isElement = isElement || (fullName == #dart.dom.html.Element || fullName == #dart.dom.svg.Element);
|
||||
|
||||
var domLibrary = MirrorSystem.getName(fullName).startsWith('dart.dom.');
|
||||
if (domLibrary) {
|
||||
if (foundSuperElement == null) {
|
||||
foundSuperElement = classMirror.superclass;
|
||||
}
|
||||
// Lookup JS class (if not found).
|
||||
var metadatas = classMirror.metadata;
|
||||
for (var metadata in metadatas) {
|
||||
var metaDataMirror = metadata.reflectee;
|
||||
var metaType = reflectClass(metaDataMirror.runtimeType);
|
||||
if (MirrorSystem.getName(metaType.simpleName) == 'DomName' &&
|
||||
(metaDataMirror.name.startsWith('HTML') || metaDataMirror.name.startsWith('SVG'))) {
|
||||
if (isElement) return foundSuperElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
classMirror = classMirror.superclass;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this CustomElement class have:
|
||||
*
|
||||
* - a created constructor with no arguments?
|
||||
* - a created constructor with a super.created() initializer?
|
||||
*
|
||||
* e.g., MyCustomClass.created() : super.created();
|
||||
*/
|
||||
bool _hasCreatedConstructor(ClassMirror classToRegister) {
|
||||
var htmlClassMirror = _getDomSuperClass(classToRegister);
|
||||
|
||||
var classMirror = classToRegister;
|
||||
while (classMirror != null && classMirror != htmlClassMirror) {
|
||||
var createdParametersValid = false;
|
||||
var superCreatedCalled = false;
|
||||
var className = MirrorSystem.getName(classMirror.simpleName);
|
||||
var methodMirror = classMirror.declarations[new Symbol("$className.created")];
|
||||
if (methodMirror != null && methodMirror.isConstructor) {
|
||||
createdParametersValid = true; // Assume no parameters.
|
||||
if (methodMirror.parameters.length != 0) {
|
||||
// If any parameters each one must be optional.
|
||||
methodMirror.parameters.forEach((parameter) {
|
||||
createdParametersValid = createdParametersValid && parameter.isOptional;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!createdParametersValid) {
|
||||
throw new DomException.jsInterop('created constructor must have no parameters');
|
||||
}
|
||||
|
||||
classMirror = classMirror.superclass;
|
||||
while (classMirror != classMirror.mixin) {
|
||||
// Skip the mixins.
|
||||
classMirror = classMirror.superclass;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
$endif
|
||||
|
||||
@Experimental()
|
||||
/**
|
||||
|
@ -303,118 +160,8 @@ $endif
|
|||
*/
|
||||
void registerElement(String tag, Type customElementClass,
|
||||
{String extendsTag}) {
|
||||
$if DART2JS
|
||||
_registerCustomElement(JS('', 'window'), this, tag, customElementClass,
|
||||
extendsTag);
|
||||
$else
|
||||
// Hack to setup an interceptor for HTMLElement so it isn't changed when a custom element is created.
|
||||
var jsHTMLElementPrototype = js.JsNative.getProperty(js.JsNative.getProperty(js.context, 'HTMLElement'),'prototype');
|
||||
_blink.Blink_Utils.defineInterceptor(jsHTMLElementPrototype, HtmlElement.instanceRuntimeType);
|
||||
|
||||
// Figure out which DOM class is being extended from the user's Dart class.
|
||||
var classMirror = reflectClass(customElementClass);
|
||||
|
||||
var locationUri = classMirror.location.sourceUri.toString();
|
||||
if (locationUri == 'dart:html' || locationUri == 'dart:svg') {
|
||||
throw new DomException.jsInterop("HierarchyRequestError: Cannot register an existing dart:html or dart:svg type.");
|
||||
}
|
||||
|
||||
if (classMirror.isAbstract) {
|
||||
throw new DomException.jsInterop("HierarchyRequestError: Cannot register an abstract class.");
|
||||
}
|
||||
|
||||
var jsClassName = _getJSClassName(classMirror);
|
||||
if (jsClassName == null) {
|
||||
// Only components derived from HTML* can be extended.
|
||||
throw new DomException.jsInterop("HierarchyRequestError: Only HTML elements can be customized.");
|
||||
}
|
||||
|
||||
var customClassType = _getDartHtmlClassName(classMirror);
|
||||
|
||||
if (extendsTag != null) {
|
||||
var nativeElement = document.createElement(extendsTag);
|
||||
|
||||
// Trying to extend a native element is it the Dart class consistent with the
|
||||
// extendsTag?
|
||||
if (nativeElement.runtimeType != customClassType.reflectedType) {
|
||||
var nativeElementClassMirror = reflectClass(nativeElement.runtimeType);
|
||||
var customClassNativeElement = MirrorSystem.getName(customClassType.simpleName);
|
||||
var extendsNativeElement = MirrorSystem.getName(nativeElementClassMirror.simpleName);
|
||||
throw new DomException.jsInterop("HierarchyRequestError: Custom class type ($customClassNativeElement) and extendsTag class ($extendsNativeElement) don't match .");
|
||||
}
|
||||
} else if (customClassType.reflectedType != HtmlElement && customClassType.reflectedType != svg.SvgElement) {
|
||||
var customClassName = MirrorSystem.getName(classMirror.simpleName);
|
||||
var customClassElement = MirrorSystem.getName(customClassType.simpleName);
|
||||
throw new DomException.jsInterop("HierarchyRequestError: Custom element $customClassName is a native $customClassElement should be derived from HtmlElement or SvgElement.");
|
||||
}
|
||||
|
||||
if (_hasCreatedConstructor(classMirror)) {
|
||||
// Start the hookup the JS way create an <x-foo> element that extends the
|
||||
// <x-base> custom element. Inherit its prototype and signal what tag is
|
||||
// inherited:
|
||||
//
|
||||
// var myProto = Object.create(HTMLElement.prototype);
|
||||
// var myElement = document.registerElement('x-foo', {prototype: myProto});
|
||||
var baseElement = js.JsNative.getProperty(js.context, jsClassName);
|
||||
if (baseElement == null) {
|
||||
// Couldn't find the HTML element so use a generic one.
|
||||
baseElement = js.JsNative.getProperty(js.context, 'HTMLElement');
|
||||
}
|
||||
var elemProto = js.JsNative.callMethod(js.JsNative.getProperty(js.context, 'Object'), "create", [js.JsNative.getProperty(baseElement, 'prototype')]);
|
||||
|
||||
// TODO(terry): Hack to stop recursion re-creating custom element when the
|
||||
// created() constructor of the custom element does e.g.,
|
||||
//
|
||||
// MyElement.created() : super.created() {
|
||||
// this.innerHtml = "<b>I'm an x-foo-with-markup!</b>";
|
||||
// }
|
||||
//
|
||||
// sanitizing causes custom element to created recursively
|
||||
// until stack overflow.
|
||||
//
|
||||
// See https://github.com/dart-lang/sdk/issues/23666
|
||||
int creating = 0; // TODO(jacobr): I think I broke thise case. Will fix monday.
|
||||
|
||||
// If any JS code is hooked we want to call it too.
|
||||
var oldCreatedCallback = js.JsNative.getProperty(elemProto, 'createdCallback');
|
||||
var oldAttributeChangedCallback = js.JsNative.getProperty(elemProto, 'attributeChangedCallback');
|
||||
var oldAttachedCallback = js.JsNative.getProperty(elemProto, 'attachedCallback');
|
||||
var oldDetachedCallback = js.JsNative.getProperty(elemProto, 'detachedCallback');
|
||||
|
||||
js.JsNative.setProperty(elemProto, 'createdCallback', js.allowInteropCaptureThis(($this) {
|
||||
// The created callback has already been called by the very act of passing a JS
|
||||
// custom element from JS to Dart.
|
||||
|
||||
// Make element's interceptor a CustomElementClass.
|
||||
_blink.Blink_Utils.setInstanceInterceptorCustomUpgrade($this);
|
||||
|
||||
if (oldCreatedCallback != null)
|
||||
oldCreatedCallback.apply([], thisArg: $this);
|
||||
}));
|
||||
js.JsNative.setProperty(elemProto, 'attributeChangedCallback', js.allowInteropCaptureThis(($this, attrName, oldVal, newVal) {
|
||||
$this.attributeChanged(attrName, oldVal, newVal);
|
||||
|
||||
if (oldAttributeChangedCallback != null)
|
||||
oldAttributeChangedCallback.apply([], thisArg: $this);
|
||||
}));
|
||||
js.JsNative.setProperty(elemProto, 'attachedCallback', js.allowInteropCaptureThis(($this) {
|
||||
$this.attached();
|
||||
|
||||
if (oldAttachedCallback != null)
|
||||
oldAttachedCallback.apply([], thisArg: $this);
|
||||
}));
|
||||
js.JsNative.setProperty(elemProto, 'detachedCallback', js.allowInteropCaptureThis(($this) {
|
||||
$this.detached();
|
||||
|
||||
if (oldDetachedCallback != null)
|
||||
oldDetachedCallback.apply([], thisArg: $this);
|
||||
}));
|
||||
// document.registerElement('x-foo', {prototype: elemProto, extends: extendsTag});
|
||||
var jsMap = new js.JsObject.jsify({'prototype': elemProto, 'extends': extendsTag});
|
||||
_blink.Blink_Utils.defineInterceptorCustomElement(elemProto, customElementClass);
|
||||
js.JsNative.callMethod(document, 'registerElement', [tag, jsMap]);
|
||||
}
|
||||
$endif
|
||||
}
|
||||
|
||||
/** *Deprecated*: use [registerElement] instead. */
|
||||
|
@ -440,7 +187,6 @@ $endif
|
|||
_determineVisibilityChangeEventType);
|
||||
|
||||
static String _determineVisibilityChangeEventType(EventTarget e) {
|
||||
$if DART2JS
|
||||
if (JS('bool', '(typeof #.hidden !== "undefined")', e)) {
|
||||
// Opera 12.10 and Firefox 18 and later support
|
||||
return 'visibilitychange';
|
||||
|
@ -452,9 +198,6 @@ $if DART2JS
|
|||
return 'webkitvisibilitychange';
|
||||
}
|
||||
return 'visibilitychange';
|
||||
$else
|
||||
return 'webkitvisibilitychange';
|
||||
$endif
|
||||
}
|
||||
|
||||
@SupportedBrowser(SupportedBrowser.CHROME)
|
||||
|
@ -474,10 +217,6 @@ $endif
|
|||
/// parameter must be provided.
|
||||
@Experimental()
|
||||
ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) {
|
||||
$if DART2JS
|
||||
return new _JSElementUpgrader(this, type, extendsTag);
|
||||
$else
|
||||
return new _VMElementUpgrader(this, type, extendsTag);
|
||||
$endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,15 +7,5 @@ part of $LIBRARYNAME;
|
|||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DARTIUM
|
||||
// Override these methods for Dartium _HTMLFrameSetElement can't be abstract.
|
||||
Stream<Event> get onHashChange => hashChangeEvent.forTarget(this);
|
||||
Stream<MessageEvent> get onMessage => messageEvent.forTarget(this);
|
||||
Stream<Event> get onOffline => offlineEvent.forTarget(this);
|
||||
Stream<Event> get onOnline => onlineEvent.forTarget(this);
|
||||
Stream<PopStateEvent> get onPopState => popStateEvent.forTarget(this);
|
||||
Stream<StorageEvent> get onStorage => storageEvent.forTarget(this);
|
||||
Stream<Event> get onUnload => unloadEvent.forTarget(this);
|
||||
$endif
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,6 @@ $!MEMBERS
|
|||
|
||||
/// Checks if HTML imports are supported on the current platform.
|
||||
bool get supportsImport {
|
||||
$if DART2JS
|
||||
return JS('bool', '("import" in #)', this);
|
||||
$else
|
||||
return true;
|
||||
$endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
TableSectionElement createTHead() => _createTHead();
|
||||
TableRowElement insertRow(int index) => _insertRow(index);
|
||||
|
||||
$if DART2JS
|
||||
TableSectionElement _createTBody() {
|
||||
if (JS('bool', '!!#.createTBody', this)) {
|
||||
return this._nativeCreateTBody();
|
||||
|
@ -53,6 +52,5 @@ $if DART2JS
|
|||
|
||||
return fragment;
|
||||
}
|
||||
$endif
|
||||
|
||||
$!MEMBERS}
|
||||
|
|
|
@ -17,7 +17,6 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
|
||||
TableCellElement insertCell(int index) => _insertCell(index);
|
||||
|
||||
$if DART2JS
|
||||
DocumentFragment createFragment(String html,
|
||||
{NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
|
||||
if (Range.supportsCreateContextualFragment) {
|
||||
|
@ -32,6 +31,5 @@ $if DART2JS
|
|||
fragment.nodes.addAll(row.nodes);
|
||||
return fragment;
|
||||
}
|
||||
$endif
|
||||
|
||||
$!MEMBERS}
|
||||
|
|
|
@ -17,7 +17,6 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
|
||||
TableRowElement insertRow(int index) => _insertRow(index);
|
||||
|
||||
$if DART2JS
|
||||
DocumentFragment createFragment(String html,
|
||||
{NodeValidator validator, NodeTreeSanitizer treeSanitizer}) {
|
||||
if (Range.supportsCreateContextualFragment) {
|
||||
|
@ -31,6 +30,5 @@ $if DART2JS
|
|||
fragment.nodes.addAll(section.nodes);
|
||||
return fragment;
|
||||
}
|
||||
$endif
|
||||
|
||||
$!MEMBERS}
|
||||
|
|
|
@ -15,13 +15,8 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
'oldURL': oldUrl,
|
||||
'newURL': newUrl,
|
||||
};
|
||||
$if DART2JS
|
||||
return JS('HashChangeEvent', 'new HashChangeEvent(#, #)',
|
||||
type, convertDartToNative_Dictionary(options));
|
||||
$else
|
||||
return _blink.BlinkHashChangeEvent.instance
|
||||
.constructorCallback_2_(type, convertDartToNative_Dictionary(options));
|
||||
$endif
|
||||
}
|
||||
|
||||
$!MEMBERS
|
||||
|
|
|
@ -15,9 +15,5 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
* * [replaceState]
|
||||
* * [state]
|
||||
*/
|
||||
$if DART2JS
|
||||
static bool get supportsState => JS('bool', '!!window.history.pushState');
|
||||
$else
|
||||
static bool get supportsState => true;
|
||||
$endif
|
||||
$!MEMBERS}
|
||||
|
|
|
@ -23,7 +23,6 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
}
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
@JSName('continue')
|
||||
@DomName('IDBCursor.continue')
|
||||
void next([Object key]) {
|
||||
|
@ -33,6 +32,5 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
JS('void', '#.continue(#)', this, key);
|
||||
}
|
||||
}
|
||||
$endif
|
||||
$!MEMBERS
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
return _createObjectStore(name, options);
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
Transaction transaction(storeName_OR_storeNames, String mode) {
|
||||
if (mode != 'readonly' && mode != 'readwrite') {
|
||||
throw new ArgumentError(mode);
|
||||
|
@ -63,28 +62,5 @@ $if DART2JS
|
|||
|
||||
@JSName('transaction')
|
||||
Transaction _transaction(stores, mode) native;
|
||||
$else
|
||||
Transaction transaction(storeName_OR_storeNames, String mode) {
|
||||
if (mode != 'readonly' && mode != 'readwrite') {
|
||||
throw new ArgumentError("Invalid transaction mode $mode");
|
||||
}
|
||||
var names;
|
||||
if (storeName_OR_storeNames == null) {
|
||||
throw new ArgumentError("stores may not be null in transaction");
|
||||
} else if (storeName_OR_storeNames is String || storeName_OR_storeNames is DomStringList) {
|
||||
names = storeName_OR_storeNames;
|
||||
} else if (storeName_OR_storeNames is List<String>) {
|
||||
names = convertDartToNative_List(storeName_OR_storeNames);
|
||||
} else {
|
||||
throw new ArgumentError("Invalid store(s) $store_Name_OR_storeNames");
|
||||
}
|
||||
|
||||
return _blink.BlinkIDBDatabase.instance.transaction_Callback_2_(this, names, mode);
|
||||
}
|
||||
|
||||
Transaction transactionList(List<String> storeNames, String mode) => transaction(storeNames, mode);
|
||||
Transaction transactionStores(List<String> storeNames, String mode) => transaction(storeNames, mode);
|
||||
Transaction transactionStore(String storeName, String mode) => transaction(storeName, mode);
|
||||
$endif
|
||||
|
||||
$!MEMBERS}
|
||||
|
|
|
@ -9,14 +9,10 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
* Checks to see if Indexed DB is supported on the current platform.
|
||||
*/
|
||||
static bool get supported {
|
||||
$if DARTIUM
|
||||
return true;
|
||||
$else
|
||||
return JS('bool',
|
||||
'!!(window.indexedDB || '
|
||||
'window.webkitIndexedDB || '
|
||||
'window.mozIndexedDB)');
|
||||
$endif
|
||||
}
|
||||
|
||||
@DomName('IDBFactory.open')
|
||||
|
@ -84,12 +80,8 @@ $endif
|
|||
* Checks to see if getDatabaseNames is supported by the current platform.
|
||||
*/
|
||||
bool get supportsDatabaseNames {
|
||||
$if DART2JS
|
||||
return supported && JS('bool',
|
||||
'!!(#.getDatabaseNames || #.webkitGetDatabaseNames)', this, this);
|
||||
$else
|
||||
return true;
|
||||
$endif
|
||||
}
|
||||
|
||||
$!MEMBERS
|
||||
|
|
|
@ -4,16 +4,6 @@
|
|||
|
||||
part of $LIBRARYNAME;
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$if DARTIUM
|
||||
List<int> __data;
|
||||
|
||||
List<int> get data {
|
||||
if (__data == null) {
|
||||
__data = _data;
|
||||
}
|
||||
return __data;
|
||||
}
|
||||
$endif
|
||||
|
||||
$!MEMBERS
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ part of $LIBRARYNAME;
|
|||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
|
||||
$if DART2JS
|
||||
@DomName('Location.origin')
|
||||
String get origin {
|
||||
if (JS('bool', '("origin" in #)', this)) {
|
||||
|
@ -16,11 +15,8 @@ $if DART2JS
|
|||
}
|
||||
return '${this.protocol}//${this.host}';
|
||||
}
|
||||
$endif
|
||||
|
||||
$if DART2JS
|
||||
@DomName('Location.toString')
|
||||
@DocsEditable()
|
||||
String toString() => JS('String', 'String(#)', this);
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ $!MEMBERS
|
|||
*
|
||||
* * [Navigator.getUserMedia]
|
||||
*/
|
||||
$if DART2JS
|
||||
static bool get supported =>
|
||||
JS('bool', '''!!(#.getUserMedia || #.webkitGetUserMedia ||
|
||||
#.mozGetUserMedia || #.msGetUserMedia)''',
|
||||
|
@ -22,7 +21,4 @@ $if DART2JS
|
|||
window.navigator,
|
||||
window.navigator,
|
||||
window.navigator);
|
||||
$else
|
||||
static bool get supported => true;
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -14,30 +14,18 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
if (source == null) {
|
||||
source = window;
|
||||
}
|
||||
$if DART2JS
|
||||
if (!Device.isIE) { // TODO: This if check should be removed once IE
|
||||
// implements the constructor.
|
||||
return JS('MessageEvent', 'new MessageEvent(#, {bubbles: #, cancelable: #, data: #, origin: #, lastEventId: #, source: #, ports: #})',
|
||||
type, canBubble, cancelable, data, origin, lastEventId, source,
|
||||
messagePorts);
|
||||
}
|
||||
$endif
|
||||
MessageEvent event = document._createEvent("MessageEvent");
|
||||
event._initMessageEvent(type, canBubble, cancelable, data, origin,
|
||||
lastEventId, source, messagePorts);
|
||||
return event;
|
||||
}
|
||||
|
||||
$if DARTIUM
|
||||
// TODO(alanknight): This really should be generated by the
|
||||
// _OutputConversion in the systemnative.py script, but that doesn't
|
||||
// use those conversions right now, so do this as a one-off.
|
||||
@DomName('MessageEvent.data')
|
||||
@DocsEditable()
|
||||
dynamic get data => convertNativeToDart_SerializedScriptValue(
|
||||
_blink.BlinkMessageEvent.instance.data_Getter_(this));
|
||||
|
||||
$else
|
||||
// TODO(alanknight): This really should be generated by the
|
||||
// _OutputConversion in the systemnative.py script, but that doesn't
|
||||
// use those conversions right now, so do this as a one-off.
|
||||
|
@ -52,7 +40,5 @@ $else
|
|||
@annotation_Returns_SerializedScriptValue
|
||||
final dynamic _get_data;
|
||||
|
||||
$endif
|
||||
|
||||
$!MEMBERS
|
||||
}
|
||||
|
|
|
@ -11,17 +11,9 @@ $!MEMBERS
|
|||
* platform.
|
||||
*/
|
||||
static bool get supported {
|
||||
$if DARTIUM
|
||||
return true;
|
||||
$else
|
||||
return JS('bool',
|
||||
'!!(window.MutationObserver || window.WebKitMutationObserver)');
|
||||
$endif
|
||||
}
|
||||
$if DARTIUM
|
||||
@DocsEditable()
|
||||
static MutationObserver _create(callback) => _blink.BlinkMutationObserver.instance.constructorCallback_1_(callback);
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Observes the target for the specified changes.
|
||||
|
@ -72,17 +64,7 @@ $endif
|
|||
'attributeOldValue': true,
|
||||
'characterDataOldValue': true };
|
||||
|
||||
$if DARTIUM
|
||||
static _createDict() => {};
|
||||
static _add(m, String key, value) { m[key] = value; }
|
||||
static _fixupList(list) => list;
|
||||
|
||||
void _call(Node target, options) {
|
||||
_observe(target, options);
|
||||
}
|
||||
$endif
|
||||
|
||||
$if DART2JS
|
||||
static _createDict() => JS('var', '{}');
|
||||
static _add(m, String key, value) { JS('void', '#[#] = #', m, key, value); }
|
||||
static _fixupList(list) => list; // TODO: Ensure is a JavaScript Array.
|
||||
|
@ -100,8 +82,4 @@ $if DART2JS
|
|||
'window.MozMutationObserver)(#)',
|
||||
convertDartClosureToJS(_wrapBinaryZone(callback), 2));
|
||||
}
|
||||
$else
|
||||
factory MutationObserver(MutationCallback callback) =>
|
||||
new MutationObserver._(_wrapBinaryZone(callback));
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -6,11 +6,9 @@ part of $LIBRARYNAME;
|
|||
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
|
||||
$if DART2JS
|
||||
@DomName('Navigator.language')
|
||||
String get language => JS('String', '#.language || #.userLanguage', this,
|
||||
this);
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Gets a stream (video and or audio) from the local computer.
|
||||
|
@ -56,7 +54,6 @@ $endif
|
|||
'audio': audio,
|
||||
'video': video
|
||||
};
|
||||
$if DART2JS
|
||||
_ensureGetUserMedia();
|
||||
this._getUserMedia(convertDartToNative_SerializedScriptValue(options),
|
||||
(stream) {
|
||||
|
@ -65,19 +62,9 @@ $if DART2JS
|
|||
(error) {
|
||||
completer.completeError(error);
|
||||
});
|
||||
$else
|
||||
this._getUserMedia(options,
|
||||
(stream) {
|
||||
completer.complete(stream);
|
||||
},
|
||||
(error) {
|
||||
completer.completeError(error);
|
||||
});
|
||||
$endif
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
_ensureGetUserMedia() {
|
||||
if (JS('bool', '!(#.getUserMedia)', this)) {
|
||||
JS('void', '#.getUserMedia = '
|
||||
|
@ -89,7 +76,6 @@ $if DART2JS
|
|||
@JSName('getUserMedia')
|
||||
void _getUserMedia(options, _NavigatorUserMediaSuccessCallback success,
|
||||
_NavigatorUserMediaErrorCallback error) native;
|
||||
$endif
|
||||
|
||||
$!MEMBERS
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ class _ChildNodeListLazy extends ListBase<Node> implements NodeListWrapper {
|
|||
_ChildNodeListLazy(this._this);
|
||||
|
||||
|
||||
$if DART2JS
|
||||
Node get first {
|
||||
Node result = JS('Node|Null', '#.firstChild', _this);
|
||||
if (result == null) throw new StateError("No elements");
|
||||
|
@ -32,24 +31,6 @@ $if DART2JS
|
|||
if (l > 1) throw new StateError("More than one element");
|
||||
return JS('Node|Null', '#.firstChild', _this);
|
||||
}
|
||||
$else
|
||||
Node get first {
|
||||
Node result = _this.firstChild;
|
||||
if (result == null) throw new StateError("No elements");
|
||||
return result;
|
||||
}
|
||||
Node get last {
|
||||
Node result = _this.lastChild;
|
||||
if (result == null) throw new StateError("No elements");
|
||||
return result;
|
||||
}
|
||||
Node get single {
|
||||
int l = this.length;
|
||||
if (l == 0) throw new StateError("No elements");
|
||||
if (l > 1) throw new StateError("More than one element");
|
||||
return _this.firstChild;
|
||||
}
|
||||
$endif
|
||||
|
||||
void add(Node value) {
|
||||
_this.append(value);
|
||||
|
@ -114,12 +95,7 @@ $endif
|
|||
bool remove(Object object) {
|
||||
if (object is! Node) return false;
|
||||
Node node = object;
|
||||
$if JSINTEROP
|
||||
// We aren't preserving identity of nodes in JSINTEROP mode
|
||||
if (_this != node.parentNode) return false;
|
||||
$else
|
||||
if (!identical(_this, node.parentNode)) return false;
|
||||
$endif
|
||||
_this._removeChild(node);
|
||||
return true;
|
||||
}
|
||||
|
@ -201,11 +177,7 @@ $endif
|
|||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
|
||||
// Custom element created callback.
|
||||
$if DART2JS
|
||||
Node._created() : super._created();
|
||||
$else
|
||||
Node._created() : super._created();
|
||||
$endif
|
||||
|
||||
/**
|
||||
* A modifiable list of this node's children.
|
||||
|
@ -290,19 +262,6 @@ $endif
|
|||
return value == null ? super.toString() : value;
|
||||
}
|
||||
|
||||
$if DARTIUM
|
||||
/**
|
||||
* A list of this node's children.
|
||||
*
|
||||
* ## Other resources
|
||||
*
|
||||
* * [Node.childNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node.childNodes)
|
||||
* from MDN.
|
||||
*/
|
||||
@DomName('Node.childNodes')
|
||||
@DocsEditable()
|
||||
List<Node> get childNodes => _blink.BlinkNode.instance.childNodes_Getter_(this);
|
||||
$else
|
||||
/**
|
||||
* A list of this node's children.
|
||||
*
|
||||
|
@ -317,6 +276,5 @@ $else
|
|||
@Creates('NodeList')
|
||||
final List<Node> childNodes;
|
||||
|
||||
$endif
|
||||
$!MEMBERS
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
part of $LIBRARYNAME;
|
||||
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$if DART2JS
|
||||
factory $CLASSNAME(Map rtcIceServers, [Map mediaConstraints]) {
|
||||
var constructorName = JS('RtcPeerConnection', 'window[#]',
|
||||
'${Device.propertyPrefix}RTCPeerConnection');
|
||||
|
@ -18,13 +17,11 @@ $if DART2JS
|
|||
convertDartToNative_SerializedScriptValue(rtcIceServers));
|
||||
}
|
||||
}
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Checks if Real Time Communication (RTC) APIs are supported and enabled on
|
||||
* the current platform.
|
||||
*/
|
||||
$if DART2JS
|
||||
static bool get supported {
|
||||
// Currently in Firefox some of the RTC elements are defined but throw an
|
||||
// error unless the user has specifically enabled them in their
|
||||
|
@ -37,9 +34,6 @@ $if DART2JS
|
|||
} catch (_) { return false;}
|
||||
return false;
|
||||
}
|
||||
$else
|
||||
static bool get supported => true;
|
||||
$endif
|
||||
Future<RtcSessionDescription> createOffer([Map mediaConstraints]) {
|
||||
var completer = new Completer<RtcSessionDescription>();
|
||||
_createOffer(
|
||||
|
@ -67,12 +61,7 @@ $endif
|
|||
@DocsEditable()
|
||||
@Experimental() // untriaged
|
||||
static Future generateCertificate(/*AlgorithmIdentifier*/ keygenAlgorithm) =>
|
||||
$if DART2JS
|
||||
JS('dynamic', 'generateCertificate(#)', keygenAlgorithm);
|
||||
$else
|
||||
convertNativePromiseToDartFuture(_blink.BlinkRTCPeerConnection.instance
|
||||
.generateCertificate_Callback_1_(keygenAlgorithm));
|
||||
$endif
|
||||
|
||||
$!MEMBERS
|
||||
}
|
||||
|
|
|
@ -4,13 +4,7 @@
|
|||
|
||||
part of $LIBRARYNAME;
|
||||
|
||||
$if DART2JS
|
||||
// Omit RadioNodeList for dart2js. The Dart Form and FieldSet APIs don't
|
||||
// currently expose an API the returns RadioNodeList. The only use of a
|
||||
// RadioNodeList is to get the selected value and it will be cleaner to
|
||||
// introduce a different API for that purpose.
|
||||
$else
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
}
|
||||
$endif
|
||||
|
|
|
@ -20,10 +20,6 @@ $!MEMBERS
|
|||
*
|
||||
* * [createContextualFragment]
|
||||
*/
|
||||
$if DART2JS
|
||||
static bool get supportsCreateContextualFragment =>
|
||||
JS('bool', '("createContextualFragment" in window.Range.prototype)');
|
||||
$else
|
||||
static bool get supportsCreateContextualFragment => true;
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -7,13 +7,5 @@ part of $LIBRARYNAME;
|
|||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DARTIUM
|
||||
// Override these methods for Dartium _SVGCursorElement can't be abstract.
|
||||
StringList get requiredExtensions => _blink.BlinkSVGCursorElement.instance.requiredExtensions_Getter_(this);
|
||||
StringList get requiredFeatures => _blink.BlinkSVGCursorElement.instance.requiredFeatures_Getter_(this);
|
||||
StringList get systemLanguage => _blink.BlinkSVGCursorElement.instance.systemLanguage_Getter_(this);
|
||||
AnimatedString get href => _blink.BlinkSVGCursorElement.instance.href_Getter_(this);
|
||||
bool hasExtension(String extension) => _blink.BlinkSVGCursorElement.instance.hasExtension_Callback_1_(this, extension);
|
||||
$endif
|
||||
}
|
||||
|
||||
|
|
|
@ -147,10 +147,5 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
return e is $CLASSNAME && !(e is UnknownElement);
|
||||
}
|
||||
|
||||
$if JSINTEROP
|
||||
set _svgClassName(AnimatedString value) =>
|
||||
_blink.BlinkSVGElement.instance.className_Setter_(this, value);
|
||||
|
||||
$endif
|
||||
$!MEMBERS
|
||||
}
|
||||
|
|
|
@ -7,13 +7,5 @@ part of $LIBRARYNAME;
|
|||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DARTIUM
|
||||
// Override these methods for Dartium _SVGFEDropShadowElement can't be abstract.
|
||||
AnimatedLength get height => _blink.BlinkSVGFEDropShadowElement.instance.height_Getter_(this);
|
||||
AnimatedString get result => _blink.BlinkSVGFEDropShadowElement.instance.result_Getter_(this);
|
||||
AnimatedLength get width => _blink.BlinkSVGFEDropShadowElement.instance.width_Getter_(this);
|
||||
AnimatedLength get x => _blink.BlinkSVGFEDropShadowElement.instance.x_Getter_(this);
|
||||
AnimatedLength get y => _blink.BlinkSVGFEDropShadowElement.instance.y_Getter_(this);
|
||||
$endif
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,5 @@ part of $LIBRARYNAME;
|
|||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DARTIUM
|
||||
// Override these methods for Dartium _SVGGlyphRefElement can't be abstract.
|
||||
AnimatedString get href => _blink.BlinkSVGGlyphRefElement.instance.href_Getter_(this);
|
||||
$endif
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,5 @@ part of $LIBRARYNAME;
|
|||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DARTIUM
|
||||
// Override these methods for Dartium _SVGMPathElement can't be abstract.
|
||||
AnimatedString get href => _blink.BlinkSVGMPathElement.instance.href_Getter_(this);
|
||||
$endif
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,5 @@ part of $LIBRARYNAME;
|
|||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DARTIUM
|
||||
// Override these methods for Dartium _ServiceWorker can't be abstract.
|
||||
Stream<ErrorEvent> get onError => errorEvent.forTarget(this);
|
||||
$endif
|
||||
}
|
||||
|
||||
|
|
|
@ -10,15 +10,6 @@ part of $LIBRARYNAME;
|
|||
// rather than an initialization map.
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
|
||||
$if DARTIUM
|
||||
// TODO(alanknight): This really should be generated by the
|
||||
// _OutputConversion in the systemnative.py script, but that doesn't
|
||||
// use those conversions right now, so do this as a one-off.
|
||||
@DomName('ServiceWorkerMessageEvent.data')
|
||||
@DocsEditable()
|
||||
dynamic get data => convertNativeToDart_SerializedScriptValue(
|
||||
_blink.BlinkMessageEvent.instance.data_Getter_(this));
|
||||
$else
|
||||
// TODO(alanknight): This really should be generated by the
|
||||
// _OutputConversion in the systemnative.py script, but that doesn't
|
||||
// use those conversions right now, so do this as a one-off.
|
||||
|
@ -32,7 +23,6 @@ $else
|
|||
@annotation_Creates_SerializedScriptValue
|
||||
@annotation_Returns_SerializedScriptValue
|
||||
final dynamic _get_data;
|
||||
$endif
|
||||
|
||||
$!MEMBERS
|
||||
}
|
||||
|
|
|
@ -8,13 +8,9 @@ part of $LIBRARYNAME;
|
|||
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DART2JS
|
||||
static bool get supported =>
|
||||
JS('bool', '!!(Element.prototype.createShadowRoot||'
|
||||
'Element.prototype.webkitCreateShadowRoot)');
|
||||
$else
|
||||
static final bool supported = true;
|
||||
$endif
|
||||
|
||||
static bool _shadowRootDeprecationReported = false;
|
||||
static void _shadowRootDeprecationReport() {
|
||||
|
|
|
@ -7,12 +7,8 @@
|
|||
part of $LIBRARYNAME;
|
||||
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$if DART2JS
|
||||
factory $CLASSNAME(String data) =>
|
||||
JS('returns:Text;depends:none;effects:none;new:true',
|
||||
'#.createTextNode(#)', document, data);
|
||||
$else
|
||||
factory $CLASSNAME(String data) => document._createTextNode(data);
|
||||
$endif
|
||||
$!MEMBERS
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ $!MEMBERS
|
|||
|
||||
// As of Chrome 37, these all changed from long to double. This code
|
||||
// preserves backwards compatibility for the time being.
|
||||
$if DART2JS
|
||||
int get __clientX => JS('num', '#.clientX', this).round();
|
||||
int get __clientY => JS('num', '#.clientY', this).round();
|
||||
int get __screenX => JS('num', '#.screenX', this).round();
|
||||
|
@ -19,16 +18,6 @@ $if DART2JS
|
|||
int get __pageY => JS('num', '#.pageY', this).round();
|
||||
int get __radiusX => JS('num', '#.radiusX', this).round();
|
||||
int get __radiusY => JS('num', '#.radiusY', this).round();
|
||||
$else
|
||||
int get __clientX => _blink.BlinkTouch.instance.clientX_Getter_(this).round();
|
||||
int get __clientY => _blink.BlinkTouch.instance.clientY_Getter_(this).round();
|
||||
int get __screenX => _blink.BlinkTouch.instance.screenX_Getter_(this).round();
|
||||
int get __screenY => _blink.BlinkTouch.instance.screenY_Getter_(this).round();
|
||||
int get __pageX => _blink.BlinkTouch.instance.pageX_Getter_(this).round();
|
||||
int get __pageY => _blink.BlinkTouch.instance.pageY_Getter_(this).round();
|
||||
int get __radiusX => _blink.BlinkTouch.instance.radiusX_Getter_(this).round();
|
||||
int get __radiusY => _blink.BlinkTouch.instance.radiusY_Getter_(this).round();
|
||||
$endif
|
||||
|
||||
@DomName('Touch.clientX')
|
||||
@DomName('Touch.clientY')
|
||||
|
|
|
@ -15,11 +15,7 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
if (view == null) {
|
||||
view = window;
|
||||
}
|
||||
$if DART2JS
|
||||
TouchEvent e = document._createEvent("TouchEvent");
|
||||
$else
|
||||
TouchEvent e = _blink.BlinkTouchEvent.instance.constructorCallback_1_(type);
|
||||
$endif
|
||||
e._initTouchEvent(touches, targetTouches, changedTouches, type, view,
|
||||
screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey);
|
||||
return e;
|
||||
|
@ -31,9 +27,5 @@ $!MEMBERS
|
|||
* Note that touch events are only supported if the user is using a touch
|
||||
* device.
|
||||
*/
|
||||
$if DART2JS
|
||||
static bool get supported => Device.isEventTypeSupported('TouchEvent');
|
||||
$else
|
||||
static bool get supported => true;
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -12,15 +12,7 @@ $!MEMBERS
|
|||
@DocsEditable()
|
||||
void readPixels(int x, int y, int width, int height, int format, int type,
|
||||
TypedData pixels) {
|
||||
$if DART2JS
|
||||
_readPixels(x, y, width, height, format, type, pixels);
|
||||
$else
|
||||
var data = js.toArrayBufferView(pixels);
|
||||
_readPixels(x, y, width, height, format, type, data);
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
pixels[i] = data[i];
|
||||
}
|
||||
$endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,15 +11,7 @@ $!MEMBERS
|
|||
@DocsEditable()
|
||||
void readPixels(int x, int y, int width, int height, int format, int type,
|
||||
TypedData pixels) {
|
||||
$if DART2JS
|
||||
_readPixels(x, y, width, height, format, type, pixels);
|
||||
$else
|
||||
var data = js.toArrayBufferView(pixels);
|
||||
_readPixels(x, y, width, height, format, type, data);
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
pixels[i] = data[i];
|
||||
}
|
||||
$endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,6 @@ part of $LIBRARYNAME;
|
|||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$MIXINS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
|
||||
$if DART2JS
|
||||
void appendRule(String rule) {
|
||||
if (JS('bool', '("appendRule" in #)', this)) {
|
||||
JS('', '#.appendRule(#)', this, rule);
|
||||
|
@ -16,5 +15,4 @@ $if DART2JS
|
|||
JS('', '#.insertRule(#)', this, rule);
|
||||
}
|
||||
}
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
'relatedTarget': relatedTarget,
|
||||
};
|
||||
|
||||
$if DART2JS
|
||||
if (view == null) {
|
||||
view = window;
|
||||
}
|
||||
|
@ -43,14 +42,10 @@ $if DART2JS
|
|||
return JS('WheelEvent', 'new WheelEvent(#, #)',
|
||||
type, convertDartToNative_Dictionary(options));
|
||||
|
||||
$else
|
||||
return _blink.BlinkWheelEvent.instance.constructorCallback_2_(type, convertDartToNative_Dictionary(options));
|
||||
$endif
|
||||
}
|
||||
|
||||
$!MEMBERS
|
||||
|
||||
$if DART2JS
|
||||
/**
|
||||
* The amount that is expected to scroll vertically, in units determined by
|
||||
* [deltaMode].
|
||||
|
@ -143,27 +138,4 @@ $if DART2JS
|
|||
int deltaZ,
|
||||
int deltaMode) native;
|
||||
|
||||
$else
|
||||
/**
|
||||
* The amount that is expected to scroll horizontally, in units determined by
|
||||
* [deltaMode].
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* * [WheelEvent.deltaX](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-WheelEvent-deltaX) from the W3C.
|
||||
*/
|
||||
@DomName('WheelEvent.deltaX')
|
||||
num get deltaX => _deltaX;
|
||||
|
||||
/**
|
||||
* The amount that is expected to scroll vertically, in units determined by
|
||||
* [deltaMode].
|
||||
*
|
||||
* See also:
|
||||
*
|
||||
* * [WheelEvent.deltaY](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-WheelEvent-deltaY) from the W3C.
|
||||
*/
|
||||
@DomName('WheelEvent.deltaY')
|
||||
num get deltaY => _deltaY;
|
||||
$endif
|
||||
}
|
||||
|
|
|
@ -5,12 +5,8 @@
|
|||
part of $LIBRARYNAME;
|
||||
|
||||
@DocsEditable()
|
||||
$if DART2JS
|
||||
$(ANNOTATIONS)@Native("Window,DOMWindow")
|
||||
$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$else
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Returns a Future that completes just before the window is about to
|
||||
|
@ -35,7 +31,6 @@ $endif
|
|||
return completer.future;
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
/**
|
||||
* The newest document in this window.
|
||||
*
|
||||
|
@ -182,28 +177,6 @@ $if DART2JS
|
|||
@DomName('Window.console')
|
||||
Console get console => Console._safeConsole;
|
||||
|
||||
$else
|
||||
/**
|
||||
* Called to draw an animation frame and then request the window to repaint
|
||||
* after [callback] has finished (creating the animation).
|
||||
*
|
||||
* Use this method only if you need to later call [cancelAnimationFrame]. If
|
||||
* not, the preferred Dart idiom is to set animation frames by calling
|
||||
* [animationFrame], which returns a Future.
|
||||
*
|
||||
* Returns a non-zero valued integer to represent the request id for this
|
||||
* request. This value only needs to be saved if you intend to call
|
||||
* [cancelAnimationFrame] so you can specify the particular animation to
|
||||
* cancel.
|
||||
*
|
||||
* Note: The supplied [callback] needs to call [requestAnimationFrame] again
|
||||
* for the animation to continue.
|
||||
*/
|
||||
@DomName('Window.requestAnimationFrame')
|
||||
int requestAnimationFrame(FrameRequestCallback callback) {
|
||||
return _requestAnimationFrame(_wrapZone(callback));
|
||||
}
|
||||
$endif
|
||||
|
||||
/**
|
||||
* Access a sandboxed file system of the specified `size`. If `persistent` is
|
||||
|
@ -254,7 +227,6 @@ $!MEMBERS
|
|||
_moveTo(p.x, p.y);
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
@DomName('Window.pageXOffset')
|
||||
@DocsEditable()
|
||||
int get pageXOffset => JS('num', '#.pageXOffset', this).round();
|
||||
|
@ -294,26 +266,8 @@ $if DART2JS
|
|||
int get scrollY => JS('bool', '("scrollY" in #)', this) ?
|
||||
JS('num', '#.scrollY', this).round() :
|
||||
document.documentElement.scrollTop;
|
||||
$else
|
||||
@DomName('Window.pageXOffset')
|
||||
@DocsEditable()
|
||||
int get pageXOffset => _blink.BlinkWindow.instance.pageXOffset_Getter_(this).round();
|
||||
|
||||
@DomName('Window.pageYOffset')
|
||||
@DocsEditable()
|
||||
int get pageYOffset => _blink.BlinkWindow.instance.pageYOffset_Getter_(this).round();
|
||||
|
||||
@DomName('Window.scrollX')
|
||||
@DocsEditable()
|
||||
int get scrollX => _blink.BlinkWindow.instance.scrollX_Getter_(this).round();
|
||||
|
||||
@DomName('Window.scrollY')
|
||||
@DocsEditable()
|
||||
int get scrollY => _blink.BlinkWindow.instance.scrollY_Getter_(this).round();
|
||||
$endif
|
||||
}
|
||||
|
||||
$if DART2JS
|
||||
class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent {
|
||||
String _returnValue;
|
||||
|
||||
|
@ -330,7 +284,6 @@ class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent {
|
|||
}
|
||||
}
|
||||
}
|
||||
$endif
|
||||
|
||||
class _BeforeUnloadEventStreamProvider implements
|
||||
EventStreamProvider<BeforeUnloadEvent> {
|
||||
|
@ -339,9 +292,7 @@ class _BeforeUnloadEventStreamProvider implements
|
|||
const _BeforeUnloadEventStreamProvider(this._eventType);
|
||||
|
||||
Stream<BeforeUnloadEvent> forTarget(EventTarget e, {bool useCapture: false}) {
|
||||
$if DART2JS
|
||||
// Specify the generic type for EventStream only in dart2js to avoid
|
||||
// checked mode errors in dartium.
|
||||
// Specify the generic type for EventStream only in dart2js.
|
||||
var stream = new _EventStream<BeforeUnloadEvent>(e, _eventType, useCapture);
|
||||
var controller = new StreamController<BeforeUnloadEvent>(sync: true);
|
||||
|
||||
|
@ -351,10 +302,6 @@ $if DART2JS
|
|||
});
|
||||
|
||||
return controller.stream;
|
||||
$else
|
||||
var stream = new _EventStream(e, _eventType, useCapture);
|
||||
return stream;
|
||||
$endif
|
||||
}
|
||||
|
||||
String getEventType(EventTarget target) {
|
||||
|
@ -362,23 +309,13 @@ $endif
|
|||
}
|
||||
|
||||
ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false}) {
|
||||
$if DART2JS
|
||||
// Specify the generic type for _ElementEventStreamImpl only in dart2js to
|
||||
// avoid checked mode errors in dartium.
|
||||
// Specify the generic type for _ElementEventStreamImpl only in dart2js.
|
||||
return new _ElementEventStreamImpl<BeforeUnloadEvent>(e, _eventType, useCapture);
|
||||
$else
|
||||
return new _ElementEventStreamImpl(e, _eventType, useCapture);
|
||||
$endif
|
||||
}
|
||||
|
||||
ElementStream<BeforeUnloadEvent> _forElementList(ElementList e,
|
||||
{bool useCapture: false}) {
|
||||
$if DART2JS
|
||||
// Specify the generic type for _ElementEventStreamImpl only in dart2js to
|
||||
// avoid checked mode errors in dartium.
|
||||
// Specify the generic type for _ElementEventStreamImpl only in dart2js.
|
||||
return new _ElementListEventStreamImpl<BeforeUnloadEvent>(e, _eventType, useCapture);
|
||||
$else
|
||||
return new _ElementListEventStreamImpl(e, _eventType, useCapture);
|
||||
$endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,17 +7,5 @@ part of $LIBRARYNAME;
|
|||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DARTIUM
|
||||
// Override these methods for Dartium _WorkerLocation can't be abstract.
|
||||
String get hash => _blink.BlinkWorkerLocation.instance.hash_Getter_(this);
|
||||
String get host => _blink.BlinkWorkerLocation.instance.host_Getter_(this);
|
||||
String get hostname => _blink.BlinkWorkerLocation.instance.hostname_Getter_(this);
|
||||
String get href => _blink.BlinkWorkerLocation.instance.href_Getter_(this);
|
||||
String get origin => _blink.BlinkWorkerLocation.instance.origin_Getter_(this);
|
||||
String get pathname => _blink.BlinkWorkerLocation.instance.pathname_Getter_(this);
|
||||
String get port => _blink.BlinkWorkerLocation.instance.port_Getter_(this);
|
||||
String get protocol => _blink.BlinkWorkerLocation.instance.protocol_Getter_(this);
|
||||
String get search => _blink.BlinkWorkerLocation.instance.search_Getter_(this);
|
||||
$endif
|
||||
}
|
||||
|
||||
|
|
|
@ -7,17 +7,5 @@ part of $LIBRARYNAME;
|
|||
@DocsEditable()
|
||||
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
||||
$!MEMBERS
|
||||
$if DARTIUM
|
||||
// Override these methods for Dartium _WorkerNavigator can't be abstract.
|
||||
String get appCodeName => _blink.BlinkWorkerNavigator.instance.appCodeName_Getter_(this);
|
||||
String get appName => _blink.BlinkWorkerNavigator.instance.appCodeName_Getter_(this);
|
||||
String get appVersion => _blink.BlinkWorkerNavigator.instance.appVersion_Getter_(this);
|
||||
bool get dartEnabled => _blink.BlinkWorkerNavigator.instance.dartEnabled_Getter_(this);
|
||||
String get platform => _blink.BlinkWorkerNavigator.instance.platform_Getter_(this);
|
||||
String get product => _blink.BlinkWorkerNavigator.instance.product_Getter_(this);
|
||||
String get userAgent => _blink.BlinkWorkerNavigator.instance.userAgent_Getter_(this);
|
||||
int get hardwareConcurrency => _blink.BlinkWorkerNavigator.instance.hardwareConcurrency_Getter_(this);
|
||||
bool get onLine => _blink.BlinkWorkerNavigator.instance.onLine_Getter_(this);
|
||||
$endif
|
||||
}
|
||||
|
||||
|
|
|
@ -253,12 +253,8 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
* Checks to see if the Progress event is supported on the current platform.
|
||||
*/
|
||||
static bool get supportsProgressEvent {
|
||||
$if DART2JS
|
||||
var xhr = new HttpRequest();
|
||||
return JS('bool', '("onprogress" in #)', xhr);
|
||||
$else
|
||||
return true;
|
||||
$endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -269,24 +265,16 @@ $endif
|
|||
* if the destination server does not support CORS requests.
|
||||
*/
|
||||
static bool get supportsCrossOrigin {
|
||||
$if DART2JS
|
||||
var xhr = new HttpRequest();
|
||||
return JS('bool', '("withCredentials" in #)', xhr);
|
||||
$else
|
||||
return true;
|
||||
$endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the LoadEnd event is supported on the current platform.
|
||||
*/
|
||||
static bool get supportsLoadEndEvent {
|
||||
$if DART2JS
|
||||
var xhr = new HttpRequest();
|
||||
return JS('bool', '("onloadend" in #)', xhr);
|
||||
$else
|
||||
return true;
|
||||
$endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -294,12 +282,8 @@ $endif
|
|||
* platform.
|
||||
*/
|
||||
static bool get supportsOverrideMimeType {
|
||||
$if DART2JS
|
||||
var xhr = new HttpRequest();
|
||||
return JS('bool', '("overrideMimeType" in #)', xhr);
|
||||
$else
|
||||
return true;
|
||||
$endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -316,7 +300,6 @@ $endif
|
|||
return xhr.responseText;
|
||||
});
|
||||
}
|
||||
$if DART2JS
|
||||
var completer = new Completer<String>();
|
||||
if (method == null) {
|
||||
method = 'GET';
|
||||
|
@ -345,7 +328,6 @@ $if DART2JS
|
|||
}
|
||||
|
||||
return completer.future;
|
||||
$endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -401,17 +383,7 @@ $endif
|
|||
*/
|
||||
@DomName('XMLHttpRequest.open')
|
||||
@DocsEditable()
|
||||
$if JSINTEROP
|
||||
void open(String method, String url, {bool async, String user, String password}) {
|
||||
if (async == null && user == null && password == null) {
|
||||
_blink.BlinkXMLHttpRequest.instance.open_Callback_2_(this, method, url);
|
||||
} else {
|
||||
_blink.BlinkXMLHttpRequest.instance.open_Callback_5_(this, method, url, async, user, password);
|
||||
}
|
||||
}
|
||||
$else
|
||||
void open(String method, String url, {bool async, String user, String password}) native;
|
||||
$endif
|
||||
|
||||
$!MEMBERS
|
||||
}
|
||||
|
|
|
@ -14,14 +14,11 @@ $endif
|
|||
|
||||
$E get first {
|
||||
if (this.length > 0) {
|
||||
$if DART2JS
|
||||
return JS('$EJS', '#[0]', this);
|
||||
$else
|
||||
$if USE_NATIVE_INDEXED_GETTER
|
||||
return $GETTER(0);
|
||||
$else
|
||||
return this[0];
|
||||
$endif
|
||||
$endif
|
||||
}
|
||||
throw new StateError("No elements");
|
||||
|
@ -30,14 +27,11 @@ $endif
|
|||
$E get last {
|
||||
int len = this.length;
|
||||
if (len > 0) {
|
||||
$if DART2JS
|
||||
return JS('$EJS', '#[#]', this, len - 1);
|
||||
$else
|
||||
$if USE_NATIVE_INDEXED_GETTER
|
||||
return $GETTER(len - 1);
|
||||
$else
|
||||
return this[len - 1];
|
||||
$endif
|
||||
$endif
|
||||
}
|
||||
throw new StateError("No elements");
|
||||
|
@ -46,14 +40,11 @@ $endif
|
|||
$E get single {
|
||||
int len = this.length;
|
||||
if (len == 1) {
|
||||
$if DART2JS
|
||||
return JS('$EJS', '#[0]', this);
|
||||
$else
|
||||
$if USE_NATIVE_INDEXED_GETTER
|
||||
return $GETTER(0);
|
||||
$else
|
||||
return this[0];
|
||||
$endif
|
||||
$endif
|
||||
}
|
||||
if (len == 0) throw new StateError("No elements");
|
||||
|
|
Loading…
Reference in a new issue