mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Auto merge of #27227 - jdm:iterable, r=Manishearth
Make XRSession.inputSources iterable Fixes #27130.
This commit is contained in:
commit
9094e1d7bc
42 changed files with 73 additions and 114 deletions
|
@ -134,7 +134,6 @@ mod gen {
|
|||
}
|
||||
},
|
||||
canvas_text: {
|
||||
#[serde(rename = "dom.canvas-text.enabled")]
|
||||
enabled: bool,
|
||||
},
|
||||
composition_event: {
|
||||
|
|
|
@ -1672,8 +1672,27 @@ class MethodDefiner(PropertyDefiner):
|
|||
"condition": PropertyDefiner.getControllingCondition(m, descriptor)}
|
||||
for m in methods]
|
||||
|
||||
# FIXME Check for an existing iterator on the interface first.
|
||||
if any(m.isGetter() and m.isIndexed() for m in methods):
|
||||
# TODO: Once iterable is implemented, use tiebreak rules instead of
|
||||
# failing. Also, may be more tiebreak rules to implement once spec bug
|
||||
# is resolved.
|
||||
# https://www.w3.org/Bugs/Public/show_bug.cgi?id=28592
|
||||
def hasIterator(methods, regular):
|
||||
return (any("@@iterator" in m.aliases for m in methods)
|
||||
or any("@@iterator" == r["name"] for r in regular))
|
||||
|
||||
# Check whether we need to output an @@iterator due to having an indexed
|
||||
# getter. We only do this while outputting non-static and
|
||||
# non-unforgeable methods, since the @@iterator function will be
|
||||
# neither.
|
||||
if (not static
|
||||
and not unforgeable
|
||||
and descriptor.supportsIndexedProperties()): # noqa
|
||||
if hasIterator(methods, self.regular): # noqa
|
||||
raise TypeError("Cannot have indexed getter/attr on "
|
||||
"interface %s with other members "
|
||||
"that generate @@iterator, such as "
|
||||
"maplike/setlike or aliased functions." %
|
||||
self.descriptor.interface.identifier.name)
|
||||
self.regular.append({"name": '@@iterator',
|
||||
"methodInfo": False,
|
||||
"selfHostedName": "$ArrayValues",
|
||||
|
@ -2662,7 +2681,7 @@ class CGConstructorEnabled(CGAbstractMethod):
|
|||
pref = iface.getExtendedAttribute("Pref")
|
||||
if pref:
|
||||
assert isinstance(pref, list) and len(pref) == 1
|
||||
conditions.append('prefs::pref_map().get("%s").as_bool().unwrap_or(false)' % pref[0])
|
||||
conditions.append('pref!(%s)' % pref[0])
|
||||
|
||||
func = iface.getExtendedAttribute("Func")
|
||||
if func:
|
||||
|
|
|
@ -401,6 +401,9 @@ class Descriptor(DescriptorProvider):
|
|||
parent = parent.parent
|
||||
return None
|
||||
|
||||
def supportsIndexedProperties(self):
|
||||
return self.operations['IndexedGetter'] is not None
|
||||
|
||||
def hasDescendants(self):
|
||||
return (self.interface.getUserData("hasConcreteDescendant", False)
|
||||
or self.interface.getUserData("hasProxyDescendant", False))
|
||||
|
|
|
@ -148,12 +148,12 @@ interface mixin CanvasUserInterface {
|
|||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasText {
|
||||
// text (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces)
|
||||
[Pref="dom.canvas-text.enabled"]
|
||||
[Pref="dom.canvas_text.enabled"]
|
||||
void fillText(DOMString text, unrestricted double x, unrestricted double y,
|
||||
optional unrestricted double maxWidth);
|
||||
//void strokeText(DOMString text, unrestricted double x, unrestricted double y,
|
||||
// optional unrestricted double maxWidth);
|
||||
[Pref="dom.canvas-text.enabled"]
|
||||
[Pref="dom.canvas_text.enabled"]
|
||||
TextMetrics measureText(DOMString text);
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
// https://w3c.github.io/uievents/#idl-compositionevent
|
||||
[Exposed=Window, Pref="dom.compositionevent.enabled"]
|
||||
[Exposed=Window, Pref="dom.composition_event.enabled"]
|
||||
interface CompositionEvent : UIEvent {
|
||||
[Throws] constructor(DOMString type, optional CompositionEventInit eventInitDict = {});
|
||||
readonly attribute DOMString data;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#customelementregistry
|
||||
[Exposed=Window, Pref="dom.customelements.enabled"]
|
||||
[Exposed=Window, Pref="dom.custom_elements.enabled"]
|
||||
interface CustomElementRegistry {
|
||||
[Throws, CEReactions]
|
||||
void define(DOMString name, CustomElementConstructor constructor_, optional ElementDefinitionOptions options = {});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#textmetrics
|
||||
[Exposed=(PaintWorklet, Window, Worker), Pref="dom.canvas-text.enabled"]
|
||||
[Exposed=(PaintWorklet, Window, Worker), Pref="dom.canvas_text.enabled"]
|
||||
interface TextMetrics {
|
||||
// x-direction
|
||||
readonly attribute double width; // advance width
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"dom.bluetooth.enabled": false,
|
||||
"dom.bluetooth.testing.enabled": false,
|
||||
"dom.canvas-text.enabled": true,
|
||||
"dom.canvas_text.enabled": true,
|
||||
"dom.compositionevent.enabled": false,
|
||||
"dom.customelements.enabled": true,
|
||||
"dom.document.dblclick_dist": 1,
|
||||
|
|
|
@ -528290,6 +528290,13 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"xrInputSourceArray_iterable.html": [
|
||||
"de784d5d1a60fc15c0bea92e65a8a2a3ef0acf97",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"xrInputSource_add_remove.https.html": [
|
||||
"7764017910d2e5ada78febe954e9543aca89226b",
|
||||
[
|
||||
|
|
|
@ -1 +1 @@
|
|||
prefs: ["dom.canvas-text.enabled:false","dom.offscreen_canvas.enabled:true"]
|
||||
prefs: ["dom.offscreen_canvas.enabled:true"]
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.NaN.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.fontface.html]
|
||||
[fillText works on @font-face fonts]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.negative.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.small.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.zero.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.unaffected.html]
|
||||
[fillText does not start a new path or subpath]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fontface.html]
|
||||
[Canvas test: 2d.text.draw.fontface]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fontface.notinpage.html]
|
||||
[@font-face fonts should work even if they are not used in the page]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fontface.repeat.html]
|
||||
[Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.)]
|
||||
expected: FAIL
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
[canvas_text_font_001.htm]
|
||||
expected: FAIL
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.space.collapse.start.html]
|
||||
[Space characters at the start of a line are collapsed (per CSS)]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.NaN.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.NaN.worker.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.negative.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.negative.worker.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.small.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.small.worker.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.zero.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.maxWidth.zero.worker.html]
|
||||
[fillText handles maxWidth correctly]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.unaffected.html]
|
||||
[fillText does not start a new path or subpath]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[2d.text.draw.fill.unaffected.worker.html]
|
||||
[fillText does not start a new path or subpath]
|
||||
expected: FAIL
|
||||
|
|
@ -2,9 +2,6 @@
|
|||
[XR interface: attribute ondevicechange]
|
||||
expected: FAIL
|
||||
|
||||
[XRInputSourceArray interface: iterable<XRInputSource>]
|
||||
expected: FAIL
|
||||
|
||||
[XR interface: calling supportsSession(XRSessionMode) on navigator.xr with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/webxr_util.js"></script>
|
||||
<script src="resources/webxr_test_constants.js"></script>
|
||||
<canvas id="webgl-canvas"></canvas>
|
||||
<script>
|
||||
let testName = "XRInputSourceArray is iterable";
|
||||
let testFunction = function(session, fakeDeviceController, t) {
|
||||
return new Promise((resolve) => {
|
||||
let input_source = fakeDeviceController.simulateInputSourceConnection({
|
||||
handedness: "right",
|
||||
targetRayMode: "tracked-pointer",
|
||||
pointerOrigin: VALID_POINTER_TRANSFORM,
|
||||
gripOrigin: VALID_GRIP_TRANSFORM,
|
||||
profiles: ["foo", "bar"]
|
||||
});
|
||||
|
||||
requestSkipAnimationFrame(session, (time, xrFrame) => {
|
||||
let sources = [];
|
||||
t.step(() => {
|
||||
for (const source of session.inputSources) {
|
||||
sources.push(source);
|
||||
}
|
||||
assert_equals(sources.length, 1);
|
||||
});
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
xr_session_promise_test(
|
||||
testName, testFunction, TRACKED_IMMERSIVE_DEVICE, 'immersive-vr');
|
||||
</script>
|
|
@ -1,6 +1,4 @@
|
|||
[oes-texture-float-with-canvas.html]
|
||||
bug: https://github.com/servo/servo/issues/11681
|
||||
prefs: [dom.canvas-text.enabled:true]
|
||||
expected: ERROR
|
||||
[WebGL test #285: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
[oes-texture-half-float-with-canvas.html]
|
||||
bug: https://github.com/servo/servo/issues/11681
|
||||
prefs: [dom.canvas-text.enabled:true]
|
||||
expected: ERROR
|
||||
[WebGL test #285: shouldBe 127,0,0,127\nat (0, 0) expected: 127,0,0,127 was 255,0,0,255]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
[tex-2d-luminance-luminance-unsigned_byte.html]
|
||||
bug: https://github.com/servo/servo/issues/11681
|
||||
prefs: [dom.canvas-text.enabled:true]
|
||||
expected: ERROR
|
||||
[WebGL test #33: font missing]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
[tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html]
|
||||
bug: https://github.com/servo/servo/issues/11681
|
||||
prefs: [dom.canvas-text.enabled:true]
|
||||
expected: ERROR
|
||||
[WebGL test #245: font missing]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
[tex-2d-rgb-rgb-unsigned_byte.html]
|
||||
bug: https://github.com/servo/servo/issues/11681
|
||||
prefs: [dom.canvas-text.enabled:true]
|
||||
expected: ERROR
|
||||
[WebGL test #399: font missing]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
[tex-2d-rgb-rgb-unsigned_short_5_6_5.html]
|
||||
bug: https://github.com/servo/servo/issues/11681
|
||||
prefs: [dom.canvas-text.enabled:true]
|
||||
expected: ERROR
|
||||
[WebGL test #273: font missing]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
[tex-2d-rgba-rgba-unsigned_byte.html]
|
||||
bug: https://github.com/servo/servo/issues/11681
|
||||
prefs: [dom.canvas-text.enabled:true]
|
||||
expected: ERROR
|
||||
[WebGL test #399: font missing]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
[tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html]
|
||||
bug: https://github.com/servo/servo/issues/11681
|
||||
prefs: [dom.canvas-text.enabled:true]
|
||||
expected: ERROR
|
||||
[WebGL test #241: font missing]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
[tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html]
|
||||
bug: https://github.com/servo/servo/issues/11681
|
||||
prefs: [dom.canvas-text.enabled:true]
|
||||
expected: ERROR
|
||||
[WebGL test #241: font missing]
|
||||
expected: FAIL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue