Skip to content

Commit

Permalink
Update getClientRects, removed xtab, removed bogus entry in dom.json,
Browse files Browse the repository at this point in the history
expose ServiceWorker, removed query and queryAll from in dart:html,
added constructor to MessageChannel and removed getCssCanvasContext.

Fixed all tests using query and queryAll.

Fixes dart-lang/sdk#25664
Fixes dart-lang/sdk#26349
Fixes dart-lang/sdk#32323
Fixes dart-lang/sdk#32659
Fixes dart-lang/sdk#32675

[email protected]

Change-Id: I687471e80b8fe9c7040673113f424dbaab7c64d4
Reviewed-on: https://dart-review.googlesource.com/48381
Commit-Queue: Terry Lucas <[email protected]>
Reviewed-by: Kevin Moore <[email protected]>
  • Loading branch information
terrylucas authored and [email protected] committed Mar 27, 2018
1 parent f9e12f1 commit bc75856
Show file tree
Hide file tree
Showing 59 changed files with 446 additions and 649 deletions.
223 changes: 56 additions & 167 deletions sdk/lib/html/dart2js/html_dart2js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12377,25 +12377,6 @@ class Document extends Node {
ElementList<T> querySelectorAll<T extends Element>(String selectors) =>
new _FrozenElementList<T>._wrap(_querySelectorAll(selectors));

/**
* Alias for [querySelector]. Note this function is deprecated because its
* semantics will be changing in the future.
*/
@deprecated
@Experimental()
@DomName('Document.querySelector')
Element query(String relativeSelectors) => querySelector(relativeSelectors);

/**
* Alias for [querySelectorAll]. Note this function is deprecated because its
* semantics will be changing in the future.
*/
@deprecated
@Experimental()
@DomName('Document.querySelectorAll')
ElementList<T> queryAll<T extends Element>(String relativeSelectors) =>
querySelectorAll(relativeSelectors);

/// Checks if [registerElement] is supported on the current platform.
bool get supportsRegisterElement {
return JS('bool', '("registerElement" in #)', this);
Expand Down Expand Up @@ -12560,26 +12541,6 @@ class DocumentFragment extends Node
validator: validator, treeSanitizer: treeSanitizer));
}

/**
* Alias for [querySelector]. Note this function is deprecated because its
* semantics will be changing in the future.
*/
@deprecated
@Experimental()
@DomName('DocumentFragment.querySelector')
Element query(String relativeSelectors) {
return querySelector(relativeSelectors);
}

/**
* Alias for [querySelectorAll]. Note this function is deprecated because its
* semantics will be changing in the future.
*/
@deprecated
@Experimental()
@DomName('DocumentFragment.querySelectorAll')
ElementList<T> queryAll<T extends Element>(String relativeSelectors) =>
querySelectorAll(relativeSelectors);
// To suppress missing implicit constructor warnings.
factory DocumentFragment._() {
throw new UnsupportedError("Not supported");
Expand Down Expand Up @@ -15707,25 +15668,6 @@ class Element extends Node
ElementList<T> querySelectorAll<T extends Element>(String selectors) =>
new _FrozenElementList<T>._wrap(_querySelectorAll(selectors));

/**
* Alias for [querySelector]. Note this function is deprecated because its
* semantics will be changing in the future.
*/
@deprecated
@DomName('Element.querySelector')
@Experimental()
Element query(String relativeSelectors) => querySelector(relativeSelectors);

/**
* Alias for [querySelectorAll]. Note this function is deprecated because its
* semantics will be changing in the future.
*/
@deprecated
@DomName('Element.querySelectorAll')
@Experimental()
ElementList<T> queryAll<T extends Element>(String relativeSelectors) =>
querySelectorAll(relativeSelectors);

/**
* The set of CSS classes applied to this element.
*
Expand Down Expand Up @@ -15888,8 +15830,6 @@ class Element extends Node

@DomName('Element.getClientRects')
@DocsEditable()
@Returns('DomRectList|Null')
@Creates('DomRectList')
List<Rectangle> getClientRects() {
var value = _getClientRects();

Expand Down Expand Up @@ -15960,31 +15900,6 @@ class Element extends Node
*/
void attributeChanged(String name, String oldValue, String newValue) {}

// Hooks to support custom WebComponents.

@Creates('Null') // Set from Dart code; does not instantiate a native type.
Element _xtag;

/**
* Experimental support for [web components][wc]. This field stores a
* reference to the component implementation. It was inspired by Mozilla's
* [x-tags][] project. Please note: in the future it may be possible to
* `extend Element` from your class, in which case this field will be
* deprecated.
*
* If xtag has not been set, it will simply return `this` [Element].
*
* [wc]: http://dvcs.w3.org/hg/webcomponents/raw-file/tip/explainer/index.html
* [x-tags]: http://x-tags.org/
*/
// Note: return type is `dynamic` for convenience to suppress warnings when
// members of the component are used. The actual type is a subtype of Element.
get xtag => _xtag != null ? _xtag : this;

set xtag(Element value) {
_xtag = value;
}

@DomName('Element.localName')
@DocsEditable()
@Returns('String')
Expand Down Expand Up @@ -17669,8 +17584,8 @@ class Element extends Node
*/
@DomName('Element.getClientRects')
@DocsEditable()
@Returns('DomRectList|Null')
@Creates('DomRectList')
@Returns('DomRectList|Null')
List<Rectangle> _getClientRects() native;

/**
Expand Down Expand Up @@ -19287,8 +19202,8 @@ class ExtendableMessageEvent extends ExtendableEvent {
@DomName('ExtendableMessageEvent.source')
@DocsEditable()
@Experimental() // untriaged
@Creates('Client|_ServiceWorker|MessagePort')
@Returns('Client|_ServiceWorker|MessagePort|Null')
@Creates('Client|ServiceWorker|MessagePort')
@Returns('Client|ServiceWorker|MessagePort|Null')
final Object source;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
Expand Down Expand Up @@ -22021,48 +21936,6 @@ class HtmlDocument extends Document {
return _elementFromPoint(x, y);
}

/**
* Checks if the getCssCanvasContext API is supported on the current platform.
*
* See also:
*
* * [getCssCanvasContext]
*/
static bool get supportsCssCanvasContext =>
JS('bool', '!!(document.getCSSCanvasContext)');

/**
* Gets a CanvasRenderingContext which can be used as the CSS background of an
* element.
*
* CSS:
*
* background: -webkit-canvas(backgroundCanvas)
*
* Generate the canvas:
*
* var context = document.getCssCanvasContext('2d', 'backgroundCanvas',
* 100, 100);
* context.fillStyle = 'red';
* context.fillRect(0, 0, 100, 100);
*
* See also:
*
* * [supportsCssCanvasContext]
* * [CanvasElement.getContext]
*/
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental()
@DomName('Document.getCSSCanvasContext')
CanvasRenderingContext getCssCanvasContext(
String contextId, String name, int width, int height) {
if (HtmlDocument.supportsCssCanvasContext)
return JS('CanvasRenderingContext', '#.getCSSCanvasContext(#, #, #, #)',
this, contextId, name, width, height);
throw new UnsupportedError("Not supported");
}

@DomName('Document.head')
HeadElement get head => _head;

Expand Down Expand Up @@ -26921,6 +26794,14 @@ class MessageChannel extends Interceptor {
throw new UnsupportedError("Not supported");
}

@DomName('MessageChannel.MessageChannel')
@DocsEditable()
factory MessageChannel() {
return MessageChannel._create_1();
}
static MessageChannel _create_1() =>
JS('MessageChannel', 'new MessageChannel()');

@DomName('MessageChannel.port1')
@DocsEditable()
final MessagePort port1;
Expand Down Expand Up @@ -33674,8 +33555,6 @@ class Range extends Interceptor {

@DomName('Range.getClientRects')
@DocsEditable()
@Returns('DomRectList|Null')
@Creates('DomRectList')
List<Rectangle> getClientRects() {
var value = _getClientRects();

Expand Down Expand Up @@ -35795,6 +35674,47 @@ class SensorErrorEvent extends Event {
// 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.

@DocsEditable()
@DomName('ServiceWorker')
@Experimental() // untriaged
@Native("ServiceWorker")
class ServiceWorker extends EventTarget implements AbstractWorker {
// To suppress missing implicit constructor warnings.
factory ServiceWorker._() {
throw new UnsupportedError("Not supported");
}

@DomName('ServiceWorker.errorEvent')
@DocsEditable()
@Experimental() // untriaged
static const EventStreamProvider<Event> errorEvent =
const EventStreamProvider<Event>('error');

@JSName('scriptURL')
@DomName('ServiceWorker.scriptURL')
@DocsEditable()
@Experimental() // untriaged
final String scriptUrl;

@DomName('ServiceWorker.state')
@DocsEditable()
@Experimental() // untriaged
final String state;

@DomName('ServiceWorker.postMessage')
@DocsEditable()
@Experimental() // untriaged
void postMessage(Object message, [List<Object> transfer]) native;

@DomName('ServiceWorker.onerror')
@DocsEditable()
@Experimental() // untriaged
Stream<Event> get onError => errorEvent.forTarget(this);
}
// 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.

@DocsEditable()
@DomName('ServiceWorkerContainer')
@Experimental() // untriaged
Expand All @@ -35814,7 +35734,7 @@ class ServiceWorkerContainer extends EventTarget {
@DomName('ServiceWorkerContainer.controller')
@DocsEditable()
@Experimental() // untriaged
final _ServiceWorker controller;
final ServiceWorker controller;

@DomName('ServiceWorkerContainer.ready')
@DocsEditable()
Expand Down Expand Up @@ -35960,7 +35880,7 @@ class ServiceWorkerRegistration extends EventTarget {
@DomName('ServiceWorkerRegistration.active')
@DocsEditable()
@Experimental() // untriaged
final _ServiceWorker active;
final ServiceWorker active;

@DomName('ServiceWorkerRegistration.backgroundFetch')
@DocsEditable()
Expand All @@ -35970,7 +35890,7 @@ class ServiceWorkerRegistration extends EventTarget {
@DomName('ServiceWorkerRegistration.installing')
@DocsEditable()
@Experimental() // untriaged
final _ServiceWorker installing;
final ServiceWorker installing;

@DomName('ServiceWorkerRegistration.navigationPreload')
@DocsEditable()
Expand Down Expand Up @@ -36000,7 +35920,7 @@ class ServiceWorkerRegistration extends EventTarget {
@DomName('ServiceWorkerRegistration.waiting')
@DocsEditable()
@Experimental() // untriaged
final _ServiceWorker waiting;
final ServiceWorker waiting;

@DomName('ServiceWorkerRegistration.getNotifications')
@DocsEditable()
Expand Down Expand Up @@ -45910,21 +45830,6 @@ abstract class _Response extends Body {
// 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.

@DocsEditable()
@DomName('ServiceWorker')
@Experimental() // untriaged
@Native("ServiceWorker")
abstract class _ServiceWorker extends EventTarget implements AbstractWorker {
// To suppress missing implicit constructor warnings.
factory _ServiceWorker._() {
throw new UnsupportedError("Not supported");
}
}

// 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.

@DocsEditable()
@DomName('SpeechRecognitionResultList')
// https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#speechrecognitionresultlist
Expand Down Expand Up @@ -51524,22 +51429,6 @@ void Function(T1, T2) _wrapBinaryZone<T1, T2>(void Function(T1, T2) callback) {
return Zone.current.bindBinaryCallbackGuarded(callback);
}

/**
* Alias for [querySelector]. Note this function is deprecated because its
* semantics will be changing in the future.
*/
@deprecated
@Experimental()
Element query(String relativeSelectors) => document.query(relativeSelectors);
/**
* Alias for [querySelectorAll]. Note this function is deprecated because its
* semantics will be changing in the future.
*/
@deprecated
@Experimental()
ElementList<Element> queryAll(String relativeSelectors) =>
document.queryAll(relativeSelectors);

/**
* Finds the first descendant element of this document that matches the
* specified group of selectors.
Expand Down
Loading

0 comments on commit bc75856

Please sign in to comment.