- 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>
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index e7fe7d4..15ca7bc 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -11641,7 +11641,10 @@
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 @@
@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 @@
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 @@
@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]);
diff --git a/tests/lib_2/html/element_classes_svg_test.dart b/tests/lib_2/html/element_classes_svg_test.dart
index e7214a5..23a6de0 100644
--- a/tests/lib_2/html/element_classes_svg_test.dart
+++ b/tests/lib_2/html/element_classes_svg_test.dart
@@ -34,12 +34,9 @@
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);
diff --git a/tools/dom/idl/dart/dart.idl b/tools/dom/idl/dart/dart.idl
index a713b78..d5ee488 100644
--- a/tools/dom/idl/dart/dart.idl
+++ b/tools/dom/idl/dart/dart.idl
@@ -512,11 +512,10 @@
[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]
diff --git a/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate b/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
index 2b6bdf6..1b0f7a7 100644
--- a/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
+++ b/tools/dom/templates/html/impl/impl_DocumentFragment.darttemplate
@@ -58,7 +58,6 @@
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));
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index f8f956e..0b740f3 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -263,7 +263,10 @@
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;
diff --git a/tools/dom/templates/html/impl/impl_SpeechSynthesis.darttemplate b/tools/dom/templates/html/impl/impl_SpeechSynthesis.darttemplate
index 20e19cf..98b15e5 100644
--- a/tools/dom/templates/html/impl/impl_SpeechSynthesis.darttemplate
+++ b/tools/dom/templates/html/impl/impl_SpeechSynthesis.darttemplate
@@ -6,8 +6,6 @@
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS
{
- @DomName('SpeechSynthesis.getVoices')
- @DocsEditable()
List<SpeechSynthesisVoice> getVoices() {
List<SpeechSynthesisVoice> voices = _getVoices();
if (voices.length > 0)