mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:19:49 +00:00
Fixed DOMRectList not having a prototype field.
TBR=vsm@google.com Change-Id: I6cbc38bbb2123b914d5b5511774425c403e614ed Reviewed-on: https://dart-review.googlesource.com/47183 Reviewed-by: Terry Lucas <terry@google.com> Commit-Queue: Terry Lucas <terry@google.com>
This commit is contained in:
parent
031ef989ac
commit
581c512345
|
@ -15884,6 +15884,24 @@ class Element extends Node
|
|||
@deprecated
|
||||
void enteredView() {}
|
||||
|
||||
@DomName('Element.getClientRects')
|
||||
@DocsEditable()
|
||||
@Returns('DomRectList|Null')
|
||||
@Creates('DomRectList')
|
||||
List<Rectangle> getClientRects() {
|
||||
var value = _getClientRects();
|
||||
|
||||
// If no prototype we need one for the world to hookup to the proper Dart class.
|
||||
var jsProto = JS('', '#.prototype', value);
|
||||
if (jsProto == null) {
|
||||
JS('', '#.prototype = Object.create(null)', value);
|
||||
}
|
||||
|
||||
applyExtension('DOMRectList', value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/** *Deprecated*: override [detached] instead. */
|
||||
@Experimental()
|
||||
@deprecated
|
||||
|
@ -17634,6 +17652,7 @@ class Element extends Node
|
|||
@Returns('_DomRect|Null')
|
||||
Rectangle getBoundingClientRect() native;
|
||||
|
||||
@JSName('getClientRects')
|
||||
/**
|
||||
* Returns a list of bounding rectangles for each box associated with this
|
||||
* element.
|
||||
|
@ -17650,7 +17669,7 @@ class Element extends Node
|
|||
@DocsEditable()
|
||||
@Returns('DomRectList|Null')
|
||||
@Creates('DomRectList')
|
||||
List<Rectangle> getClientRects() native;
|
||||
List<Rectangle> _getClientRects() native;
|
||||
|
||||
/**
|
||||
* Returns a list of shadow DOM insertion points to which this element is
|
||||
|
@ -33600,11 +33619,12 @@ class Range extends Interceptor {
|
|||
@DocsEditable()
|
||||
Rectangle getBoundingClientRect() native;
|
||||
|
||||
@JSName('getClientRects')
|
||||
@DomName('Range.getClientRects')
|
||||
@DocsEditable()
|
||||
@Returns('DomRectList|Null')
|
||||
@Creates('DomRectList')
|
||||
List<Rectangle> getClientRects() native;
|
||||
List<Rectangle> _getClientRects() native;
|
||||
|
||||
@DomName('Range.insertNode')
|
||||
@DocsEditable()
|
||||
|
@ -33650,6 +33670,24 @@ class Range extends Interceptor {
|
|||
@DocsEditable()
|
||||
void surroundContents(Node newParent) native;
|
||||
|
||||
@DomName('Range.getClientRects')
|
||||
@DocsEditable()
|
||||
@Returns('DomRectList|Null')
|
||||
@Creates('DomRectList')
|
||||
List<Rectangle> getClientRects() {
|
||||
var value = _getClientRects();
|
||||
|
||||
// If no prototype we need one for the world to hookup to the proper Dart class.
|
||||
var jsProto = JS('', '#.prototype', value);
|
||||
if (jsProto == null) {
|
||||
JS('', '#.prototype = Object.create(null)', value);
|
||||
}
|
||||
|
||||
applyExtension('DOMRectList', value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if createContextualFragment is supported.
|
||||
*
|
||||
|
|
|
@ -3,7 +3,14 @@ import 'dart:html';
|
|||
import 'package:expect/minitest.dart';
|
||||
|
||||
main() {
|
||||
var isRectList = predicate((x) => x is DomRectList, 'is a DomRectList');
|
||||
var isRectList =
|
||||
predicate((x) => x is DomRectList, 'should be a DomRectList');
|
||||
var isListOfRectangle =
|
||||
predicate((x) => x is List<Rectangle>, 'should be a List<Rectangle>');
|
||||
|
||||
var isRectangle = predicate((x) => x is Rectangle, 'should be a Rectangle');
|
||||
var isDomRectReadOnly =
|
||||
predicate((x) => x is DomRectReadOnly, 'should be a DomRectReadOnly');
|
||||
|
||||
insertTestDiv() {
|
||||
var element = new Element.tag('div');
|
||||
|
@ -16,16 +23,19 @@ main() {
|
|||
return element;
|
||||
}
|
||||
|
||||
test("ClientRectList test", () {
|
||||
test("DomRectList test", () {
|
||||
insertTestDiv();
|
||||
var range = new Range();
|
||||
var rects = range.getClientRects();
|
||||
expect(rects, isListOfRectangle);
|
||||
expect(rects, isRectList);
|
||||
});
|
||||
|
||||
test("ClientRect ==", () {
|
||||
var rect1 = document.body.getBoundingClientRect();
|
||||
var rect2 = document.body.getBoundingClientRect();
|
||||
expect(rect1, isRectangle);
|
||||
expect(rect1, isDomRectReadOnly);
|
||||
expect(rect1, equals(rect2));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -61,7 +61,6 @@ convert/streamed_conversion_utf8_encode_test: Pass, Timeout # Issue 29922
|
|||
convert/utf85_test: Slow, Pass
|
||||
html/async_spawnuri_test: RuntimeError # Issue 29922
|
||||
html/async_test: RuntimeError # Issue 29922
|
||||
html/client_rect_test: RuntimeError # Issue 29922, seems to be a reified type problem with DOMClientRect
|
||||
html/custom/attribute_changed_callback_test: Skip # Issue 31577
|
||||
html/custom/constructor_calls_created_synchronously_test: Skip # Issue 31577
|
||||
html/custom/created_callback_test: RuntimeError
|
||||
|
|
|
@ -339,6 +339,7 @@ private_html_members = monitored.Set('htmlrenamer.private_html_members', [
|
|||
'Element.children',
|
||||
'Element.childElementCount',
|
||||
'Element.firstElementChild',
|
||||
'Element.getClientRects',
|
||||
'Element.getElementsByTagName',
|
||||
'Element.insertAdjacentHTML',
|
||||
'Element.scrollIntoView',
|
||||
|
@ -420,6 +421,7 @@ private_html_members = monitored.Set('htmlrenamer.private_html_members', [
|
|||
'ParentNode.firstElementChild',
|
||||
'ParentNode.lastElementChild',
|
||||
'ParentNode.querySelectorAll',
|
||||
'Range.getClientRects',
|
||||
'RTCPeerConnection.createAnswer',
|
||||
'RTCPeerConnection.createOffer',
|
||||
'RTCPeerConnection.getStats',
|
||||
|
|
|
@ -782,6 +782,24 @@ $(ANNOTATIONS)$(NATIVESPEC)class $CLASSNAME$EXTENDS$IMPLEMENTS {
|
|||
@deprecated
|
||||
void enteredView() {}
|
||||
|
||||
@DomName('Element.getClientRects')
|
||||
@DocsEditable()
|
||||
@Returns('DomRectList|Null')
|
||||
@Creates('DomRectList')
|
||||
List<Rectangle> getClientRects() {
|
||||
var value = _getClientRects();
|
||||
|
||||
// If no prototype we need one for the world to hookup to the proper Dart class.
|
||||
var jsProto = JS('', '#.prototype', value);
|
||||
if (jsProto == null) {
|
||||
JS('', '#.prototype = Object.create(null)', value);
|
||||
}
|
||||
|
||||
applyExtension('DOMRectList', value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/** *Deprecated*: override [detached] instead. */
|
||||
@Experimental()
|
||||
@deprecated
|
||||
|
|
|
@ -13,6 +13,24 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
|
|||
document._caretRangeFromPoint(point.x, point.y);
|
||||
$!MEMBERS
|
||||
|
||||
@DomName('Range.getClientRects')
|
||||
@DocsEditable()
|
||||
@Returns('DomRectList|Null')
|
||||
@Creates('DomRectList')
|
||||
List<Rectangle> getClientRects() {
|
||||
var value = _getClientRects();
|
||||
|
||||
// If no prototype we need one for the world to hookup to the proper Dart class.
|
||||
var jsProto = JS('', '#.prototype', value);
|
||||
if (jsProto == null) {
|
||||
JS('', '#.prototype = Object.create(null)', value);
|
||||
}
|
||||
|
||||
applyExtension('DOMRectList', value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if createContextualFragment is supported.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue