From cc769c86ef7bfbfcf11f7548a08ed4c4d9320187 Mon Sep 17 00:00:00 2001 From: Elad Alon Date: Fri, 20 May 2022 14:45:47 +0200 Subject: [PATCH 01/10] x --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index cb92417..8db72ed 100644 --- a/index.html +++ b/index.html @@ -151,7 +151,7 @@

CropTarget Definition

           [Exposed=(Window,Worker), Serializable]
           interface CropTarget {
-            // Intentionally empty; just an opaque identifier.
+            Promise<CropTarget> produceCropTarget(Element element);
           };
         
From cee2d96b656b4ecc5f7a1e3b001fc81a02ad64aa Mon Sep 17 00:00:00 2001 From: Elad Alon Date: Fri, 20 May 2022 16:01:48 +0200 Subject: [PATCH 02/10] MediaDevices.produceCropTarget -> CropTarget.fromElement Change the point of exposure of token-minting from: MediaDevices.produceCropTarget() To: CropTarget.fromElement() --- index.html | 102 ++++++++++++++++++++++------------------------------- 1 file changed, 42 insertions(+), 60 deletions(-) diff --git a/index.html b/index.html index 8db72ed..94a2390 100644 --- a/index.html +++ b/index.html @@ -151,7 +151,7 @@

CropTarget Definition

           [Exposed=(Window,Worker), Serializable]
           interface CropTarget {
-            Promise<CropTarget> produceCropTarget(Element element);
+            [SecureContext] static Promise<CropTarget> fromElement(Element element);
           };
         
@@ -160,7 +160,46 @@

CropTarget Definition

issue #18.

-
+
+
+ fromElement() +
+
+

+ 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 @@

CropTarget Definition

-
-

MediaDevices.produceCropTarget

-
-          partial interface MediaDevices {
-            Promise<CropTarget>
-            produceCropTarget(Element element);
-          };
-        
-
-
- produceCropTarget() -
-
-

- 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:

-
    -
  • - Whether produceCropTarget() should be exposed on instances of - {{MediaDevices}} or on instances of {{Element}}. This is under discussion in - issue #11. -
  • -
  • - Whether {{MediaDevices/produceCropTarget()}} should return a {{CropTarget}} or a - {{Promise}}<{{CropTarget}}>. This is under discussion in - issue #17. -
  • -
-
-

Cropping Mechanism

@@ -410,7 +392,7 @@

Crop-Session Lifetime

Crop-Session Definitions

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 Date: Tue, 24 May 2022 10:02:52 +0200 Subject: [PATCH 03/10] Code review pass #1 --- index.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 94a2390..d0f334b 100644 --- a/index.html +++ b/index.html @@ -166,7 +166,7 @@

CropTarget Definition

- 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 @@

CropTarget Definition

>.

- 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 @@

CropTarget Definition

- 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.

From cb1d78e8026b44936249d55c207ae9537ec1e8db Mon Sep 17 00:00:00 2001 From: Elad Alon Date: Tue, 24 May 2022 15:04:20 +0200 Subject: [PATCH 04/10] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François Beaufort --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index d0f334b..09bf643 100644 --- a/index.html +++ b/index.html @@ -194,7 +194,7 @@

CropTarget Definition

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.

From 3e0b08664d17ea541f533b131f73fe4091a24753 Mon Sep 17 00:00:00 2001 From: Elad Alon Date: Tue, 24 May 2022 15:04:49 +0200 Subject: [PATCH 05/10] Re-run formatter --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 09bf643..e2ac998 100644 --- a/index.html +++ b/index.html @@ -194,8 +194,8 @@

CropTarget Definition

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.

From 71f998e508cf39f552164b4678b6effeca85cde6 Mon Sep 17 00:00:00 2001 From: Elad Alon Date: Tue, 24 May 2022 15:05:43 +0200 Subject: [PATCH 06/10] Update sample code --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index e2ac998..7c0345f 100644 --- a/index.html +++ b/index.html @@ -467,7 +467,7 @@

Sample Code

Code in the capture-target:

           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 
Date: Tue, 24 May 2022 16:30:31 +0200
Subject: [PATCH 07/10] Code review pass #2

---
 index.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/index.html b/index.html
index 7c0345f..e59ba77 100644
--- a/index.html
+++ b/index.html
@@ -145,8 +145,8 @@ 

CropTarget Motivation

CropTarget Definition

- 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.

           [Exposed=(Window,Worker), Serializable]

From d5628dfb78d8ecefde8bd04e36332f2073ff2040 Mon Sep 17 00:00:00 2001
From: Elad Alon 
Date: Fri, 27 May 2022 10:38:15 +0200
Subject: [PATCH 08/10] Update index.html

Co-authored-by: Jan-Ivar Bruaroey 
---
 index.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.html b/index.html
index e59ba77..d25697a 100644
--- a/index.html
+++ b/index.html
@@ -192,7 +192,7 @@ 

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 Date: Fri, 27 May 2022 10:38:33 +0200 Subject: [PATCH 09/10] Update index.html Co-authored-by: Jan-Ivar Bruaroey --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index d25697a..a3e73d3 100644 --- a/index.html +++ b/index.html @@ -194,7 +194,7 @@

CropTarget Definition

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.

From ffce3e3df712b7b5cf5c1f7c772873d32219baaa Mon Sep 17 00:00:00 2001 From: Elad Alon Date: Tue, 31 May 2022 10:58:45 +0200 Subject: [PATCH 10/10] Add note about SecureContext --- index.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.html b/index.html index e59ba77..0850c29 100644 --- a/index.html +++ b/index.html @@ -160,6 +160,12 @@

CropTarget Definition

issue #18.

+
+

+ There is no consensus yet on whether {{CropTarget/fromElement}} should be exposed beyond + secure contexts. +

+
fromElement()