- Fixed querySelectoryAll generic syntax to assert if types in list aren't of the same type T.

- Fixes requestFullscreen to call operation webkitRequestFullscreen not requestFullscreen its only available when RuntimeEnabled=FullscreenUnprefixed.

Fixes #21919

R=vsm@google.com

Change-Id: Ib4c4140350d3cef096954e67010f922df9f2310a
Reviewed-on: https://dart-review.googlesource.com/60702
Commit-Queue: Terry Lucas <terry@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
This commit is contained in:
Terry Lucas 2018-06-25 18:43:54 +00:00 committed by commit-bot@chromium.org
parent 3640037164
commit 5721d8af6d
6 changed files with 28 additions and 18 deletions

View file

@ -11641,7 +11641,10 @@ class _FrozenElementList<E extends Element> extends ListBase<E>
implements ElementList<E>, NodeListWrapper {
final List<Node> _nodeList;
_FrozenElementList._wrap(this._nodeList);
_FrozenElementList._wrap(this._nodeList) {
assert(this._nodeList.every((element) => element is E),
"Query expects only HTML elements of type $E but found ${this._nodeList.firstWhere((e) => e is! E)}");
}
int get length => _nodeList.length;
@ -13958,8 +13961,6 @@ class Element extends Node
@JSName('removeAttributeNS')
void _removeAttributeNS(String namespaceURI, String localName) native;
void requestFullscreen() native;
void requestPointerLock() native;
void scroll([options_OR_x, num y]) {
@ -14052,6 +14053,21 @@ class Element extends Node
void setPointerCapture(int pointerId) native;
@JSName('webkitRequestFullscreen')
/**
* Displays this element fullscreen.
*
* ## Other resources
*
* * [Using the fullscreen
* API](http://docs.webplatform.org/wiki/tutorials/using_the_full-screen_api)
* tutorial from WebPlatform.org.
* * [Fullscreen specification](http://www.w3.org/TR/fullscreen/) from W3C.
*/
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
void requestFullscreen() native;
// From ChildNode
void after(Object nodes) native;
@ -27346,8 +27362,6 @@ class SpeechRecognitionResult extends Interceptor {
@Native("SpeechSynthesis")
class SpeechSynthesis extends EventTarget {
@DomName('SpeechSynthesis.getVoices')
@DocsEditable()
List<SpeechSynthesisVoice> getVoices() {
List<SpeechSynthesisVoice> voices = _getVoices();
if (voices.length > 0) applyExtension('SpeechSynthesisVoice', voices[0]);

View file

@ -34,12 +34,9 @@ topLevelQuerySelector() {
expect(noElementsTop.length, 0);
expect(noElementsTop is List, true);
var varWeird = querySelectorAll<svg.CircleElement>('path');
expect(varWeird.length, 1);
expect(varWeird is List, true);
expect(varWeird is List<svg.CircleElement>, true);
// Runtime error expected 'PathElement' is not a subtype of expected type 'CircleElement'.'
Expect.throwsTypeError(() => varWeird[0] is svg.CircleElement);
// Expect runtime error all elements in the list are not the proper type.
Expect.throwsAssertionError(() => querySelectorAll<svg.CircleElement>('path'),
'All elements not of type CircleElement');
var simpleElems = querySelectorAll('circle');
expect(simpleElems.length, 1);

View file

@ -512,11 +512,10 @@ interface AudioScheduledSourceNode {
[DartName=start2] void start(optional double when);
};
// Remove operations webkitRequestFullscreen replaced w/ requestFullscreen.
// Remove operation requestFullscreen only use webKitRequestFullscreen.
[DartSupplemental]
interface Element : Node {
[DartSuppress] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags);
[DartSuppress] void webkitRequestFullscreen();
[DartSuppress] void requestFullscreen();
};
[DartSupplemental]

View file

@ -58,7 +58,6 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
ElementList<T> querySelectorAll<T extends Element>(String selectors) =>
new _FrozenElementList<T>._wrap(_querySelectorAll(selectors));
String get innerHtml {
final e = new DivElement();
e.append(this.clone(true));

View file

@ -263,7 +263,10 @@ class _FrozenElementList<E extends Element> extends ListBase<E>
implements ElementList<E>, NodeListWrapper {
final List<Node> _nodeList;
_FrozenElementList._wrap(this._nodeList);
_FrozenElementList._wrap(this._nodeList) {
assert(this._nodeList.every((element) => element is E),
"Query expects only HTML elements of type $E but found ${this._nodeList.firstWhere((e) => e is! E)}");
}
int get length => _nodeList.length;

View file

@ -6,8 +6,6 @@ part of $LIBRARYNAME;
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS
{
@DomName('SpeechSynthesis.getVoices')
@DocsEditable()
List<SpeechSynthesisVoice> getVoices() {
List<SpeechSynthesisVoice> voices = _getVoices();
if (voices.length > 0)