Chromium Code Reviews| Index: sdk/lib/html/dartium/html_dartium.dart |
| diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart |
| index 5547397958885d01c71a201e44eef4d18a389458..41f083da3ffcf5e318dac9e24c12ad41c5b68e21 100644 |
| --- a/sdk/lib/html/dartium/html_dartium.dart |
| +++ b/sdk/lib/html/dartium/html_dartium.dart |
| @@ -19630,6 +19630,13 @@ class Node extends EventTarget { |
| TemplateInstance get templateInstance => |
| TemplateElement.mdvPackage(this).templateInstance; |
| + |
| + /** |
| + * Use ownerDocument instead. |
| + */ |
| + @deprecated |
| + Document get document => ownerDocument; |
| + |
| // To suppress missing implicit constructor warnings. |
| factory Node._() { throw new UnsupportedError("Not supported"); } |
| @@ -19728,7 +19735,7 @@ class Node extends EventTarget { |
| @DomName('Node.ownerDocument') |
| @DocsEditable() |
| - Document get document native "Node_ownerDocument_Getter"; |
| + Document get ownerDocument native "Node_ownerDocument_Getter"; |
| @DomName('Node.parentElement') |
| @DocsEditable() |
| @@ -25332,7 +25339,7 @@ class TemplateElement extends HtmlElement { |
| } |
| if (!isNative) { |
| - var doc = _getTemplateContentsOwner(templateElement.document); |
| + var doc = _getTemplateContentsOwner(templateElement.ownerDocument); |
| templateElement._templateContent = doc.createDocumentFragment(); |
| } |
| @@ -25381,7 +25388,7 @@ class TemplateElement extends HtmlElement { |
| // + <td>Bar</td> |
| // |
| static Element _extractTemplateFromAttributeTemplate(Element el) { |
| - var template = el.document.createElement('template'); |
| + var template = el.ownerDocument.createElement('template'); |
| el.parentNode.insertBefore(template, el); |
| for (var name in el.attributes.keys.toList()) { |
| @@ -25434,7 +25441,7 @@ class TemplateElement extends HtmlElement { |
| // Need to do this first as the contents may get lifted if |node| is |
| // template. |
| // TODO(jmesserly): content is DocumentFragment or Element |
| - var descendents = |
| + var descendents = |
| (content as dynamic).querySelectorAll(_allTemplatesSelectors); |
| if (content is Element && (content as Element).isTemplate) { |
| _bootstrap(content); |
| @@ -26871,13 +26878,13 @@ class Url extends NativeFieldWrapperClass1 { |
| if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) { |
| return _createObjectURL_1(blob_OR_source_OR_stream); |
| } |
| - if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) { |
| + if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) { |
| return _createObjectURL_2(blob_OR_source_OR_stream); |
| } |
| - if ((blob_OR_source_OR_stream is _WebKitMediaSource || blob_OR_source_OR_stream == null)) { |
| + if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) { |
| return _createObjectURL_3(blob_OR_source_OR_stream); |
| } |
| - if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) { |
| + if ((blob_OR_source_OR_stream is _WebKitMediaSource || blob_OR_source_OR_stream == null)) { |
| return _createObjectURL_4(blob_OR_source_OR_stream); |
| } |
| throw new ArgumentError("Incorrect number or type of arguments"); |
| @@ -35676,6 +35683,46 @@ get _pureIsolateTimerFactoryClosure => |
| throw new UnimplementedError("Timers on background isolates " |
| "are not supported in the browser")); |
| +class _ScheduleImmediateHelper { |
|
Jennifer Messerly
2013/10/16 23:09:03
curious where this came from? Someone forgot to re
blois
2013/10/16 23:12:35
Yep, I just submitted the fix- https://codereview.
|
| + MutationObserver _observer; |
| + final DivElement _div = new DivElement(); |
| + Function _callback; |
| + |
| + _ScheduleImmediateHelper() { |
| + // Mutation events get fired as soon as the current event stack is unwound |
| + // so we just make a dummy event and listen for that. |
| + _observer = new MutationObserver(_handleMutation); |
| + _observer.observe(_div, attributes: true); |
| + } |
| + |
| + void _schedule(callback) { |
| + if (_callback != null) { |
| + throw new StateError( |
| + 'Only one immediate callback can be scheduled at once'); |
| + } |
| + _callback = callback; |
| + // Toggle it to trigger the mutation event. |
| + _div.hidden = !_div.hidden; |
| + } |
| + |
| + _handleMutation(List<MutationRecord> mutations, MutationObserver observer) { |
| + var tmp = _callback; |
| + _callback = null; |
| + tmp(); |
| + } |
| +} |
| + |
| +final _ScheduleImmediateHelper _scheduleImmediateHelper = |
| + new _ScheduleImmediateHelper(); |
| + |
| +get _scheduleImmediateClosure => (void callback()) { |
| + _scheduleImmediateHelper._schedule(callback); |
| +}; |
| + |
| +get _pureIsolateScheduleImmediateClosure => ((void callback()) => |
| + throw new UnimplementedError("scheduleMicrotask in background isolates " |
| + "are not supported in the browser")); |
| + |
| void _initializeCustomElement(Element e) { |
| _Utils.initializeCustomElement(e); |
| } |