From cc769c86ef7bfbfcf11f7548a08ed4c4d9320187 Mon Sep 17 00:00:00 2001
From: Elad Alon
+ Calling {{CropTarget/fromElement}} on an {{Element}} of a supported type associates
+ that {{Element}} with a {{CropTarget}}. This {{CropTarget}} may be used as input to
+ {{BrowserCaptureMediaStreamTrack/cropTo}}. We define a
+ valid CropTarget as one returned by a previous call to
+ {{CropTarget.fromElement()}} in the current [=top-level browsing context=] or any of
+ its
+ descendant browsing contexts.
+
+ When {{CropTarget/fromElement}} is called on a given element, the user
+ agent [=create a CropTarget|creates a CropTarget=] with element as input.
+ The user agent MUST return a {{Promise}} p. The user agent MUST resolve
+ p only after it has finished all the necessary internal propagation of
+ state associated with the new {{CropTarget}}, at which point the user agent MUST be
+ ready to receive the new {{CropTarget}} as a valid parameter to
+ {{BrowserCaptureMediaStreamTrack/cropTo}}.
+
+ When cloning an {{Element}} on which {{CropTarget/fromElement}} was previously called,
+ the clone is not associated with any {{CropTarget}}. If {{CropTarget/fromElement}} is
+ later called on the clone, a new {{CropTarget}} will be assigned to it.
+
+ There is no consensus yet on the following issue: Whether
+ {{CropTarget.fromElement()}} should return a {{CropTarget}} or a
+ {{Promise}}<{{CropTarget}}>. This is under discussion in
+ issue #17.
+
To create a CropTarget with element as input, run the
following steps:
@@ -209,63 +248,6 @@
- Calling {{MediaDevices/produceCropTarget}} on an {{Element}} of a supported type
- associates that {{Element}} with a {{CropTarget}}. This {{CropTarget}} may be used as
- input to {{BrowserCaptureMediaStreamTrack/cropTo}}. We define a
- valid CropTarget as one returned by a previous call to
- {{MediaDevices/produceCropTarget()}} in the current [=top-level browsing context=] or
- any of its
- descendant browsing contexts.
-
- When {{MediaDevices/produceCropTarget}} is called on a given element, the
- user agent [=create a CropTarget|creates a CropTarget=] with element as
- input. The user agent MUST return a {{Promise}} p. The user agent MUST
- resolve p only after it has finished all the necessary internal propagation
- of state associated with the new {{CropTarget}}, at which point the user agent MUST be
- ready to receive the new {{CropTarget}} as a valid parameter to
- {{BrowserCaptureMediaStreamTrack/cropTo}}.
-
- When cloning an {{Element}} on which {{MediaDevices/produceCropTarget}} was previously
- called, the clone is not associated with any {{CropTarget}}. If
- {{MediaDevices/produceCropTarget}} is later called on the clone, a new {{CropTarget}}
- will be assigned to it.
- There is no consensus yet on the following issues:
We define an {{Element}} for which a {{CropTarget}} was produced (through a call to
- {{MediaDevices/produceCropTarget}}) as a potential crop-target.
+ {{CropTarget/fromElement}}) as a potential crop-target.
We define a [=potential crop-target=] which is targeted by a successful call to
From 4440087f647fd55d47ebcd42efb8eef0c3978634 Mon Sep 17 00:00:00 2001
From: Elad Alon
- Calling {{CropTarget/fromElement}} on an {{Element}} of a supported type associates
+ Calling {{CropTarget/fromElement}} with an {{Element}} of a supported type associates
that {{Element}} with a {{CropTarget}}. This {{CropTarget}} may be used as input to
{{BrowserCaptureMediaStreamTrack/cropTo}}. We define a
valid CropTarget as one returned by a previous call to
@@ -177,7 +177,7 @@
- When {{CropTarget/fromElement}} is called on a given element, the user
+ When {{CropTarget/fromElement}} is called with a given element, the user
agent [=create a CropTarget|creates a CropTarget=] with element as input.
The user agent MUST return a {{Promise}} p. The user agent MUST resolve
p only after it has finished all the necessary internal propagation of
@@ -192,9 +192,10 @@
- There is no consensus yet on the following issue: Whether
- {{CropTarget.fromElement()}} should return a {{CropTarget}} or a
- {{Promise}}<{{CropTarget}}>. This is under discussion in
+ There is no consensus yet on the following issue: Whether producing a {{CropTarget}}
+ should be done by invoking an asynchronous method like {{CropTarget.fromElement()}},
+ or whether the to use a synchronous constructor that accepts an {{Element}} as
+ input. This is further discussed on
issue #17.
There is no consensus yet on the following issue: Whether producing a {{CropTarget}}
should be done by invoking an asynchronous method like {{CropTarget.fromElement()}},
- or whether the to use a synchronous constructor that accepts an {{Element}} as
+ or using a synchronous constructor that accepts an {{Element}} as
input. This is further discussed on
issue #17.
There is no consensus yet on the following issue: Whether producing a {{CropTarget}}
should be done by invoking an asynchronous method like {{CropTarget.fromElement()}},
- or using a synchronous constructor that accepts an {{Element}} as
- input. This is further discussed on
+ or using a synchronous constructor that accepts an {{Element}} as input. This is
+ further discussed on
issue #17.
Code in the capture-target:
- CropTarget is an intentionally empty, opaque identifier that exposes nothing. Its sole
- purpose is to be handed to {{BrowserCaptureMediaStreamTrack/cropTo}} as input.
+ CropTarget is an intentionally empty, opaque identifier. Its purpose is to be handed to
+ {{BrowserCaptureMediaStreamTrack/cropTo}} as input.
CropTarget Definition
[Exposed=(Window,Worker), Serializable]
interface CropTarget {
- // Intentionally empty; just an opaque identifier.
+ Promise<CropTarget> produceCropTarget(Element element);
};
CropTarget Definition
[Exposed=(Window,Worker), Serializable]
interface CropTarget {
- Promise<CropTarget> produceCropTarget(Element element);
+ [SecureContext] static Promise<CropTarget> fromElement(Element element);
};
CropTarget Definition
issue #18.
+
+
CropTarget Definition
- MediaDevices.produceCropTarget
-
- partial interface MediaDevices {
- Promise<CropTarget>
- produceCropTarget(Element element);
- };
-
-
-
-
-
- produceCropTarget()
should be exposed on instances of
- {{MediaDevices}} or on instances of {{Element}}. This is under discussion in
- issue #11.
- Cropping Mechanism
@@ -410,7 +392,7 @@ Crop-Session Lifetime
Crop-Session Definitions
CropTarget Definition
CropTarget Definition
>.
CropTarget Definition
CropTarget Definition
CropTarget Definition
Sample Code
const mainContentArea = navigator.getElementById('mainContentArea');
- const cropTarget = await navigator.mediaDevices.produceCropTarget(mainContentArea);
+ const cropTarget = await CropTarget.fromElement(mainContentArea);
sendCropTarget(cropTarget);
function sendCropTarget(cropTarget) {
From 27359e595d882daa0a78db3c114b525be7227731 Mon Sep 17 00:00:00 2001
From: Elad Alon
CropTarget Motivation
CropTarget Definition
[Exposed=(Window,Worker), Serializable]
From d5628dfb78d8ecefde8bd04e36332f2073ff2040 Mon Sep 17 00:00:00 2001
From: Elad Alon
CropTarget Definition
- There is no consensus yet on the following issue: Whether producing a {{CropTarget}}
+ There is no consensus yet on whether producing a {{CropTarget}}
should be done by invoking an asynchronous method like {{CropTarget.fromElement()}},
or using a synchronous constructor that accepts an {{Element}} as input. This is
further discussed on
From e2ccdd81273664c6f63aea915965900a9693be67 Mon Sep 17 00:00:00 2001
From: Elad Alon
There is no consensus yet on whether producing a {{CropTarget}}
should be done by invoking an asynchronous method like {{CropTarget.fromElement()}},
- or using a synchronous constructor that accepts an {{Element}} as input. This is
+ or a {{CropTarget}} constructor that accepts an {{Element}} as input. This is
further discussed on
issue #17.
CropTarget Definition
CropTarget Definition
issue #18.
+ There is no consensus yet on whether {{CropTarget/fromElement}} should be exposed beyond + secure contexts. +
+